Class: Io::Flow::V0::Models::HarmonizedLandedCostForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Allows calculation of duty and tax for multiple items in one API call for items going to a specific destination country

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ HarmonizedLandedCostForm

Returns a new instance of HarmonizedLandedCostForm.



17606
17607
17608
17609
17610
17611
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17606

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:address, :item_numbers], 'HarmonizedLandedCostForm')
  @address = (x = opts.delete(:address); x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))
  @item_numbers = HttpClient::Preconditions.assert_class('item_numbers', opts.delete(:item_numbers), Array).map { |v| HttpClient::Preconditions.assert_class('item_numbers', v, String) }
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



17604
17605
17606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17604

def address
  @address
end

#item_numbersObject (readonly)

Returns the value of attribute item_numbers.



17604
17605
17606
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17604

def item_numbers
  @item_numbers
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17617
17618
17619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17617

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

#to_hashObject



17621
17622
17623
17624
17625
17626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17621

def to_hash
  {
    :address => address.to_hash,
    :item_numbers => item_numbers
  }
end

#to_jsonObject



17613
17614
17615
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17613

def to_json
  JSON.dump(to_hash)
end