Exception: Usps::Imis::Error::Response

Inherits:
Api
  • Object
show all
Defined in:
lib/usps/imis/error/response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_message, response, metadata = {}) ⇒ Response

Returns a new instance of Response.



14
15
16
17
# File 'lib/usps/imis/error/response.rb', line 14

def initialize(_message, response,  = {})
  @response = response
  super(message, )
end

Instance Attribute Details

#metadataObject

Returns the value of attribute metadata.



8
9
10
# File 'lib/usps/imis/error/response.rb', line 8

def 
  @metadata
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/usps/imis/error/response.rb', line 7

def response
  @response
end

Class Method Details

.from(response) ⇒ Object



10
11
12
# File 'lib/usps/imis/error/response.rb', line 10

def self.from(response)
  new(nil, response)
end

Instance Method Details

#bugsnag_meta_dataObject



19
20
21
# File 'lib/usps/imis/error/response.rb', line 19

def 
  .tap { |m| m[:api].merge!() }
end

#messageObject



23
24
25
26
27
28
29
# File 'lib/usps/imis/error/response.rb', line 23

def message
  [
    "#{self.class.name}: [#{status.to_s.upcase}] The iMIS API returned an error.",
    (.inspect if  != {}),
    body
  ].compact.join("\n")
end