class AfterShip::Tracking
Wrapper object for AfterShip
tracking: www.aftership.com/docs/api/4/trackings/get-trackings-slug-tracking_number
Attributes
Whether or not AfterShip
will continue tracking the shipments. Value is false
when tag (status) is Delivered
, Expired
, or further updates for 30 days since last update.
@return [Bool]
Google cloud message registration IDs to receive the push notifications. Accept either array or Comma comma separated as input.
@return [Array, String]
Array of Checkpoint
describes the checkpoint information.
@return [Array<Checkpoint>]
Date and time of the tracking created.
@return [DateTime]
Custom fields of the tracking.
@return [Hash]
Customer name of the tracking.
@return [String]
Total delivery time in days.
-
Difference of 1st checkpoint time and delivered time for delivered shipments.
-
Difference of 1st checkpoint time and current time for non-delivered shipments.
Value as 0
for pending shipments or delivered shipment with only one checkpoint.
@return [Fixnum]
Destination country of the tracking. ISO Alpha-3 (three letters). If you use postal service to send international shipments, AfterShip
will automatically get tracking results from destination postal service based on destination country.
@return [String]
Email address(es) to receive email notifications. Comma separated for multiple values.
@return [Array<String>]
Expected delivery date (if any).
Empty String, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+TIMEZONE.
@return [DateTime]
A unique identifier generated by AfterShip
for the tracking.
@return [String]
Apple iOS device IDs to receive the push notificaitons. Accept either array or Comma comma separated as input.
@return [Array, String]
Text field for order ID.
@return [String]
Text field for order path.
@return [String]
Origin country of the tracking. ISO Alpha-3 (three letters).
@return [String]
Number of packages under the tracking.
@return [Number]
Shipment type provided by carrier (if any).
@return [String]
Shipment weight provied by carrier (if any).
@return [Fixnum]
Weight unit provied by carrier, either in kg
or lb
(if any).
@return [String]
Signed by information for delivered shipment (if any).
@return [String]
Unique code of courier.
@return [String]
Phone number(s) to receive sms notifications. The phone number(s) to receive sms notifications. Phone number should begin with +
and +Area Code+ before phone number. Comma separated for multiple values.
@return [Array<String>]
Source of how this tracking is added.
@return [String]
Same as tag, except human-friendly:
Custom method!
-
Pending
=>Pending
-
InfoReceived
=> +Info Received+ -
InTransit
=> +In Transit+ -
OutForDelivery
=> +Out For Delivery+ -
AttemptFail
=> +Attempt Failed+ -
Delivered
=>Delivered
-
Exception
=>Exception
-
Expired
=>Expired
@return [String]
Current status of tracking.
Value: Pending
, InfoReceived
, InTransit
, OutForDelivery
, AttemptFail
, Delivered
, Exception
, Expired
.
See status definition www.aftership.com/docs/api/4/delivery-status.
@return [String]
Title of the tracking.
@return [String]
Number of attempts AfterShip
tracks at courier's system.
@return [Number]
Account number of the shipper for a specific courier. Required by some couriers, such as dynamic-logistics
.
@return [String]
Tracking
number, e.g. 1ZA2207X6794165804
.
@return [String]
The postal code of receiver's address. Required by some couriers, such as deutsch-post
.
@return [String]
Shipping date in YYYYMMDD
format. Required by some couriers, such as deutsch-post
.
@return [String]
The token to generate the direct tracking link: yourusername.aftership.com/unique_token or www.aftership.com/unique_token.
@return [String]
Date and time of the tracking last updated.
@return [DateTime]
Public Class Methods
Better interface for a tracking.
@param data [Hash] tracking hash
# File lib/after_ship/tracking.rb, line 226 def initialize(data) @checkpoints = [] load_attributes(data) end
Public Instance Methods
Array of Checkpoint
describes the checkpoint information.
@return [Array<Checkpoint>]
# File lib/after_ship/tracking.rb, line 286 def checkpoints=(value) @checkpoints = value.map { |data| Checkpoint.new(data) } end
Date and time of the tracking created.
@return [DateTime]
# File lib/after_ship/tracking.rb, line 234 def created_at=(value) @created_at = DateTime.parse(value) end
Expected delivery date (if any).
@return [DateTime]
# File lib/after_ship/tracking.rb, line 265 def expected_delivery=(value) @expected_delivery = DateUtils.parse(value) end
Unique code of courier.
@return [String]
# File lib/after_ship/tracking.rb, line 256 def slug=(value) @slug = value self.courier = value.upcase @slug end
Current status of tracking.
Value: Pending
, InfoReceived
, InTransit
, OutForDelivery
, AttemptFail
, Delivered
, Exception
, Expired
.
See status definition www.aftership.com/docs/api/4/delivery-status.
@return [String]
# File lib/after_ship/tracking.rb, line 277 def tag=(value) @tag = value self.status = TAG_STATUS.fetch(value) @tag end
Shipping date in YYYYMMDD
format. Required by some couriers, such as deutsch-post
.
@return [DateTime]
# File lib/after_ship/tracking.rb, line 249 def tracking_ship_date=(value) @tracking_ship_date = DateUtils.parse(value) end
Date and time of the tracking last updated.
@return [DateTime]
# File lib/after_ship/tracking.rb, line 241 def updated_at=(value) @updated_at = DateTime.parse(value) end