Sha256: a788f4e9bdac4e11c107c6c5b088a92206f86bd280b0e6973e93208d78dcefd1

Contents?: true

Size: 1.03 KB

Versions: 43

Compression:

Stored size: 1.03 KB

Contents

require 'action_controller/integration'

class Facebooker::Rails::IntegrationSession < ActionController::Integration::Session
  include Facebooker::Rails::TestHelpers
  attr_accessor :default_request_params, :canvas
  
  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
  
  def reset!
    self.default_request_params = {:fb_sig_in_canvas => '1'}.with_indifferent_access
    self.canvas = true
    super
  end
  
  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
  
  %w(put delete).each do |method|
    define_method method do |*args|
      if canvas
        path, parameters, headers = *args
        post path, (parameters || {}).merge('_method' => method.upcase), headers
      else
        super *args
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 9 rubygems

Version Path
corey-facebooker-1.0.28.1 lib/facebooker/rails/integration_session.rb
fs-facebooker-1.0.37 lib/facebooker/rails/integration_session.rb
mborromeo-facebooker-1.0.28 lib/facebooker/rails/integration_session.rb
mborromeo-facebooker-1.0.29 lib/facebooker/rails/integration_session.rb
mborromeo-facebooker-1.0.30 lib/facebooker/rails/integration_session.rb
mborromeo-facebooker-1.0.31 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.19 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.20 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.21 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.22 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.23 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.24 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.25 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.26 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.27 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.28 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.29 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.30 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.31 lib/facebooker/rails/integration_session.rb
mmangino-facebooker-1.0.32 lib/facebooker/rails/integration_session.rb