class Dhl::Tracking::Response
Attributes
events[RW]
attr_accessor :shipper, :recipient, :packages, :shipment attr_accessor :pieces
shipment_info[RW]
attr_accessor :shipper, :recipient, :packages, :shipment attr_accessor :pieces
Public Class Methods
new(data)
click to toggle source
# File lib/dhl/tracking/response.rb, line 9 def initialize(data) @data = data @shipment_info = ShipmentInfo.new(@data) @events = get_events end
Public Instance Methods
delivered?()
click to toggle source
# File lib/dhl/tracking/response.rb, line 15 def delivered? @events.first.delivered? end
Protected Instance Methods
get_events()
click to toggle source
# File lib/dhl/tracking/response.rb, line 20 def get_events collection = @data[:track_shipment_request_response][:tracking_response][:tracking_response][:awb_info][:array_of_awb_info_item][:pieces][:piece_info][:array_of_piece_info_item][:piece_event][:array_of_piece_event_item] [collection].flatten.map do |element| Event.new(element) end rescue [] end