Class: Coolsms::RestApi::FaradayErrorHandler
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Coolsms::RestApi::FaradayErrorHandler
- Defined in:
- lib/coolsms/rest_api/faraday_error_handler.rb
Instance Method Summary collapse
-
#on_complete(env) ⇒ Object
Override this to modify the environment after the response has finished.
Instance Method Details
#on_complete(env) ⇒ Object
Override this to modify the environment after the response has finished. Calls the parse method if defined
6 7 8 9 |
# File 'lib/coolsms/rest_api/faraday_error_handler.rb', line 6 def on_complete(env) # env.body = parse(env.body) if respond_to?(:parse) && env.parse_body? raise Coolsms::RestApi::InvalidResultCode, {response: env} if env.body['result_code'] != '00' end |