Class: Io::Flow::V0::Models::Hs10
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Hs10
- 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
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#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.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Hs10
constructor
A new instance of Hs10.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Hs10
Returns a new instance of Hs10.
45100 45101 45102 45103 45104 45105 45106 45107 45108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45100 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
#code ⇒ Object (readonly)
Returns the value of attribute code.
45098 45099 45100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45098 def code @code end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
45098 45099 45100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45098 def destination @destination end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
45098 45099 45100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45098 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
45098 45099 45100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45098 def item @item end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
45098 45099 45100 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45098 def origin @origin end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
45114 45115 45116 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45114 def copy(incoming={}) Hs10.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
45118 45119 45120 45121 45122 45123 45124 45125 45126 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45118 def to_hash { :id => id, :item => item.to_hash, :origin => origin, :destination => destination, :code => code } end |
#to_json ⇒ Object
45110 45111 45112 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 45110 def to_json JSON.dump(to_hash) end |