6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/faraday/response/raise_ted_api_error.rb', line 6
def on_complete(response)
case response[:status].to_i
when 400
raise TedApi::BadRequest, error_message(response)
when 401
raise TedApi::Unauthorized, error_message(response)
when 403
raise TedApi::Forbidden, error_message(response)
when 404
raise TedApi::NotFound, error_message(response)
when 406
raise TedApi::NotAcceptable, error_message(response)
when 422
raise TedApi::UnprocessableEntity, error_message(response)
when 500
raise TedApi::InternalServerError, error_message(response)
when 501
raise TedApi::NotImplemented, error_message(response)
when 502
raise TedApi::BadGateway, error_message(response)
when 503
raise TedApi::ServiceUnavailable, error_message(response)
end
end
|