Class: IDoneThis::Middleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- IDoneThis::Middleware
- Defined in:
- lib/idonethis/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
- #on_complete(env) ⇒ Object
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
9 10 11 |
# File 'lib/idonethis/middleware.rb', line 9 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
3 4 5 6 7 |
# File 'lib/idonethis/middleware.rb', line 3 def call(env) @app.call(env).on_complete do |env| on_complete(env) end end |
#on_complete(env) ⇒ Object
13 14 15 16 17 |
# File 'lib/idonethis/middleware.rb', line 13 def on_complete(env) if env[:url].path.match(/dones\/$/) env[:body].map!{|done_hash| Done.new(done_hash) } end end |