Class: Io::Flow::V0::Models::HarmonizedItemDuty
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedItemDuty
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Used to specifically set an item’s duty rate for a given trade lane.
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#rate ⇒ Object
readonly
Returns the value of attribute rate.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedItemDuty
constructor
A new instance of HarmonizedItemDuty.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedItemDuty
Returns a new instance of HarmonizedItemDuty.
19435 19436 19437 19438 19439 19440 19441 19442 19443 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19435 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :item, :origin, :destination, :rate], 'HarmonizedItemDuty') @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) @rate = HttpClient::Preconditions.assert_class('rate', HttpClient::Helper.to_big_decimal(opts.delete(:rate)), BigDecimal) end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
19433 19434 19435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19433 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19433 19434 19435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19433 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
19433 19434 19435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19433 def item @item end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
19433 19434 19435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19433 def origin @origin end |
#rate ⇒ Object (readonly)
Returns the value of attribute rate.
19433 19434 19435 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19433 def rate @rate end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19449 19450 19451 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19449 def copy(incoming={}) HarmonizedItemDuty.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
19453 19454 19455 19456 19457 19458 19459 19460 19461 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19453 def to_hash { :id => id, :item => item.to_hash, :origin => origin, :destination => destination, :rate => rate } end |
#to_json ⇒ Object
19445 19446 19447 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19445 def to_json JSON.dump(to_hash) end |