Class: Kount::RIS::Product
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#price ⇒ Object
Returns the value of attribute price.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
Instance Method Summary collapse
-
#initialize(attrs) ⇒ Product
constructor
A new instance of Product.
- #to_h ⇒ Object
Constructor Details
#initialize(attrs) ⇒ Product
Returns a new instance of Product.
12 13 14 15 16 |
# File 'app/models/kount/ris/product.rb', line 12 def initialize(attrs) attrs.symbolize_keys! attrs.reverse_merge!({ quantity: 1 }) super(attrs) end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'app/models/kount/ris/product.rb', line 4 def category @category end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'app/models/kount/ris/product.rb', line 4 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'app/models/kount/ris/product.rb', line 4 def id @id end |
#price ⇒ Object
Returns the value of attribute price.
4 5 6 |
# File 'app/models/kount/ris/product.rb', line 4 def price @price end |
#quantity ⇒ Object
Returns the value of attribute quantity.
4 5 6 |
# File 'app/models/kount/ris/product.rb', line 4 def quantity @quantity end |
Instance Method Details
#to_h ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/models/kount/ris/product.rb', line 18 def to_h { description: description, id: id, price: price, quantity: quantity, category: category, } end |