Class: Io::Flow::V0::Models::Hs10

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

Overview

The (Harmonized System) HS-10 code assigned to an item with a given origin/destination pair.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Hs10

Returns a new instance of Hs10.



30322
30323
30324
30325
30326
30327
30328
30329
30330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30322

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :item, :origin, :destination, :code], 'Hs10')
  @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))
  @origin = HttpClient::Preconditions.assert_class('origin', opts.delete(:origin), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
  @code = HttpClient::Preconditions.assert_class('code', opts.delete(:code), String)
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



30320
30321
30322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30320

def code
  @code
end

#destinationObject (readonly)

Returns the value of attribute destination.



30320
30321
30322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30320

def destination
  @destination
end

#idObject (readonly)

Returns the value of attribute id.



30320
30321
30322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30320

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



30320
30321
30322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30320

def item
  @item
end

#originObject (readonly)

Returns the value of attribute origin.



30320
30321
30322
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30320

def origin
  @origin
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30336
30337
30338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30336

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

#to_hashObject



30340
30341
30342
30343
30344
30345
30346
30347
30348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30340

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

#to_jsonObject



30332
30333
30334
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30332

def to_json
  JSON.dump(to_hash)
end