Class: Rack::Initforthe::Facebook::LikeGate
- Inherits:
-
Object
- Object
- Rack::Initforthe::Facebook::LikeGate
- Defined in:
- lib/rack/initforthe/facebook/like_gate.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, url, options = {}) ⇒ LikeGate
constructor
A new instance of LikeGate.
Constructor Details
#initialize(app, url, options = {}) ⇒ LikeGate
Returns a new instance of LikeGate.
5 6 7 8 |
# File 'lib/rack/initforthe/facebook/like_gate.rb', line 5 def initialize(app, url, = {}) @app = app @url = url end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/rack/initforthe/facebook/like_gate.rb', line 10 def call(env) signed_params = env['facebook.signed_request'] if signed_params.nil? || page_liked?(signed_params) @app.call(env) else [301, { 'Location' => @url }, ['Please like the application']] end end |