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.



20250
20251
20252
20253
20254
20255
20256
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20250

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

#dutyObject (readonly)

Returns the value of attribute duty.



20248
20249
20250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20248

def duty
  @duty
end

#itemObject (readonly)

Returns the value of attribute item.



20248
20249
20250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20248

def item
  @item
end

#taxObject (readonly)

Returns the value of attribute tax.



20248
20249
20250
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20248

def tax
  @tax
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20262
20263
20264
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20262

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

#to_hashObject



20266
20267
20268
20269
20270
20271
20272
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20266

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

#to_jsonObject



20258
20259
20260
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20258

def to_json
  JSON.dump(to_hash)
end