Class: Rack::Initforthe::Facebook::SignedRequest
- Inherits:
-
Object
- Object
- Rack::Initforthe::Facebook::SignedRequest
- Defined in:
- lib/rack/initforthe/facebook/signed_request.rb
Instance Method Summary collapse
- #app_id ⇒ Object
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ SignedRequest
constructor
A new instance of SignedRequest.
Constructor Details
#initialize(app, options = {}) ⇒ SignedRequest
Returns a new instance of SignedRequest.
5 6 7 8 |
# File 'lib/rack/initforthe/facebook/signed_request.rb', line 5 def initialize(app, = {}) @app = app @options = end |
Instance Method Details
#app_id ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rack/initforthe/facebook/signed_request.rb', line 10 def app_id @app_id ||= begin app_id = @options[:app_id] app_id.respond_to?(:call) ? app_id.call : app_id end end |
#call(env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rack/initforthe/facebook/signed_request.rb', line 17 def call(env) request = Request.new(env) if !app_id.nil? && request.["fbsr_#{app_id}"] env['facebook.signed_cookie'] = parse_signature(request.["fbsr_#{app_id}"]) end if request.params['signed_request'] env['facebook.signed_request'] = parse_signature(request.params['signed_request']) end @app.call(env) end |