class TinderPyro::Requestor
Public Instance Methods
auth_request(facebook_id, facebook_token)
click to toggle source
# File lib/pyro/requestor.rb, line 7 def auth_request(facebook_id, facebook_token) post_request( :auth, facebook_id: facebook_id, facebook_token: facebook_token ).tap do |response| @auth_token = response['token'] end end
get_request(endpoint)
click to toggle source
# File lib/pyro/requestor.rb, line 17 def get_request(endpoint) self.class.get("/#{endpoint}", headers: all_headers) end
post_request(endpoint, data = {})
click to toggle source
# File lib/pyro/requestor.rb, line 21 def post_request(endpoint, data = {}) self.class.post( "/#{endpoint}", body: data.to_json, headers: all_headers ) end
Private Instance Methods
all_headers()
click to toggle source
# File lib/pyro/requestor.rb, line 31 def all_headers default_headers.merge(auth_headers) end
auth_headers()
click to toggle source
# File lib/pyro/requestor.rb, line 35 def auth_headers if @auth_token { 'Authentication' => %Q(Token token="#{@auth_token}"), 'X-Auth-Token' => @auth_token } else {} end end
default_headers()
click to toggle source
# File lib/pyro/requestor.rb, line 46 def default_headers { 'Content-Type' => 'application/json; charset=utf-8', 'User-Agent' => 'Tinder/3.0.2 (iPhone; iOS 7.0.4; Scale/2.00)' } end