Module: Facebooker::Rails::Controller
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
#render_publisher_error, #render_publisher_interface, #render_publisher_response, #wants_interface?
#one_or_true, #zero_or_false
Class Method Details
.included(controller) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/facebooker/rails/controller.rb', line 11
def self.included(controller)
controller.extend(ClassMethods)
controller.before_filter :set_facebook_request_format
controller.helper_attr :facebook_session_parameters
controller.helper_method :request_comes_from_facebook?
end
|
Instance Method Details
#create_facebook_session ⇒ Object
32
33
34
|
# File 'lib/facebooker/rails/controller.rb', line 32
def create_facebook_session
secure_with_facebook_params! or secure_with_cookies! or secure_with_token!
end
|
#create_facebook_session_with_secret ⇒ Object
this is used to proxy a connection through a rails app so the facebook secret key is not needed iphone apps use this
38
39
40
|
# File 'lib/facebooker/rails/controller.rb', line 38
def create_facebook_session_with_secret
secure_with_session_secret!
end
|
#facebook_params ⇒ Object
58
59
60
|
# File 'lib/facebooker/rails/controller.rb', line 58
def facebook_params
@facebook_params ||= verified_facebook_params
end
|
#facebook_session ⇒ Object
24
25
26
|
# File 'lib/facebooker/rails/controller.rb', line 24
def facebook_session
@facebook_session
end
|
#facebook_session_parameters ⇒ Object
28
29
30
|
# File 'lib/facebooker/rails/controller.rb', line 28
def facebook_session_parameters
{:fb_sig_session_key=>params[:fb_sig_session_key]}
end
|
#initialize(*args) ⇒ Object
18
19
20
21
22
|
# File 'lib/facebooker/rails/controller.rb', line 18
def initialize *args
@facebook_session = nil
@installation_required = nil
super
end
|
#redirect_to(*args) ⇒ Object
prevent Facebooker from rendering fb:redirect
18
19
20
|
# File 'lib/facebooker/rails/cucumber.rb', line 18
def redirect_to(*args)
super
end
|
#set_facebook_session ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/facebooker/rails/controller.rb', line 42
def set_facebook_session
session_set = session_already_secured? and session_for_current_user?
unless session_set
session_set = create_facebook_session
session[:facebook_session] = @facebook_session if session_set
end
if session_set
capture_facebook_friends_if_available!
Session.current = facebook_session
end
return session_set
end
|
#top_redirect_to(*args) ⇒ Object
Redirects the top window to the given url if the content is in an iframe, otherwise performs a normal redirect_to call.
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/facebooker/rails/controller.rb', line 64
def top_redirect_to(*args)
if request_is_facebook_iframe?
@redirect_url = url_for(*args)
render :layout => false, :inline => <<-HTML
<html><head>
<script type="text/javascript">
window.top.location.href = <%= @redirect_url.to_json -%>;
</script>
<noscript>
<meta http-equiv="refresh" content="0;url=<%=h @redirect_url %>" />
<meta http-equiv="window-target" content="_top" />
</noscript>
</head></html>
HTML
else
redirect_to(*args)
end
end
|