class MusicTodayApiWrapper::Resources::Purchase::Invoice
Attributes
id[RW]
shipping[RW]
sub_total[RW]
taxes[RW]
total[RW]
Public Class Methods
from_hash(hash)
click to toggle source
# File lib/resources/purchase/invoice.rb, line 15 def self.from_hash(hash) totals = hash['billing']['totals'] Invoice.new(hash['orderNumber'], totals['subtotal'], totals['shipping'], totals['totalTax']) end
new(id, sub_total, shipping, taxes)
click to toggle source
# File lib/resources/purchase/invoice.rb, line 7 def initialize(id, sub_total, shipping, taxes) @id = id @sub_total = sub_total.to_f @shipping = shipping.to_f @taxes = taxes.to_f @total = (@sub_total + @shipping + @taxes).round(2) end