Class: Io::Flow::V0::Models::HarmonizedItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
A harmonized item stores explicit information about this item for the purposes of harmonization / classification. The harmonization process begins by creating a harmonized item; this kicks off the internal processes. Once assigned, codes will be available via the hs6 and hs10 resources
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#categories ⇒ Object
readonly
Returns the value of attribute categories.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedItem
constructor
A new instance of HarmonizedItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedItem
Returns a new instance of HarmonizedItem.
34671 34672 34673 34674 34675 34676 34677 34678 34679 34680 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34671 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number, :name], 'HarmonizedItem') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @categories = HttpClient::Preconditions.assert_class('categories', (x = opts.delete(:categories); x.nil? ? [] : x), Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) } @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def description @description end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
34669 34670 34671 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34669 def number @number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
34686 34687 34688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34686 def copy(incoming={}) HarmonizedItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
34690 34691 34692 34693 34694 34695 34696 34697 34698 34699 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34690 def to_hash { :id => id, :number => number, :name => name, :categories => categories, :attributes => attributes, :description => description } end |
#to_json ⇒ Object
34682 34683 34684 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 34682 def to_json JSON.dump(to_hash) end |