Class: WestpacApi::FailureResponse
- Inherits:
-
Object
- Object
- WestpacApi::FailureResponse
- Defined in:
- lib/westpac_api/failure_response.rb
Instance Method Summary collapse
- #body ⇒ Object
- #error ⇒ Object
- #errors ⇒ Object
- #headers ⇒ Object
-
#initialize(response) ⇒ FailureResponse
constructor
A new instance of FailureResponse.
- #status ⇒ Object
Constructor Details
#initialize(response) ⇒ FailureResponse
Returns a new instance of FailureResponse.
5 6 7 |
# File 'lib/westpac_api/failure_response.rb', line 5 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Object
21 22 23 |
# File 'lib/westpac_api/failure_response.rb', line 21 def body response.body end |
#error ⇒ Object
13 14 15 |
# File 'lib/westpac_api/failure_response.rb', line 13 def error errors.first end |
#errors ⇒ Object
9 10 11 |
# File 'lib/westpac_api/failure_response.rb', line 9 def errors [PartnerApi::Errors::RequestError.new(message: "Invalid Response: #{body}")] end |
#headers ⇒ Object
25 26 27 |
# File 'lib/westpac_api/failure_response.rb', line 25 def headers response.headers.to_h end |
#status ⇒ Object
17 18 19 |
# File 'lib/westpac_api/failure_response.rb', line 17 def status response.status end |