Class: Io::Flow::V0::Models::HarmonizedLandedCostItem

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Duty and tax information for a given item. Note that the internal implementation supports multiple countries of origin.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ HarmonizedLandedCostItem

Returns a new instance of HarmonizedLandedCostItem.



44829
44830
44831
44832
44833
44834
44835
44836
44837
44838
44839
44840
44841
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44829

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item, :duty, :tax], 'HarmonizedLandedCostItem')
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::HarmonizedItemReference) ? x : ::Io::Flow::V0::Models::HarmonizedItemReference.new(x))
  @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::Duty) ? x : ::Io::Flow::V0::Models::Duty.new(x))
  @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::Tax) ? x : ::Io::Flow::V0::Models::Tax.new(x))
  @tax_applicability = (x = opts.delete(:tax_applicability); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TaxApplicability) ? x : ::Io::Flow::V0::Models::TaxApplicability.apply(x)))
  @origin = (x = opts.delete(:origin); x.nil? ? nil : HttpClient::Preconditions.assert_class('origin', x, String))
  @hs_code = (x = opts.delete(:hs_code); x.nil? ? nil : HttpClient::Preconditions.assert_class('hs_code', x, String))
  @tariff_code = (x = opts.delete(:tariff_code); x.nil? ? nil : HttpClient::Preconditions.assert_class('tariff_code', x, String))
  @customs_description = (x = opts.delete(:customs_description); x.nil? ? nil : HttpClient::Preconditions.assert_class('customs_description', x, String))
  @source_address = (x = opts.delete(:source_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
end

Instance Attribute Details

#customs_descriptionObject (readonly)

Returns the value of attribute customs_description.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def customs_description
  @customs_description
end

#dutyObject (readonly)

Returns the value of attribute duty.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def duty
  @duty
end

#hs_codeObject (readonly)

Returns the value of attribute hs_code.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def hs_code
  @hs_code
end

#itemObject (readonly)

Returns the value of attribute item.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def item
  @item
end

#originObject (readonly)

Returns the value of attribute origin.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def origin
  @origin
end

#source_addressObject (readonly)

Returns the value of attribute source_address.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def source_address
  @source_address
end

#tariff_codeObject (readonly)

Returns the value of attribute tariff_code.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def tariff_code
  @tariff_code
end

#taxObject (readonly)

Returns the value of attribute tax.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def tax
  @tax
end

#tax_applicabilityObject (readonly)

Returns the value of attribute tax_applicability.



44827
44828
44829
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44827

def tax_applicability
  @tax_applicability
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



44847
44848
44849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44847

def copy(incoming={})
  HarmonizedLandedCostItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



44851
44852
44853
44854
44855
44856
44857
44858
44859
44860
44861
44862
44863
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44851

def to_hash
  {
    :item => item.to_hash,
    :duty => duty.to_hash,
    :tax => tax.to_hash,
    :tax_applicability => tax_applicability.nil? ? nil : tax_applicability.value,
    :origin => origin,
    :hs_code => hs_code,
    :tariff_code => tariff_code,
    :customs_description => customs_description,
    :source_address => source_address.nil? ? nil : source_address.to_hash
  }
end

#to_jsonObject



44843
44844
44845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44843

def to_json
  JSON.dump(to_hash)
end