Class: Adjust::Transport::FailHard
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Adjust::Transport::FailHard
- Defined in:
- lib/adjust/transport/fail_hard.rb
Constant Summary collapse
- SUCCESS_STATUSES =
200...300
Instance Method Summary collapse
Instance Method Details
#error_from_json(body) ⇒ Object
16 17 18 |
# File 'lib/adjust/transport/fail_hard.rb', line 16 def error_from_json(body) MultiJson.load(body)['error'] end |
#failed?(env) ⇒ Boolean
12 13 14 |
# File 'lib/adjust/transport/fail_hard.rb', line 12 def failed?(env) !SUCCESS_STATUSES.include?(env[:status]) end |
#on_complete(env) ⇒ Object
8 9 10 |
# File 'lib/adjust/transport/fail_hard.rb', line 8 def on_complete(env) fail Error, error_from_json(env[:body]) if failed?(env) end |