Class: Io::Flow::V0::Models::Hs10Code

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

Overview

Harmonized System codes for specific countries, up to 10 digits (HS-10). Not all countries use all 10 digits of precision.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Hs10Code

Returns a new instance of Hs10Code.



16988
16989
16990
16991
16992
16993
16994
16995
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16988

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:code, :destination], 'Hs10Code')
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
  @parent = (x = opts.delete(:parent); x.nil? ? nil : HttpClient::Preconditions.assert_class('parent', x, String))
  @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String))
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



16986
16987
16988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16986

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



16986
16987
16988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16986

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



16986
16987
16988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16986

def destination
  @destination
end

#parentObject (readonly)

Returns the value of attribute parent.



16986
16987
16988
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16986

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17001
17002
17003
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17001

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

#to_hashObject



17005
17006
17007
17008
17009
17010
17011
17012
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17005

def to_hash
  {
    :code => code,
    :destination => destination,
    :parent => parent,
    :description => description
  }
end

#to_jsonObject



16997
16998
16999
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16997

def to_json
  JSON.dump(to_hash)
end