@options = { query: {site: service, page: page} }
What does this do? In javascript this, I think would be object definition, however I cannot find what exactly it is in ruby. This would be the full code:
class StackExchange
include HTTParty
base_uri 'api.stackexchange.com'
def initialize(service, page)
@options = { query: {site: service, page: page} }
end
def questions
self.class.get("/2.2/questions", @options)
end
def users
self.class.get("/2.2/users", @options)
end
end
Aucun commentaire:
Enregistrer un commentaire