Class: DHL::Ecommerce::Product
- Includes:
- Operations::Find, Operations::List
- Defined in:
- lib/dhl/ecommerce/product.rb
Constant Summary collapse
- TYPES =
{ domestic: "DomesticUS", international: "International" }
- CATEGORIES =
{ clearance: "Clearance", expedited: "Expedited", expedited_parcel: "Expedited P", ground: "Ground", other: "Other Services", priority: "Priority", standard: "Standard" }
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Product
constructor
A new instance of Product.
Methods included from Operations::List
Methods included from Operations::Find
Constructor Details
#initialize(attributes = {}) ⇒ Product
Returns a new instance of Product.
24 25 26 27 28 29 30 31 |
# File 'lib/dhl/ecommerce/product.rb', line 24 def initialize(attributes = {}) super attributes unless attributes.empty? @category = CATEGORIES.key(attributes[:category]) if attributes[:category] @type = TYPES.key(attributes[:class]) if attributes[:class] end end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
22 23 24 |
# File 'lib/dhl/ecommerce/product.rb', line 22 def category @category end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
22 23 24 |
# File 'lib/dhl/ecommerce/product.rb', line 22 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/dhl/ecommerce/product.rb', line 22 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
22 23 24 |
# File 'lib/dhl/ecommerce/product.rb', line 22 def type @type end |