Module: AuthlogicFacebookShim::Session::Adapter
- Defined in:
- lib/authlogic_facebook_shim/session/adapters/koala_adapter.rb
Instance Method Summary collapse
Instance Method Details
#facebook_session ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/authlogic_facebook_shim/session/adapters/koala_adapter.rb', line 5 def facebook_session @facebook_session ||= begin if controller..has_key?("fbs_#{facebook_app_id}") oauth = Koala::Facebook::OAuth.new(facebook_app_id, facebook_secret_key) if oauth.respond_to?(:get_user_info_from_cookie) user_info = oauth.(controller.) else user_info = oauth.(controller.) end OpenStruct.new( user_info ) end end end |
#facebook_session? ⇒ Boolean
19 20 21 |
# File 'lib/authlogic_facebook_shim/session/adapters/koala_adapter.rb', line 19 def facebook_session? !facebook_session.nil? end |
#facebook_user ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/authlogic_facebook_shim/session/adapters/koala_adapter.rb', line 23 def facebook_user @facebook_user ||= begin facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token) user = facebook_graph.get_object('me') user[:uid] = user.delete('id') OpenStruct.new( user ) end if facebook_session? end |