Class: Metova::Oauth::FacebookProvider
Constant Summary
collapse
- FACEBOOK_API_URL =
'https://graph.facebook.com/v2.6'
- ME_URL =
-> (token) { "#{FACEBOOK_API_URL}/me?fields=name,email&access_token=#{token}" }
Instance Attribute Summary
#access_token, #info, #token_secret, #uid
Instance Method Summary
collapse
authenticate, #initialize
Instance Method Details
#authenticate ⇒ Object
7
8
9
10
11
|
# File 'lib/metova/oauth/facebook_provider.rb', line 7
def authenticate
self.info = OmniAuth::AuthHash.new me
self.uid = info.id
self
end
|
#me ⇒ Object
21
22
23
24
25
|
# File 'lib/metova/oauth/facebook_provider.rb', line 21
def me
super do
JSON.parse URI.parse(ME_URL[access_token]).read
end
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/metova/oauth/facebook_provider.rb', line 13
def name
'Facebook'
end
|
#provider ⇒ Object
17
18
19
|
# File 'lib/metova/oauth/facebook_provider.rb', line 17
def provider
:facebook
end
|