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.



34886
34887
34888
34889
34890
34891
34892
34893
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34886

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)))
end

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



34884
34885
34886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34884

def duty
  @duty
end

#itemObject (readonly)

Returns the value of attribute item.



34884
34885
34886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34884

def item
  @item
end

#taxObject (readonly)

Returns the value of attribute tax.



34884
34885
34886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34884

def tax
  @tax
end

#tax_applicabilityObject (readonly)

Returns the value of attribute tax_applicability.



34884
34885
34886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34884

def tax_applicability
  @tax_applicability
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



34899
34900
34901
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34899

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

#to_hashObject



34903
34904
34905
34906
34907
34908
34909
34910
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34903

def to_hash
  {
    :item => item.to_hash,
    :duty => duty.to_hash,
    :tax => tax.to_hash,
    :tax_applicability => tax_applicability.nil? ? nil : tax_applicability.value
  }
end

#to_jsonObject



34895
34896
34897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34895

def to_json
  JSON.dump(to_hash)
end