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



16966
16967
16968
16969
16970
16971
16972
16973
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16966

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.



16964
16965
16966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16964

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



16964
16965
16966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16964

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



16964
16965
16966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16964

def destination
  @destination
end

#parentObject (readonly)

Returns the value of attribute parent.



16964
16965
16966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16964

def parent
  @parent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16979
16980
16981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16979

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

#to_hashObject



16983
16984
16985
16986
16987
16988
16989
16990
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16983

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

#to_jsonObject



16975
16976
16977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16975

def to_json
  JSON.dump(to_hash)
end