Class: Ponch::Middleware
- Inherits:
-
Object
- Object
- Ponch::Middleware
- Defined in:
- lib/ponch/middleware.rb
Instance Method Summary collapse
- #_call(env) ⇒ Object
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
4 5 6 |
# File 'lib/ponch/middleware.rb', line 4 def initialize(app, = {}) @app = app end |
Instance Method Details
#_call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ponch/middleware.rb', line 12 def _call(env) req = Rack::Request.new(env) if req.params['ponch'] delivery = Ponch::Delivery.find_by_code req.params['ponch'] if delivery delivery.open_and_click!(req.ip) end end @app.call(env) end |
#call(env) ⇒ Object
8 9 10 |
# File 'lib/ponch/middleware.rb', line 8 def call(env) dup._call(env) end |