Class: Io::Flow::V0::Models::HarmonizedItemForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedItemForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
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.
-
#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 = {}) ⇒ HarmonizedItemForm
constructor
A new instance of HarmonizedItemForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedItemForm
Returns a new instance of HarmonizedItemForm.
19533 19534 19535 19536 19537 19538 19539 19540 19541 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19533 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :number], 'HarmonizedItemForm') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @categories = (x = opts.delete(:categories); x.nil? ? nil : HttpClient::Preconditions.assert_class('categories', x, Array).map { |v| HttpClient::Preconditions.assert_class('categories', v, String) }) @description = (x = opts.delete(:description); x.nil? ? nil : HttpClient::Preconditions.assert_class('description', x, String)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
19531 19532 19533 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19531 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
19531 19532 19533 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19531 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
19531 19532 19533 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19531 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19531 19532 19533 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19531 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
19531 19532 19533 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19531 def number @number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
19547 19548 19549 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19547 def copy(incoming={}) HarmonizedItemForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
19551 19552 19553 19554 19555 19556 19557 19558 19559 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19551 def to_hash { :name => name, :number => number, :categories => categories.nil? ? nil : categories, :description => description, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
19543 19544 19545 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19543 def to_json JSON.dump(to_hash) end |