Class: Io::Flow::V0::Models::Hs6

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

Overview

The (Harmonized System) HS-6 code assigned to an item.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Hs6

Returns a new instance of Hs6.



13651
13652
13653
13654
13655
13656
13657
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13651

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :item, :code], 'Hs6')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::HarmonizedItemReference) ? x : ::Io::Flow::V0::Models::HarmonizedItemReference.new(x))
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
end

Instance Attribute Details

#code ⇒ Object (readonly)

Returns the value of attribute code.



13649
13650
13651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13649

def code
  @code
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



13649
13650
13651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13649

def id
  @id
end

#item ⇒ Object (readonly)

Returns the value of attribute item.



13649
13650
13651
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13649

def item
  @item
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



13663
13664
13665
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13663

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

#to_hash ⇒ Object



13667
13668
13669
13670
13671
13672
13673
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13667

def to_hash
  {
    :id => id,
    :item => item.to_hash,
    :code => code
  }
end

#to_json ⇒ Object



13659
13660
13661
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13659

def to_json
  JSON.dump(to_hash)
end