Class: Io::Flow::V0::Models::LaneLandedCost

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

Overview

The tariff codes, duty rates and tax rates associated with an origin/destination pair. Does not take into account sales province

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ LaneLandedCost

Returns a new instance of LaneLandedCost.



22257
22258
22259
22260
22261
22262
22263
22264
22265
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22257

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:origin, :destination, :tariff_code, :effective_duty, :tax], 'LaneLandedCost')
  @origin = HttpClient::Preconditions.assert_class('origin', opts.delete(:origin), String)
  @destination = HttpClient::Preconditions.assert_class('destination', opts.delete(:destination), String)
  @tariff_code = HttpClient::Preconditions.assert_class('tariff_code', opts.delete(:tariff_code), String)
  @effective_duty = (x = opts.delete(:effective_duty); x.is_a?(::Io::Flow::V0::Models::Duty) ? x : ::Io::Flow::V0::Models::Duty.new(x))
  @tax = (x = opts.delete(:tax); x.is_a?(::Io::Flow::V0::Models::Tax) ? x : ::Io::Flow::V0::Models::Tax.new(x))
end

Instance Attribute Details

#destinationObject (readonly)

Returns the value of attribute destination.



22255
22256
22257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22255

def destination
  @destination
end

#effective_dutyObject (readonly)

Returns the value of attribute effective_duty.



22255
22256
22257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22255

def effective_duty
  @effective_duty
end

#originObject (readonly)

Returns the value of attribute origin.



22255
22256
22257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22255

def origin
  @origin
end

#tariff_codeObject (readonly)

Returns the value of attribute tariff_code.



22255
22256
22257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22255

def tariff_code
  @tariff_code
end

#taxObject (readonly)

Returns the value of attribute tax.



22255
22256
22257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22255

def tax
  @tax
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



22271
22272
22273
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22271

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

#to_hashObject



22275
22276
22277
22278
22279
22280
22281
22282
22283
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22275

def to_hash
  {
    :origin => origin,
    :destination => destination,
    :tariff_code => tariff_code,
    :effective_duty => effective_duty.to_hash,
    :tax => tax.to_hash
  }
end

#to_jsonObject



22267
22268
22269
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 22267

def to_json
  JSON.dump(to_hash)
end