Class: Omniship::TrackingResponse

Inherits:
Response show all
Defined in:
lib/omniship/tracking_response.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#message, #params, #request, #test, #xml

Instance Method Summary collapse

Methods inherited from Response

#success?, #test?

Constructor Details

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

Returns a new instance of TrackingResponse.



7
8
9
10
11
12
# File 'lib/omniship/tracking_response.rb', line 7

def initialize(success, message, params = {}, options = {})
  @tracking_number = options[:tracking_number]
  @shipment_events = Array(options[:shipment_events])
  @origin, @destination = options[:origin], options[:destination]
  super
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



5
6
7
# File 'lib/omniship/tracking_response.rb', line 5

def destination
  @destination
end

#originObject (readonly)

Returns the value of attribute origin.



5
6
7
# File 'lib/omniship/tracking_response.rb', line 5

def origin
  @origin
end

#shipment_eventsObject (readonly)

array of ShipmentEvents in chronological order



4
5
6
# File 'lib/omniship/tracking_response.rb', line 4

def shipment_events
  @shipment_events
end

#tracking_numberObject (readonly)

string



3
4
5
# File 'lib/omniship/tracking_response.rb', line 3

def tracking_number
  @tracking_number
end

Instance Method Details

#latest_eventObject



14
15
16
# File 'lib/omniship/tracking_response.rb', line 14

def latest_event
  @shipment_events.last
end