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.
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.
20503 20504 20505 20506 20507 20508 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20503 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)) } end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
20501 20502 20503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20501 def address @address end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
20501 20502 20503 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20501 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20514 20515 20516 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20514 def copy(incoming={}) HarmonizedLandedCost.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
20518 20519 20520 20521 20522 20523 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20518 def to_hash { :address => address.to_hash, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
20510 20511 20512 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20510 def to_json JSON.dump(to_hash) end |