Class: Easee::AmazonGwMiddleware

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/easee/amazon_gw_middleware.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object

Raises:

  • (Faraday::ForbiddenError)


3
4
5
6
7
8
# File 'lib/easee/amazon_gw_middleware.rb', line 3

def on_complete(env)
  return unless env.response_headers["X-Amzn-Errortype"] == "ForbiddenException"

  response_values = Faraday::Response::RaiseError.new.response_values(env)
  raise(Faraday::ForbiddenError, response_values)
end