Class: FaradayMiddleware::RaiseSageOneException Private
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FaradayMiddleware::RaiseSageOneException
- Defined in:
- lib/faraday/response/raise_sage_one_exception.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Checks the status of the API request and raises relevant exceptions when detected.
Instance Method Summary collapse
- #call(env) ⇒ Object private
Instance Method Details
#call(env) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/faraday/response/raise_sage_one_exception.rb', line 12 def call(env) @app.call(env).on_complete do |response| case response[:status].to_i when 400 raise SageOne::BadRequest, (response) when 401 raise SageOne::Unauthorized, (response) when 403 raise SageOne::Forbidden, (response) when 404 raise SageOne::NotFound, (response) when 409 raise SageOne::Conflict, (response) when 422 raise SageOne::UnprocessableEntity, (response) end end end |