Class: Io::Flow::V0::Models::LaneLandedCost
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::LaneLandedCost
- 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
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#effective_duty ⇒ Object
readonly
Returns the value of attribute effective_duty.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#tariff_code ⇒ Object
readonly
Returns the value of attribute tariff_code.
-
#tax ⇒ Object
readonly
Returns the value of attribute tax.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ LaneLandedCost
constructor
A new instance of LaneLandedCost.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ LaneLandedCost
Returns a new instance of LaneLandedCost.
33218 33219 33220 33221 33222 33223 33224 33225 33226 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33218 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
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def destination @destination end |
#effective_duty ⇒ Object (readonly)
Returns the value of attribute effective_duty.
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def effective_duty @effective_duty end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def origin @origin end |
#tariff_code ⇒ Object (readonly)
Returns the value of attribute tariff_code.
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def tariff_code @tariff_code end |
#tax ⇒ Object (readonly)
Returns the value of attribute tax.
33216 33217 33218 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33216 def tax @tax end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
33232 33233 33234 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33232 def copy(incoming={}) LaneLandedCost.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
33236 33237 33238 33239 33240 33241 33242 33243 33244 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33236 def to_hash { :origin => origin, :destination => destination, :tariff_code => tariff_code, :effective_duty => effective_duty.to_hash, :tax => tax.to_hash } end |
#to_json ⇒ Object
33228 33229 33230 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 33228 def to_json JSON.dump(to_hash) end |