Exception: SolidusBactracs::Api::RequestError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/solidus_bactracs/api/request_error.rb

Direct Known Subclasses

RateLimitedError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_code:, response_body:, response_headers:) ⇒ RequestError

Returns a new instance of RequestError.



24
25
26
27
28
29
30
# File 'lib/solidus_bactracs/api/request_error.rb', line 24

def initialize(response_code:, response_body:, response_headers:)
  @response_code = response_code
  @response_body = response_body
  @response_headers = response_headers

  super(response_body)
end

Instance Attribute Details

#response_bodyObject (readonly)

Returns the value of attribute response_body.



6
7
8
# File 'lib/solidus_bactracs/api/request_error.rb', line 6

def response_body
  @response_body
end

#response_codeObject (readonly)

Returns the value of attribute response_code.



6
7
8
# File 'lib/solidus_bactracs/api/request_error.rb', line 6

def response_code
  @response_code
end

#response_headersObject (readonly)

Returns the value of attribute response_headers.



6
7
8
# File 'lib/solidus_bactracs/api/request_error.rb', line 6

def response_headers
  @response_headers
end

Class Method Details

.from_response(response) ⇒ Object



9
10
11
# File 'lib/solidus_bactracs/api/request_error.rb', line 9

def from_response(response)
  new(**options_from_response(response))
end