Class: Io::Flow::V0::Models::HarmonizedLandedCostForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedLandedCostForm
- 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
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#item_numbers ⇒ Object
readonly
Returns the value of attribute item_numbers.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#source_address ⇒ Object
readonly
Returns the value of attribute source_address.
-
#submitted ⇒ Object
readonly
Returns the value of attribute submitted.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedLandedCostForm
constructor
A new instance of HarmonizedLandedCostForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedLandedCostForm
Returns a new instance of HarmonizedLandedCostForm.
20214 20215 20216 20217 20218 20219 20220 20221 20222 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20214 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) } @source_address = (x = opts.delete(:source_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x))) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String)) @submitted = (x = opts.delete(:submitted); x.nil? ? nil : HttpClient::Preconditions.assert_boolean('submitted', x)) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
20212 20213 20214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20212 def address @address end |
#item_numbers ⇒ Object (readonly)
Returns the value of attribute item_numbers.
20212 20213 20214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20212 def item_numbers @item_numbers end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
20212 20213 20214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20212 def order_number @order_number end |
#source_address ⇒ Object (readonly)
Returns the value of attribute source_address.
20212 20213 20214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20212 def source_address @source_address end |
#submitted ⇒ Object (readonly)
Returns the value of attribute submitted.
20212 20213 20214 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20212 def submitted @submitted end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
20228 20229 20230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20228 def copy(incoming={}) HarmonizedLandedCostForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
20232 20233 20234 20235 20236 20237 20238 20239 20240 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20232 def to_hash { :address => address.to_hash, :item_numbers => item_numbers, :source_address => source_address.nil? ? nil : source_address.to_hash, :order_number => order_number, :submitted => submitted } end |
#to_json ⇒ Object
20224 20225 20226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20224 def to_json JSON.dump(to_hash) end |