Class: Response::RaiseHttp4xx
- Inherits:
-
Middleware
- Object
- Middleware
- Response::RaiseHttp4xx
- Defined in:
- lib/faraday/raise_http_4xx.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app) ⇒ RaiseHttp4xx
constructor
A new instance of RaiseHttp4xx.
Constructor Details
#initialize(app) ⇒ RaiseHttp4xx
Returns a new instance of RaiseHttp4xx.
22 23 24 25 |
# File 'lib/faraday/raise_http_4xx.rb', line 22 def initialize(app) super @parser = nil end |
Class Method Details
.register_on_complete(env) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/faraday/raise_http_4xx.rb', line 5 def self.register_on_complete(env) env[:response].on_complete do |response| case response[:status].to_i when 400 raise BullionVault::BadRequest, (response) when 401 raise BullionVault::Unauthorized, (response) when 403 raise BullionVault::Forbidden, (response) when 404 raise BullionVault::NotFound, (response) when 406 raise BullionVault::NotAcceptable, (response) end end end |