Class: Libring::Product
- Inherits:
-
Object
- Object
- Libring::Product
- Defined in:
- lib/libring/product.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
-
#unit_amount ⇒ Object
readonly
Returns the value of attribute unit_amount.
Instance Method Summary collapse
-
#initialize(sku) ⇒ Product
constructor
A new instance of Product.
- #set_category(data) ⇒ Object
- #set_name(data) ⇒ Object
- #set_quantity(data) ⇒ Object
- #set_unit_amount(data) ⇒ Object
Constructor Details
#initialize(sku) ⇒ Product
Returns a new instance of Product.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/libring/product.rb', line 5 def initialize(sku) @sku = sku @name = sku @quantity = 1 @unit_amount = -1 @category = "" true end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
3 4 5 |
# File 'lib/libring/product.rb', line 3 def category @category end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/libring/product.rb', line 3 def name @name end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
3 4 5 |
# File 'lib/libring/product.rb', line 3 def quantity @quantity end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
3 4 5 |
# File 'lib/libring/product.rb', line 3 def sku @sku end |
#unit_amount ⇒ Object (readonly)
Returns the value of attribute unit_amount.
3 4 5 |
# File 'lib/libring/product.rb', line 3 def unit_amount @unit_amount end |
Instance Method Details
#set_category(data) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/libring/product.rb', line 25 def set_category(data) @category = data true end |
#set_name(data) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/libring/product.rb', line 17 def set_name(data) @name = data true end |
#set_quantity(data) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/libring/product.rb', line 41 def set_quantity(data) @quantity = data true end |
#set_unit_amount(data) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/libring/product.rb', line 33 def set_unit_amount(data) @unit_amount = data true end |