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.



17975
17976
17977
17978
17979
17980
17981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17975

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

#codeObject (readonly)

Returns the value of attribute code.



17973
17974
17975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17973

def code
  @code
end

#idObject (readonly)

Returns the value of attribute id.



17973
17974
17975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17973

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



17973
17974
17975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17973

def item
  @item
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17987
17988
17989
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17987

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

#to_hashObject



17991
17992
17993
17994
17995
17996
17997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17991

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

#to_jsonObject



17983
17984
17985
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17983

def to_json
  JSON.dump(to_hash)
end