Exception: Shippinglogic::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/shippinglogic/error.rb

Direct Known Subclasses

FedEx::Error, UPS::Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, response) ⇒ Error

Returns a new instance of Error.



5
6
7
8
# File 'lib/shippinglogic/error.rb', line 5

def initialize(request, response)
  self.request = request
  self.response = response
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/shippinglogic/error.rb', line 3

def errors
  @errors
end

#requestObject

Returns the value of attribute request.



3
4
5
# File 'lib/shippinglogic/error.rb', line 3

def request
  @request
end

#responseObject

Returns the value of attribute response.



3
4
5
# File 'lib/shippinglogic/error.rb', line 3

def response
  @response
end

Instance Method Details

#add_error(error, code = nil) ⇒ Object



10
11
12
# File 'lib/shippinglogic/error.rb', line 10

def add_error(error, code = nil)
  errors << {:message => error, :code => code}
end

#messageObject



18
19
20
# File 'lib/shippinglogic/error.rb', line 18

def message
  errors.collect { |e| e[:message] }.join(", ")
end