Class: AfterShip::Courier
- Inherits:
-
Object
- Object
- AfterShip::Courier
- Includes:
- Attributes
- Defined in:
- lib/after_ship/courier.rb
Overview
Wrapper object for AfterShip courier: www.aftership.com/docs/api/4/couriers/get-couriers
Instance Attribute Summary collapse
-
#name ⇒ String
Name of courier.
-
#other_name ⇒ String
Other name of courier.
-
#phone ⇒ String
Contact phone number of courier.
-
#required_fields ⇒ Array
The extra fields need for tracking, such as ‘tracking_account_number`, `tracking_postal_code`, `tracking_ship_date`.
-
#slug ⇒ String
Unique code of courier.
-
#web_url ⇒ String
Website link of courier.
Instance Method Summary collapse
-
#initialize(data) ⇒ Courier
constructor
Better interface for a courier.
-
#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) ⇒ Courier
Better interface for a courier.
41 42 43 |
# File 'lib/after_ship/courier.rb', line 41 def initialize(data) load_attributes(data) end |
Instance Attribute Details
#name ⇒ String
Name of courier.
15 16 17 |
# File 'lib/after_ship/courier.rb', line 15 def name @name end |
#other_name ⇒ String
Other name of courier.
25 26 27 |
# File 'lib/after_ship/courier.rb', line 25 def other_name @other_name end |
#phone ⇒ String
Contact phone number of courier.
20 21 22 |
# File 'lib/after_ship/courier.rb', line 20 def phone @phone end |
#required_fields ⇒ Array
The extra fields need for tracking, such as ‘tracking_account_number`, `tracking_postal_code`, `tracking_ship_date`.
36 37 38 |
# File 'lib/after_ship/courier.rb', line 36 def required_fields @required_fields end |
#slug ⇒ String
Unique code of courier.
10 11 12 |
# File 'lib/after_ship/courier.rb', line 10 def slug @slug end |
#web_url ⇒ String
Website link of courier.
30 31 32 |
# File 'lib/after_ship/courier.rb', line 30 def web_url @web_url 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.