Class: OMCMS::ParseResponse
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- OMCMS::ParseResponse
- Defined in:
- lib/omcms/middleware/parse_response.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ ParseResponse
constructor
A new instance of ParseResponse.
- #on_complete(response_env) ⇒ Object
Constructor Details
#initialize(app) ⇒ ParseResponse
Returns a new instance of ParseResponse.
5 6 7 8 |
# File 'lib/omcms/middleware/parse_response.rb', line 5 def initialize(app) super @app = app end |
Instance Method Details
#on_complete(response_env) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/omcms/middleware/parse_response.rb', line 10 def on_complete(response_env) return OMCMS::Response::Error.new(response_env) if response_env.status >= 400 response_env.body rescue StandardError => e OMCMS::Response::Error.new(e) end |