Class: RelicLink::Coh3::Faraday::Response::RaiseReplayError
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- RelicLink::Coh3::Faraday::Response::RaiseReplayError
- Defined in:
- lib/relic_link/coh3/faraday/response/raise_replay_error.rb
Overview
Middleware to catch CoH3 API errors and raise them as exceptions.
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/relic_link/coh3/faraday/response/raise_replay_error.rb', line 9 def on_complete(env) return unless env.success? body = env.body return unless body raise RelicLink::Coh3::Api::Errors::ExpiredPath.new('path has expired', env.response) if body.first == 1 end |