Permalink
Browse files

landmark can't guarantee the delivery status names because it integra…

…tes with many different shipping carriers, so now we'll allow the ShipmentEvent class to hold the data for the entire event, so that someone can access all the data the event contained
  • Loading branch information...
1 parent bb42b12 commit bf2a1729a24ddc319b9eaef1eccdbb54e8e7fa02 @ricaurte ricaurte committed Aug 14, 2013
@@ -156,7 +156,9 @@ def parse_tracking_response(response, options)
events = [package['Events']['Event']].flatten
shipment_events = events.map do |event|
time = Time.parse(event['DateTime'].gsub(/(\d{2})\/(\d{2})/, '\2/\1'))
- ShipmentEvent.new(event['Status'], time.utc, event['Location'])
+ shipment_event = ShipmentEvent.new(event['Status'], time.utc, event['Location'])
+ shipment_event.data = event
+ shipment_event
end
details = {
xml: response,
@@ -3,7 +3,8 @@ module Shipping
class ShipmentEvent
attr_reader :name, :time, :location, :message
-
+ attr_accessor :data
+
def initialize(name, time, location, message=nil)
@name, @time, @location, @message = name, time, location, message
end

0 comments on commit bf2a172

Please sign in to comment.