Class: Omniship::Response

Inherits:
Object show all
Defined in:
lib/omniship/response.rb

Direct Known Subclasses

RateResponse, ShipResponse, TrackingResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Response.

Raises:



26
27
28
29
30
31
32
# File 'lib/omniship/response.rb', line 26

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.



21
22
23
# File 'lib/omniship/response.rb', line 21

def message
  @message
end

#paramsObject (readonly)

Returns the value of attribute params.



20
21
22
# File 'lib/omniship/response.rb', line 20

def params
  @params
end

#requestObject (readonly)

Returns the value of attribute request.



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

def request
  @request
end

#testObject (readonly)

Returns the value of attribute test.



22
23
24
# File 'lib/omniship/response.rb', line 22

def test
  @test
end

#xmlObject (readonly)

Returns the value of attribute xml.



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

def xml
  @xml
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/omniship/response.rb', line 34

def success?
  @success ? true : false
end

#test?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/omniship/response.rb', line 38

def test?
  @test ? true : false
end