Class: Io::Flow::V0::Models::HarmonizedLandedCostItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedLandedCostItem
- 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
-
#duty ⇒ Object
readonly
Returns the value of attribute duty.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
-
#tax_applicability ⇒ Object
readonly
Returns the value of attribute tax_applicability.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedLandedCostItem
constructor
A new instance of HarmonizedLandedCostItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedLandedCostItem
Returns a new instance of HarmonizedLandedCostItem.
30131 30132 30133 30134 30135 30136 30137 30138 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30131 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
#duty ⇒ Object (readonly)
Returns the value of attribute duty.
30129 30130 30131 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30129 def duty @duty end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
30129 30130 30131 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30129 def item @item end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
30129 30130 30131 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30129 def tax @tax end |
#tax_applicability ⇒ Object (readonly)
Returns the value of attribute tax_applicability.
30129 30130 30131 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30129 def tax_applicability @tax_applicability end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30144 30145 30146 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30144 def copy(incoming={}) HarmonizedLandedCostItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30148 30149 30150 30151 30152 30153 30154 30155 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30148 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_json ⇒ Object
30140 30141 30142 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30140 def to_json JSON.dump(to_hash) end |