Module: Facebooker::Merb::Controller

Defined in:
lib/merb_facebooker/controller.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



4
5
6
7
# File 'lib/merb_facebooker/controller.rb', line 4

def self.included(controller)
  controller.extend(ClassMethods)
  controller.before :set_fbml_format
end

Instance Method Details

#absolute_url(*args) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/merb_facebooker/controller.rb', line 9

def absolute_url(*args)
  options  = extract_options_from_args!(args) || {}
  options[:protocol] ||= request.protocol
  options[:host] ||= Facebooker.canvas_server_base + Facebooker.facebook_path_prefix
  args << options
  super(*args)
end

#facebook_paramsObject

initializes the @facebook_params instance using the method verified_facebook_params



41
42
43
# File 'lib/merb_facebooker/controller.rb', line 41

def facebook_params
  @facebook_params ||= verified_facebook_params
end

#facebook_sessionObject

Just returns the @facebook_session instance variable



20
21
22
# File 'lib/merb_facebooker/controller.rb', line 20

def facebook_session
  @facebook_session
end

#set_facebook_sessionObject

Tries to secure the facebook_session, if it is not secured already, it tries to secure it via the request parameter ‘auth_token’, if that doesn’t work, it tries to use the parameters from facebook (this could be in the request or via cookies [cookies in case of FBConnect]).



29
30
31
32
33
34
35
36
# File 'lib/merb_facebooker/controller.rb', line 29

def set_facebook_session
  session_set = session_already_secured? || secure_with_token! || secure_with_facebook_params!
  if session_set
    capture_facebook_friends_if_available! 
    Session.current = facebook_session
  end
  session_set
end