Class: Facebooker::Rails::IntegrationSession

Inherits:
ActionController::Integration::Session
  • Object
show all
Includes:
TestHelpers
Defined in:
lib/facebooker/rails/integration_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TestHelpers

#assert_facebook_redirect_to, #facebook_delete, #facebook_get, #facebook_params, #facebook_post, #facebook_put, #facebook_verb, #follow_facebook_redirect!

Instance Attribute Details

#canvasObject

Returns the value of attribute canvas.



5
6
7
# File 'lib/facebooker/rails/integration_session.rb', line 5

def canvas
  @canvas
end

#default_request_paramsObject

Returns the value of attribute default_request_params.



5
6
7
# File 'lib/facebooker/rails/integration_session.rb', line 5

def default_request_params
  @default_request_params
end

Instance Method Details

#get(path, parameters = nil, headers = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/facebooker/rails/integration_session.rb', line 20

def get(path, parameters = nil, headers = nil)
  if canvas
    post path, (parameters || {}).merge('fb_sig_request_method' => 'GET'), headers
  else
    super path, parameters, headers
  end
end

#process(method, path, parameters = nil, headers = nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/facebooker/rails/integration_session.rb', line 7

def process(method, path, parameters = nil, headers = nil)
  if canvas
    parameters = facebook_params(@default_request_params.merge(parameters || {}))
  end
  super method, path, parameters, headers
end

#reset!Object



14
15
16
17
18
# File 'lib/facebooker/rails/integration_session.rb', line 14

def reset!
  self.default_request_params = {:fb_sig_in_canvas => '1', :fb_sig_api_key => Facebooker::Session.api_key}.with_indifferent_access
  self.canvas = true
  super
end