class Tinder::Client
Attributes
token[R]
Public Class Methods
new(fb_token = nil)
click to toggle source
# File lib/tinder/client.rb, line 5 def initialize(fb_token = nil) @token = fb_token ? auth(fb_token)['token'] : nil end
Public Instance Methods
auth(fb_token)
click to toggle source
# File lib/tinder/client.rb, line 9 def auth(fb_token) res = Util.post('/auth', {facebook_token: fb_token}) JSON.parse(res.body) end
change_filter(age_filter_min: 18, age_filter_max: 30, gender: 0, gender_filter: 1, distance_filter: 50)
click to toggle source
# File lib/tinder/client.rb, line 29 def change_filter(age_filter_min: 18, age_filter_max: 30, gender: 0, gender_filter: 1, distance_filter: 50) if gender.is_a?(String) gender = gender == 'man' ? 0 : 1 end if gender_filter.is_a?(String) gender_filter = gender_filter == 'man' ? 0 : 1 end payload = { age_filter_min: age_filter_min, age_filter_max: age_filter_max, gender: gender, gender_filter: gender_filter, distance_filter: distance_filter } res = Util.post('/profile', payload, {'X-Auth-Token': token}) JSON.parse(res.body) end
change_location(lat, lon)
click to toggle source
# File lib/tinder/client.rb, line 50 def change_location(lat, lon) res = Util.post('/user/ping', {lat: lat, lon: lon}, {'X-Auth-Token': token}) JSON.parse(res.body) end
profile()
click to toggle source
# File lib/tinder/client.rb, line 24 def profile res = Util.get('/profile', {}, {'X-Auth-Token': token}) JSON.parse(res.body) end
recs()
click to toggle source
# File lib/tinder/client.rb, line 14 def recs res = Util.get('/user/recs', {}, {'X-Auth-Token': token}) JSON.parse(res.body)['results'] end
user(id)
click to toggle source
# File lib/tinder/client.rb, line 19 def user(id) res = Util.get('/user/' + id, {}, {'X-Auth-Token': token}) JSON.parse(res.body)['results'] end