Exception: Shippo::Exceptions::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/shippo/exceptions/api_error.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#message

Instance Method Summary collapse

Methods inherited from Error

#to_s

Constructor Details

#initialize(message = nil, request = nil, response = nil) ⇒ APIError

Returns a new instance of APIError.



9
10
11
12
13
14
15
# File 'lib/shippo/exceptions/api_error.rb', line 9

def initialize(message = nil,
               request = nil,
               response = nil)
  super(message)
  self.request  = request
  self.response = response
end

Instance Attribute Details

#http_response_messageObject

Returns the value of attribute http_response_message.



4
5
6
# File 'lib/shippo/exceptions/api_error.rb', line 4

def http_response_message
  @http_response_message
end

#requestObject

Returns the value of attribute request.



4
5
6
# File 'lib/shippo/exceptions/api_error.rb', line 4

def request
  @request
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/shippo/exceptions/api_error.rb', line 4

def response
  @response
end

Instance Method Details

#server_urlObject



21
22
23
# File 'lib/shippo/exceptions/api_error.rb', line 21

def server_url
  @server_url ||= (request ? request.url : '')
end

#to_s_membersObject



17
18
19
# File 'lib/shippo/exceptions/api_error.rb', line 17

def to_s_members
  super + %i(server_url response)
end