Class: Io::Flow::V0::Models::HarmonizedLandedCost

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ HarmonizedLandedCost

Returns a new instance of HarmonizedLandedCost.



13437
13438
13439
13440
13441
13442
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13437

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

#addressObject (readonly)

Returns the value of attribute address.



13435
13436
13437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13435

def address
  @address
end

#itemsObject (readonly)

Returns the value of attribute items.



13435
13436
13437
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13435

def items
  @items
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13448
13449
13450
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13448

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

#to_hashObject



13452
13453
13454
13455
13456
13457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13452

def to_hash
  {
    :address => address.to_hash,
    :items => items.map { |o| o.to_hash }
  }
end

#to_jsonObject



13444
13445
13446
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13444

def to_json
  JSON.dump(to_hash)
end