class Io::Flow::V0::Models::TaxDutyQuoteLineItem

An ordered quantity of goods for tax and duty calculation.

Attributes

attributes[R]
country_of_origin[R]
hs_code[R]
primary_identifier[R]
quantity[R]
ship_from[R]
unit_values[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70038
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:primary_identifier, :ship_from, :quantity, :unit_values, :country_of_origin, :hs_code], 'TaxDutyQuoteLineItem')
  @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 }
  @ship_from = (x = opts.delete(:ship_from); x.is_a?(::Io::Flow::V0::Models::StreetAddress) ? x : ::Io::Flow::V0::Models::StreetAddress.new(x))
  @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer)
  @unit_values = (x = opts.delete(:unit_values); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteValues) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteValues.new(x))
  @country_of_origin = HttpClient::Preconditions.assert_class('country_of_origin', opts.delete(:country_of_origin), String)
  @hs_code = HttpClient::Preconditions.assert_class('hs_code', opts.delete(:hs_code), String)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70054
def copy(incoming={})
  TaxDutyQuoteLineItem.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 70058
def to_hash
  {
    :primary_identifier => primary_identifier,
    :attributes => attributes,
    :ship_from => ship_from.to_hash,
    :quantity => quantity,
    :unit_values => unit_values.to_hash,
    :country_of_origin => country_of_origin,
    :hs_code => hs_code
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70050
def to_json
  JSON.dump(to_hash)
end