Class: Io::Flow::V0::Models::HarmonizedLandedCostItem

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

Overview

Duty and tax information for a given item. Note that the internal implementation supports multiple countries of origin.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ HarmonizedLandedCostItem

Returns a new instance of HarmonizedLandedCostItem.



13420
13421
13422
13423
13424
13425
13426
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13420

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:item, :duty, :tax], 'HarmonizedLandedCostItem')
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::HarmonizedItemReference) ? x : ::Io::Flow::V0::Models::HarmonizedItemReference.new(x))
  @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::Duty) ? x : ::Io::Flow::V0::Models::Duty.new(x))
  @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::Tax) ? x : ::Io::Flow::V0::Models::Tax.new(x))
end

Instance Attribute Details

#duty ⇒ Object (readonly)

Returns the value of attribute duty.



13418
13419
13420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13418

def duty
  @duty
end

#item ⇒ Object (readonly)

Returns the value of attribute item.



13418
13419
13420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13418

def item
  @item
end

#tax ⇒ Object (readonly)

Returns the value of attribute tax.



13418
13419
13420
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13418

def tax
  @tax
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13432
13433
13434
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13432

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

#to_hash ⇒ Object



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

def to_hash
  {
    :item => item.to_hash,
    :duty => duty.to_hash,
    :tax => tax.to_hash
  }
end

#to_json ⇒ Object



13428
13429
13430
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13428

def to_json
  JSON.dump(to_hash)
end