Class: Fbuser::Facebook
- Inherits:
-
Object
- Object
- Fbuser::Facebook
- Includes:
- HTTParty
- Defined in:
- app/facebook/fbuser/facebook.rb
Instance Method Summary collapse
- #get_long_token(short_token) ⇒ Object
- #get_user_id(token) ⇒ Object
-
#initialize ⇒ Facebook
constructor
format :json debug_output $stdout.
Constructor Details
#initialize ⇒ Facebook
format :json debug_output $stdout
10 11 |
# File 'app/facebook/fbuser/facebook.rb', line 10 def initialize() end |
Instance Method Details
#get_long_token(short_token) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/facebook/fbuser/facebook.rb', line 13 def get_long_token(short_token) params = { grant_type: "fb_exchange_token", client_id: ENV["FB_APP_ID1"], client_secret: ENV["FB_APP_SECRET1"], fb_exchange_token: short_token } headers = { 'Content-Type' => 'application/json' } response = self.class.get("/oauth/access_token", query: params, headers: headers) if response.code == 200 return parse_token(response.body) else return "" end end |
#get_user_id(token) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'app/facebook/fbuser/facebook.rb', line 29 def get_user_id(token) = { query:{ fields: "id", access_token: token } } response = self.class.get("/me", ) return response end |