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.



16795
16796
16797
16798
16799
16800
16801
16802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16795

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.



16793
16794
16795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16793

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



16793
16794
16795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16793

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



16793
16794
16795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16793

def destination
  @destination
end

#parentObject (readonly)

Returns the value of attribute parent.



16793
16794
16795
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16793

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16808
16809
16810
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16808

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

#to_hashObject



16812
16813
16814
16815
16816
16817
16818
16819
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16812

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

#to_jsonObject



16804
16805
16806
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16804

def to_json
  JSON.dump(to_hash)
end