Class: ApiBlueprint::ResponseMiddleware
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- ApiBlueprint::ResponseMiddleware
- Defined in:
- lib/api-blueprint/response_middleware.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/api-blueprint/response_middleware.rb', line 4 def on_complete(env) case env[:status] when 401 raise ApiBlueprint::UnauthenticatedError.new(env) when 404 raise ApiBlueprint::NotFoundError.new(env) when 402..499 raise ApiBlueprint::ClientError.new(env) when 500...599 raise ApiBlueprint::ServerError.new(env) end end |