Class: DJI::DHL::TrackingResults

Inherits:
Object
  • Object
show all
Defined in:
lib/dji/dhl/tracking_results.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTrackingResults

Returns a new instance of TrackingResults.



9
10
11
# File 'lib/dji/dhl/tracking_results.rb', line 9

def initialize
  @shipments = []
end

Instance Attribute Details

#shipmentsObject

Returns the value of attribute shipments.



7
8
9
# File 'lib/dji/dhl/tracking_results.rb', line 7

def shipments
  @shipments
end

Class Method Details

.new_from_results(results) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dji/dhl/tracking_results.rb', line 15

def new_from_results(results)
  return nil if results.blank?

  tr = TrackingResults.new

  results.each do |item|
    shipment = DJI::DHL::Shipment.new_from_item(item)
    tr.shipments << shipment
  end

  tr
end