class Io::Flow::V0::Models::TaxDutyQuoteForm

Calculates tax and duty in two currencies, representing consumer and client values for an MoR sale. Preserves de minimis and LVG calculations from the consumer sale.

Attributes

attributes[R]
currency[R]
delivered_duty[R]
destination[R]
lines[R]
primary_identifier[R]
shipping[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 69999
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:primary_identifier, :destination, :currency, :lines, :shipping], 'TaxDutyQuoteForm')
  @primary_identifier = HttpClient::Preconditions.assert_class('primary_identifier', opts.delete(:primary_identifier), String)
  @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }
  @delivered_duty = (x = (x = opts.delete(:delivered_duty); x.nil? ? "paid" : x); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::StreetAddress) ? x : ::Io::Flow::V0::Models::StreetAddress.new(x))
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @lines = HttpClient::Preconditions.assert_class('lines', opts.delete(:lines), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteLineItemForm) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteLineItemForm.new(x)) }
  @shipping = HttpClient::Preconditions.assert_class('shipping', opts.delete(:shipping), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteSimpleShippingForm) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteSimpleShippingForm.new(x)) }
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70015
def copy(incoming={})
  TaxDutyQuoteForm.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 70019
def to_hash
  {
    :primary_identifier => primary_identifier,
    :attributes => attributes,
    :delivered_duty => delivered_duty.value,
    :destination => destination.to_hash,
    :currency => currency,
    :lines => lines.map { |o| o.to_hash },
    :shipping => shipping.map { |o| o.to_hash }
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70011
def to_json
  JSON.dump(to_hash)
end