Module: Facebook::Access::Helper
- Included in:
- Facebook::Auth::Devise
- Defined in:
- lib/facebook/access/helper.rb
Defined Under Namespace
Classes: Decoder
Instance Method Summary collapse
- #access_token_from_code ⇒ Object
- #auth_provider ⇒ Object
- #auth_url ⇒ Object
- #cookies_access_token ⇒ Object
- #fb_app ⇒ Object
- #fb_graph ⇒ Object
- #fb_login(permissions = nil) ⇒ Object
- #fb_login!(permissions = nil) ⇒ Object
- #fb_my_id ⇒ Object
- #fb_retrieve_access_token ⇒ Object
- #real_time_updates ⇒ Object
- #registration ⇒ Object
-
#signed_request ⇒ Object
for FB Registration plugin see developers.facebook.com/docs/plugins/registration/.
- #user_access_token ⇒ Object
Instance Method Details
#access_token_from_code ⇒ Object
9 10 11 |
# File 'lib/facebook/access/helper.rb', line 9 def access_token_from_code session[:oauth].get_access_token(code) end |
#auth_provider ⇒ Object
57 58 59 |
# File 'lib/facebook/access/helper.rb', line 57 def auth_provider params[:provider] || 'facebook' end |
#auth_url ⇒ Object
39 40 41 |
# File 'lib/facebook/access/helper.rb', line 39 def auth_url @auth_url end |
#cookies_access_token ⇒ Object
25 26 27 |
# File 'lib/facebook/access/helper.rb', line 25 def @cookies_access_token ||= session[:oauth].() end |
#fb_app ⇒ Object
43 44 45 |
# File 'lib/facebook/access/helper.rb', line 43 def fb_app Facebook::App.instance end |
#fb_graph ⇒ Object
47 48 49 50 51 |
# File 'lib/facebook/access/helper.rb', line 47 def fb_graph @fb_graph ||= graph_api.new session log! 'fb_graph', @fb_graph @fb_graph end |
#fb_login(permissions = nil) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/facebook/access/helper.rb', line 13 def fb_login = nil session[:oauth] = oauth_api.new(fb_app.identifier, fb_app.secret, fb_app.site_url + fb_app.callback_path) log! 'session-oath', session[:oauth] @auth_url = session[:oauth].url_for_oauth_code(:permissions=> || fb_app.) log! 'auth_url', @auth_url end |
#fb_login!(permissions = nil) ⇒ Object
20 21 22 23 |
# File 'lib/facebook/access/helper.rb', line 20 def fb_login! = nil fb_login redirect_to auth_url end |
#fb_my_id ⇒ Object
53 54 55 |
# File 'lib/facebook/access/helper.rb', line 53 def fb_my_id @fb_my_id ||= fb_graph.my_id end |
#fb_retrieve_access_token ⇒ Object
4 5 6 7 |
# File 'lib/facebook/access/helper.rb', line 4 def fb_retrieve_access_token session[:access_token] = has_code? ? access_token_from_code : log! 'session-access_token', session[:access_token] end |
#real_time_updates ⇒ Object
35 36 37 |
# File 'lib/facebook/access/helper.rb', line 35 def real_time_updates @updates = Facebook.updates_api.new(:app_id => fb_app.identifier, :secret => fb_app.secret) end |
#registration ⇒ Object
67 68 69 |
# File 'lib/facebook/access/helper.rb', line 67 def registration signed_request.registration end |
#signed_request ⇒ Object
for FB Registration plugin see developers.facebook.com/docs/plugins/registration/
63 64 65 |
# File 'lib/facebook/access/helper.rb', line 63 def signed_request Hashie::Mash.new decoded_signed_request end |
#user_access_token ⇒ Object
29 30 31 32 33 |
# File 'lib/facebook/access/helper.rb', line 29 def user_access_token @user_access_token ||= ["access_token"] log! 'user cookie access_token', @user_access_token @user_access_token end |