Class: Io::Flow::V0::Models::HarmonizedLandedCost
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedLandedCost
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Summary of landed cost data (taxes and duties) for 1 or more items going to a single destination country. Records are unique based on (item.number, country of origin).
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#tax_registration ⇒ Object
readonly
Returns the value of attribute tax_registration.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedLandedCost
constructor
A new instance of HarmonizedLandedCost.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedLandedCost
Returns a new instance of HarmonizedLandedCost.
26337 26338 26339 26340 26341 26342 26343 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26337 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:address, :items], 'HarmonizedLandedCost') @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::HarmonizedLandedCostItem) ? x : ::Io::Flow::V0::Models::HarmonizedLandedCostItem.new(x)) } @tax_registration = (x = opts.delete(:tax_registration); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::TaxRegistration) ? x : ::Io::Flow::V0::Models::TaxRegistration.new(x))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
26335 26336 26337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26335 def address @address end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
26335 26336 26337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26335 def items @items end |
#tax_registration ⇒ Object (readonly)
Returns the value of attribute tax_registration.
26335 26336 26337 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26335 def tax_registration @tax_registration end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
26349 26350 26351 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26349 def copy(incoming={}) HarmonizedLandedCost.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
26353 26354 26355 26356 26357 26358 26359 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26353 def to_hash { :address => address.to_hash, :items => items.map { |o| o.to_hash }, :tax_registration => tax_registration.nil? ? nil : tax_registration.to_hash } end |
#to_json ⇒ Object
26345 26346 26347 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26345 def to_json JSON.dump(to_hash) end |