Class: Fedex::TrackingInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/fedex/tracking_information.rb,
lib/fedex/tracking_information/event.rb

Defined Under Namespace

Classes: Event

Constant Summary collapse

PACKAGE_IDENTIFIER_TYPES =
%w{
  BILL_OF_LADING
  COD_RETURN_TRACKING_NUMBER
  CUSTOMER_AUTHORIZATION_NUMBER
  CUSTOMER_REFERENCE
  DEPARTMENT
  FREE_FORM_REFERENCE
  GROUND_INTERNATIONAL
  GROUND_SHIPMENT_ID
  GROUP_MPS
  INVOICE
  JOB_GLOBAL_TRACKING_NUMBER
  ORDER_GLOBAL_TRACKING_NUMBER
  ORDER_TO_PAY_NUMBER
  PARTNER_CARRIER_NUMBER
  PART_NUMBER
  PURCHASE_ORDER
  RETURN_MATERIALS_AUTHORIZATION
  RETURNED_TO_SHIPPER_TRACKING_NUMBER
  TRACKING_CONTROL_NUMBER
  TRACKING_NUMBER_OR_DOORTAG
  TRANSPORTATION_CONTROL_NUMBER
  SHIPPER_REFERENCE
  STANDARD_MPS
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details = {}) ⇒ TrackingInformation

Returns a new instance of TrackingInformation.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fedex/tracking_information.rb', line 33

def initialize(details = {})
  @details = details

  @tracking_number        = details[:tracking_number]
  @unique_tracking_number = details[:tracking_number_unique_identifier]
  @signature_name         = details[:delivery_signature_name]
  @service_type           = details[:service_type]
  @status                 = details[:status_description]
  @status_code            = details[:status_code]
  @other_identifiers      = details[:other_identifiers]

  if details.has_key?(:actual_delivery_timestamp)
    @delivery_at = Time.parse(details[:actual_delivery_timestamp])
  end

  @events = [details[:events]].flatten.compact.map do |event_details|
    Event.new(event_details)
  end
end

Instance Attribute Details

#delivery_atObject (readonly)

Returns the value of attribute delivery_at.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def delivery_at
  @delivery_at
end

#detailsObject (readonly)

Returns the value of attribute details.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def details
  @details
end

#eventsObject (readonly)

Returns the value of attribute events.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def events
  @events
end

#other_identifiersObject (readonly)

Returns the value of attribute other_identifiers.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def other_identifiers
  @other_identifiers
end

#service_typeObject (readonly)

Returns the value of attribute service_type.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def service_type
  @service_type
end

#signature_nameObject (readonly)

Returns the value of attribute signature_name.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def signature_name
  @signature_name
end

#statusObject (readonly)

Returns the value of attribute status.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def status
  @status
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def status_code
  @status_code
end

#tracking_numberObject (readonly)

Returns the value of attribute tracking_number.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def tracking_number
  @tracking_number
end

#unique_tracking_numberObject (readonly)

Returns the value of attribute unique_tracking_number.



31
32
33
# File 'lib/fedex/tracking_information.rb', line 31

def unique_tracking_number
  @unique_tracking_number
end