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.



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

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.



17004
17005
17006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17004

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



17004
17005
17006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17004

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



17004
17005
17006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17004

def destination
  @destination
end

#parentObject (readonly)

Returns the value of attribute parent.



17004
17005
17006
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17004

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17019
17020
17021
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17019

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

#to_hashObject



17023
17024
17025
17026
17027
17028
17029
17030
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17023

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

#to_jsonObject



17015
17016
17017
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17015

def to_json
  JSON.dump(to_hash)
end