Class: AnzApi::FailureResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/anz_api/failure_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ FailureResponse

Returns a new instance of FailureResponse.



5
6
7
# File 'lib/anz_api/failure_response.rb', line 5

def initialize(response)
  @response = response
end

Instance Method Details

#bodyObject



21
22
23
# File 'lib/anz_api/failure_response.rb', line 21

def body
  response.body
end

#errorObject



13
14
15
# File 'lib/anz_api/failure_response.rb', line 13

def error
  errors.first
end

#errorsObject



9
10
11
# File 'lib/anz_api/failure_response.rb', line 9

def errors
  [PartnerApi::Errors::RequestError.new(message: "Invalid Response: #{body}")]
end

#headersObject



25
26
27
# File 'lib/anz_api/failure_response.rb', line 25

def headers
  response.headers.to_h
end

#statusObject



17
18
19
# File 'lib/anz_api/failure_response.rb', line 17

def status
  response.status
end