Class: DHLEcommerceEU::TrackingResource

Inherits:
BaseResource show all
Defined in:
lib/dhl_ecommerce_eu/resources/tracking_resource.rb

Instance Attribute Summary

Attributes inherited from BaseResource

#client

Instance Method Summary collapse

Methods inherited from BaseResource

#initialize

Constructor Details

This class inherits a constructor from DHLEcommerceEU::BaseResource

Instance Method Details

#retrieve(shipment_id) ⇒ Tracking[]

Retrieve tracking information for a shipment

Parameters:

  • shipment_id (string)

    Shipment ID

Returns:

  • (Tracking[])

    An array of Tracking object



10
11
12
13
14
15
16
17
# File 'lib/dhl_ecommerce_eu/resources/tracking_resource.rb', line 10

def retrieve(shipment_id)
  payload = get_request('ccc/track-trace', params: { shipmentId: shipment_id }).parse
  if payload.is_a?(Array)
    payload.map(&Tracking.method(:new))
  else
    Tracking.new(payload)
  end
end