Class: FbGraph::Auth
- Inherits:
-
Object
- Object
- FbGraph::Auth
- Defined in:
- lib/fb_graph/auth.rb,
lib/fb_graph/auth/cookie.rb
Defined Under Namespace
Classes: Cookie, VerificationFailed
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client ⇒ Object
Returns the value of attribute client.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #from_cookie(cookie) ⇒ Object
-
#initialize(client_id, client_secret, options = {}) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(client_id, client_secret, options = {}) ⇒ Auth
Returns a new instance of Auth.
7 8 9 10 11 12 13 14 |
# File 'lib/fb_graph/auth.rb', line 7 def initialize(client_id, client_secret, = {}) @client = OAuth2::Client.new(client_id, client_secret, .merge( :site => FbGraph::ROOT_URL )) if [:cookie].present? ([:cookie]) end end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
5 6 7 |
# File 'lib/fb_graph/auth.rb', line 5 def access_token @access_token end |
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/fb_graph/auth.rb', line 5 def client @client end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/fb_graph/auth.rb', line 5 def user @user end |
Instance Method Details
#from_cookie(cookie) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fb_graph/auth.rb', line 16 def () = FbGraph::Auth::Cookie.parse(self.client, ) self.access_token = OAuth2::AccessToken.new( self.client, [:access_token], [:refresh_token], [:expires] ) self.user = FbGraph::User.new([:uid], :access_token => self.access_token) self end |