class AfterShip::Checkpoint

Wrapper object for AfterShip tracking checkpoint: www.aftership.com/docs/api/4/trackings/get-trackings-slug-tracking_number

Attributes

checkpoint_time[R]

Date and time of the checkpoint, provided by courier.

Empty String, YYYY-MM-DD, YYYY-MM-DDTHH:MM:SS, or YYYY-MM-DDTHH:MM:SS+TIMEZONE.

Should always be available.

@return [DateTime]

city[RW]

Location info (if any).

May be empty.

@return [String]

country_iso3[RW]

Country ISO Alpha-3 (three letters) of the checkpoint.

May be empty.

@return [String]

country_name[RW]

Country name of the checkpoint, may also contain other location info. Seems to be Alpha-2 code, e.g. IN, DE.

May be empty.

@return [String]

courier[RW]

Courier name.

Custom method!

@return [String]

created_at[R]

Date and time of the tracking created.

Should always be available.

@return [DateTime]

message[RW]

Checkpoint message

Should always be available.

@return [String]

slug[R]

The unique code of courier for this checkpoint message.

Should always be available.

@return [String]

state[RW]

Location info (if any).

May be empty.

@return [String]

status[RW]

Same as tag, except human-friendly:

  • Pending => Pending

  • InfoReceived => +Info Received+

  • InTransit => +In Transit+

  • OutForDelivery => +Out For Delivery+

  • AttemptFail => +Attempt Failed+

  • Delivered => Delivered

  • Exception => Exception

  • Expired => Expired

@return [String]

tag[R]

Status of the checkpoint.

Should always be available.

@return [String]

zip[RW]

Location info (if any).

May be empty.

@return [String]

Public Class Methods

new(data) click to toggle source

Better interface for a checkpoint.

@param data [Hash] checkpoint hash

# File lib/after_ship/checkpoint.rb, line 107
def initialize(data)
  load_attributes(data)
end

Public Instance Methods

checkpoint_time=(value) click to toggle source

Date and time of the checkpoint, provided by courier.

@return [DateTime]

# File lib/after_ship/checkpoint.rb, line 143
def checkpoint_time=(value)
  @checkpoint_time = DateUtils.parse(value)
end
created_at=(value) click to toggle source

Date and time of the tracking created.

@return [DateTime]

# File lib/after_ship/checkpoint.rb, line 125
def created_at=(value)
  @created_at = DateUtils.parse(value)
end
slug=(value) click to toggle source

The unique code of courier for this checkpoint message.

Should always be available.

@return [String]

# File lib/after_ship/checkpoint.rb, line 116
def slug=(value)
  @slug        = value
  self.courier = value.upcase
  @slug
end
tag=(value) click to toggle source

Status of the checkpoint.

Should always be available.

@return [String]

# File lib/after_ship/checkpoint.rb, line 134
def tag=(value)
  @tag        = value
  self.status = TAG_STATUS.fetch(value)
  @tag
end