Class: Io::Flow::V0::Models::HarmonizedItemPutForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::HarmonizedItemPutForm
- 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.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ HarmonizedItemPutForm
constructor
A new instance of HarmonizedItemPutForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ HarmonizedItemPutForm
Returns a new instance of HarmonizedItemPutForm.
44688 44689 44690 44691 44692 44693 44694 44695 44696 44697 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44688 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:name, :currency, :price], 'HarmonizedItemPutForm') @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String) @price = HttpClient::Preconditions.assert_class('price', opts.delete(:price), Numeric) @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.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def categories @categories end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def currency @currency end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def name @name end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
44686 44687 44688 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44686 def price @price end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
44703 44704 44705 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44703 def copy(incoming={}) HarmonizedItemPutForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
44707 44708 44709 44710 44711 44712 44713 44714 44715 44716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44707 def to_hash { :name => name, :currency => currency, :price => price, :categories => categories.nil? ? nil : categories, :description => description, :attributes => attributes.nil? ? nil : attributes } end |
#to_json ⇒ Object
44699 44700 44701 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 44699 def to_json JSON.dump(to_hash) end |