Class: Io::Flow::V0::Models::TariffCode

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

Overview

Harmonized System codes for specific products imported into specific countries. These are between 4 and 12 digits and are used to select the correct duty rate.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TariffCode

Returns a new instance of TariffCode.



31206
31207
31208
31209
31210
31211
31212
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31206

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



31204
31205
31206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31204

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



31204
31205
31206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31204

def description
  @description
end

#destinationObject (readonly)

Returns the value of attribute destination.



31204
31205
31206
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31204

def destination
  @destination
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31218
31219
31220
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31218

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

#to_hashObject



31222
31223
31224
31225
31226
31227
31228
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31222

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

#to_jsonObject



31214
31215
31216
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31214

def to_json
  JSON.dump(to_hash)
end