class Io::Flow::V0::Models::TaxDutyQuoteValues

Attributes

duty[R]
fees[R]
price[R]
tax[R]
total[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70218
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:price, :duty, :tax, :fees, :total], 'TaxDutyQuoteValues')
  @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal)
  @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue.new(x))
  @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteSimpleLevyValue.new(x))
  @fees = (x = opts.delete(:fees); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteFeeValue) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteFeeValue.new(x))
  @total = HttpClient::Preconditions.assert_class('total', HttpClient::Helper.to_big_decimal(opts.delete(:total)), BigDecimal)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70232
def copy(incoming={})
  TaxDutyQuoteValues.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70236
def to_hash
  {
    :price => price.to_f.to_s,
    :duty => duty.to_hash,
    :tax => tax.to_hash,
    :fees => fees.to_hash,
    :total => total.to_f.to_s
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70228
def to_json
  JSON.dump(to_hash)
end