Class: IronBank::FaradayMiddleware::Response::RenewAuth
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- IronBank::FaradayMiddleware::Response::RenewAuth
- Defined in:
- lib/iron_bank/faraday_middleware/response/renew_auth.rb
Overview
This middleware reauthorize the request on unauthorized request
Instance Method Summary collapse
-
#initialize(app, auth) ⇒ RenewAuth
constructor
A new instance of RenewAuth.
- #on_complete(env) ⇒ Object
Constructor Details
#initialize(app, auth) ⇒ RenewAuth
Returns a new instance of RenewAuth.
11 12 13 14 15 |
# File 'lib/iron_bank/faraday_middleware/response/renew_auth.rb', line 11 def initialize(app, auth) @auth = auth super(app) end |
Instance Method Details
#on_complete(env) ⇒ Object
17 18 19 20 21 |
# File 'lib/iron_bank/faraday_middleware/response/renew_auth.rb', line 17 def on_complete(env) @env = env renew_auth_header if env.status == 401 end |