Class: AfterShip::Checkpoint
- Inherits:
-
Object
- Object
- AfterShip::Checkpoint
- Includes:
- Attributes
- Defined in:
- lib/after_ship/checkpoint.rb
Overview
Wrapper object for AfterShip tracking checkpoint: www.aftership.com/docs/api/4/trackings/get-trackings-slug-tracking_number
Instance Attribute Summary collapse
-
#checkpoint_time ⇒ DateTime
Date and time of the checkpoint, provided by courier.
-
#city ⇒ String
Location info (if any).
-
#country_iso3 ⇒ String
Country ISO Alpha-3 (three letters) of the checkpoint.
-
#country_name ⇒ String
Country name of the checkpoint, may also contain other location info.
-
#courier ⇒ String
Courier name.
-
#created_at ⇒ DateTime
Date and time of the tracking created.
-
#message ⇒ String
Checkpoint message.
-
#slug ⇒ String
The unique code of courier for this checkpoint message.
-
#state ⇒ String
Location info (if any).
-
#status ⇒ String
Same as tag, except human-friendly:.
-
#tag ⇒ String
Status of the checkpoint.
-
#zip ⇒ String
Location info (if any).
Instance Method Summary collapse
-
#initialize(data) ⇒ Checkpoint
constructor
Better interface for a checkpoint.
-
#load_attributes(data) ⇒ Object
included
from Attributes
Loop through the data hash and for each key call a setter with the value.
Constructor Details
#initialize(data) ⇒ Checkpoint
Better interface for a checkpoint.
107 108 109 |
# File 'lib/after_ship/checkpoint.rb', line 107 def initialize(data) load_attributes(data) end |
Instance Attribute Details
#checkpoint_time ⇒ DateTime
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.
38 39 40 |
# File 'lib/after_ship/checkpoint.rb', line 38 def checkpoint_time @checkpoint_time end |
#city ⇒ String
Location info (if any).
May be empty.
45 46 47 |
# File 'lib/after_ship/checkpoint.rb', line 45 def city @city end |
#country_iso3 ⇒ String
Country ISO Alpha-3 (three letters) of the checkpoint.
May be empty.
52 53 54 |
# File 'lib/after_ship/checkpoint.rb', line 52 def country_iso3 @country_iso3 end |
#country_name ⇒ String
Country name of the checkpoint, may also contain other location info. Seems to be Alpha-2 code, e.g. IN, DE.
May be empty.
60 61 62 |
# File 'lib/after_ship/checkpoint.rb', line 60 def country_name @country_name end |
#courier ⇒ String
Courier name.
Custom method!
26 27 28 |
# File 'lib/after_ship/checkpoint.rb', line 26 def courier @courier end |
#created_at ⇒ DateTime
Date and time of the tracking created.
Should always be available.
12 13 14 |
# File 'lib/after_ship/checkpoint.rb', line 12 def created_at @created_at end |
#message ⇒ String
Checkpoint message
Should always be available.
67 68 69 |
# File 'lib/after_ship/checkpoint.rb', line 67 def @message end |
#slug ⇒ String
The unique code of courier for this checkpoint message.
Should always be available.
19 20 21 |
# File 'lib/after_ship/checkpoint.rb', line 19 def slug @slug end |
#state ⇒ String
Location info (if any).
May be empty.
74 75 76 |
# File 'lib/after_ship/checkpoint.rb', line 74 def state @state end |
#status ⇒ String
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
95 96 97 |
# File 'lib/after_ship/checkpoint.rb', line 95 def status @status end |
#tag ⇒ String
Status of the checkpoint.
Should always be available.
81 82 83 |
# File 'lib/after_ship/checkpoint.rb', line 81 def tag @tag end |
#zip ⇒ String
Location info (if any).
May be empty.
102 103 104 |
# File 'lib/after_ship/checkpoint.rb', line 102 def zip @zip end |
Instance Method Details
#load_attributes(data) ⇒ Object Originally defined in module Attributes
Loop through the data hash and for each key call a setter with the value.