Class: ActiveMerchant::Shipping::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/active_shipping/shipping/response.rb

Direct Known Subclasses

RateResponse, TrackingResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(success, message, params = {}, options = {}) ⇒ Response

Returns a new instance of Response.

Raises:



29
30
31
32
33
34
35
# File 'lib/active_shipping/shipping/response.rb', line 29

def initialize(success, message, params = {}, options = {})
  @success, @message, @params = success, message, params.stringify_keys
  @test = options[:test] || false
  @xml = options[:xml]
  @request = options[:request]
  raise ResponseError.new(self) unless success
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



24
25
26
# File 'lib/active_shipping/shipping/response.rb', line 24

def message
  @message
end

#paramsObject (readonly)

Returns the value of attribute params.



23
24
25
# File 'lib/active_shipping/shipping/response.rb', line 23

def params
  @params
end

#requestObject (readonly)

Returns the value of attribute request.



27
28
29
# File 'lib/active_shipping/shipping/response.rb', line 27

def request
  @request
end

#testObject (readonly)

Returns the value of attribute test.



25
26
27
# File 'lib/active_shipping/shipping/response.rb', line 25

def test
  @test
end

#xmlObject (readonly)

Returns the value of attribute xml.



26
27
28
# File 'lib/active_shipping/shipping/response.rb', line 26

def xml
  @xml
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/active_shipping/shipping/response.rb', line 37

def success?
  @success ? true : false
end

#test?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/active_shipping/shipping/response.rb', line 41

def test?
  @test ? true : false
end