Class: PaylocityWebService::Middleware::Response::RaiseError
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- PaylocityWebService::Middleware::Response::RaiseError
- Defined in:
- lib/paylocity_web_service/middleware/response/raise_error.rb
Overview
This class raises an exception based HTTP status codes returned by the API
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ RaiseError
constructor
A new instance of RaiseError.
Constructor Details
#initialize(app) ⇒ RaiseError
Returns a new instance of RaiseError.
12 13 14 |
# File 'lib/paylocity_web_service/middleware/response/raise_error.rb', line 12 def initialize(app) super app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/paylocity_web_service/middleware/response/raise_error.rb', line 16 def call(env) @app.call(env).on_complete do |response| if error = PaylocityWebService::Error.from_response(response) raise error end end end |