Class: Usps::Api::Errors::UspsError

Inherits:
Faraday::Error
  • Object
show all
Defined in:
lib/usps/api/errors/usps_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, response = nil) ⇒ UspsError

Returns a new instance of UspsError.



8
9
10
11
12
13
14
# File 'lib/usps/api/errors/usps_error.rb', line 8

def initialize(error, response = nil)
  super error['Description']
  @error_number = error['Number']
  @error_description = error['Description']
  @error_source = error['Source']
  @response = response
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/usps/api/errors/usps_error.rb', line 6

def response
  @response
end

Instance Method Details

#errorObject



16
17
18
# File 'lib/usps/api/errors/usps_error.rb', line 16

def error
  response.body.error
end

#errorsObject



20
21
22
# File 'lib/usps/api/errors/usps_error.rb', line 20

def errors
  response.body.errors
end

#response_metadataObject



24
25
26
# File 'lib/usps/api/errors/usps_error.rb', line 24

def 
  response.body.
end