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.
-
#billing_address ⇒ Object
readonly
Returns the value of attribute billing_address.
-
#item_numbers ⇒ Object
readonly
Returns the value of attribute item_numbers.
-
#line_items ⇒ Object
readonly
Returns the value of attribute line_items.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#source_address ⇒ Object
readonly
Returns the value of attribute source_address.
-
#tax_registration_id ⇒ Object
readonly
Returns the value of attribute tax_registration_id.
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.
44789 44790 44791 44792 44793 44794 44795 44796 44797 44798 44799 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44789 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)) @line_items = (x = opts.delete(:line_items); x.nil? ? nil : HttpClient::Preconditions.assert_class('line_items', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItem) ? x : ::Io::Flow::V0::Models::LineItem.new(x)) }) @tax_registration_id = (x = opts.delete(:tax_registration_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('tax_registration_id', x, String)) @billing_address = (x = opts.delete(:billing_address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::BillingAddress) ? x : ::Io::Flow::V0::Models::BillingAddress.new(x))) end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def address @address end |
#billing_address ⇒ Object (readonly)
Returns the value of attribute billing_address.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def billing_address @billing_address end |
#item_numbers ⇒ Object (readonly)
Returns the value of attribute item_numbers.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def item_numbers @item_numbers end |
#line_items ⇒ Object (readonly)
Returns the value of attribute line_items.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def line_items @line_items end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def order_number @order_number end |
#source_address ⇒ Object (readonly)
Returns the value of attribute source_address.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def source_address @source_address end |
#tax_registration_id ⇒ Object (readonly)
Returns the value of attribute tax_registration_id.
44787 44788 44789 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44787 def tax_registration_id @tax_registration_id end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
44805 44806 44807 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44805 def copy(incoming={}) HarmonizedLandedCostForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
44809 44810 44811 44812 44813 44814 44815 44816 44817 44818 44819 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44809 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, :line_items => line_items.nil? ? nil : line_items.map { |o| o.to_hash }, :tax_registration_id => tax_registration_id, :billing_address => billing_address.nil? ? nil : billing_address.to_hash } end |
#to_json ⇒ Object
44801 44802 44803 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44801 def to_json JSON.dump(to_hash) end |