Class: Responses::ExceptionResponse
- Inherits:
-
BaseResponse
- Object
- BaseResponse
- Responses::ExceptionResponse
- Defined in:
- lib/nasa/utils/responses.rb
Overview
Handles and parses error responses from the API
Instance Attribute Summary
Attributes inherited from BaseResponse
#body, #code, #headers, #message, #raw_response, #remaining_requests
Instance Method Summary collapse
-
#initialize(response) ⇒ ExceptionResponse
constructor
A new instance of ExceptionResponse.
-
#parse_response(response) ⇒ Hash
Parses response from failed API calls.
Methods inherited from BaseResponse
Constructor Details
#initialize(response) ⇒ ExceptionResponse
Returns a new instance of ExceptionResponse
69 70 71 |
# File 'lib/nasa/utils/responses.rb', line 69 def initialize(response) super(response) end |
Instance Method Details
#parse_response(response) ⇒ Hash
Parses response from failed API calls
77 78 79 80 81 82 |
# File 'lib/nasa/utils/responses.rb', line 77 def parse_response(response) @code = response.http_code @body = json_parse(response.http_body) @message = @body.dig(:error, :message) @headers = response.http_headers end |