Class: Tinderb::Client
- Inherits:
-
Object
show all
- Includes:
- Request
- Defined in:
- lib/tinderb/client.rb
Instance Method Summary
collapse
Methods included from Request
#delete, #get, #post, #put
Constructor Details
#initialize(facebook_token: nil, facebook_id: nil) ⇒ Client
Returns a new instance of Client.
10
11
12
|
# File 'lib/tinderb/client.rb', line 10
def initialize(facebook_token: nil, facebook_id: nil)
@oauth_params = params(facebook_token, facebook_id)
end
|
Instance Method Details
#authorize ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/tinderb/client.rb', line 21
def authorize
res = post(OAUTH_PATH, @oauth_params)
raise "error occurred. body: #{res.body}" unless res.status == 200
@token = res.body['token']
res
end
|
#params(facebook_token, facebook_id) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/tinderb/client.rb', line 14
def params(facebook_token, facebook_id)
{
facebook_token: ENV.fetch('FACEBOOK_TOKEN', facebook_token),
facebook_id: ENV.fetch('FACEBOOK_ID', facebook_id)
}
end
|