class MusicTodayApiWrapper::Resources::Purchase::Item
Attributes
quantity[RW]
variant[RW]
Public Class Methods
from_hash(item_hash)
click to toggle source
# File lib/resources/purchase/item.rb, line 29 def self.from_hash(item_hash) variant = Variant.from_hash(item_hash) Item.new(variant, item_hash['quantity'], item_hash['tax'], item_hash['total']) end
new(variant = Variant.new, quantity = 1, tax = nil, total = nil, destination_id = nil)
click to toggle source
# 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
Public Instance Methods
as_hash()
click to toggle source
# 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