Class: MusicTodayApiWrapper::Resources::Purchase::Item
- Inherits:
-
Object
- Object
- MusicTodayApiWrapper::Resources::Purchase::Item
- Defined in:
- lib/resources/purchase/item.rb
Instance Attribute Summary collapse
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#variant ⇒ Object
Returns the value of attribute variant.
Class Method Summary collapse
Instance Method Summary collapse
- #as_hash ⇒ Object
-
#initialize(variant = Variant.new, quantity = 1, tax = nil, total = nil, destination_id = nil) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(variant = Variant.new, quantity = 1, tax = nil, total = nil, destination_id = nil) ⇒ Item
Returns a new instance of Item.
10 11 12 13 14 15 16 17 |
# File 'lib/resources/purchase/item.rb', line 10 def initialize(variant = Variant.new, quantity = 1, tax = nil, total = nil, destination_id = nil) @variant = variant @quantity = quantity @tax = tax @total = total @destination_id = destination_id end |
Instance Attribute Details
#quantity ⇒ Object
Returns the value of attribute quantity.
8 9 10 |
# File 'lib/resources/purchase/item.rb', line 8 def quantity @quantity end |
#variant ⇒ Object
Returns the value of attribute variant.
8 9 10 |
# File 'lib/resources/purchase/item.rb', line 8 def variant @variant end |
Class Method Details
Instance Method Details
#as_hash ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/resources/purchase/item.rb', line 19 def as_hash { sku: @variant.sku, qty: @quantity, quantity: @quantity, price: @variant.price, tax: @tax, total: @total, destIndex: @destination_id }.compact end |