Class: Io::Flow::V0::Models::ItemFormOverlay
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ItemFormOverlay
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
The item form overlay defines data to merge into an item form.
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.
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ItemFormOverlay
constructor
A new instance of ItemFormOverlay.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ItemFormOverlay
35003 35004 35005 35006 35007 35008 35009 35010 35011 35012 35013 35014 35015 35016 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35003 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number, :key, :position], 'ItemFormOverlay') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String) @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer) @price = (x = opts.delete(:price); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))) @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 }) @dimensions = (x = opts.delete(:dimensions); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Dimensions) ? x : ::Io::Flow::V0::Models::Dimensions.new(x))) @images = (x = opts.delete(:images); x.nil? ? nil : HttpClient::Preconditions.assert_class('images', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ImageForm) ? x : ::Io::Flow::V0::Models::ImageForm.new(x)) }) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def attributes @attributes end |
#categories ⇒ Object (readonly)
Returns the value of attribute categories.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def categories @categories end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def description @description end |
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def dimensions @dimensions end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def id @id end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def images @images end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def key @key end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def number @number end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def position @position end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
35001 35002 35003 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35001 def price @price end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35022 35023 35024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35022 def copy(incoming={}) ItemFormOverlay.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35026 35027 35028 35029 35030 35031 35032 35033 35034 35035 35036 35037 35038 35039 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35026 def to_hash { :id => id, :number => number, :key => key, :position => position, :price => price.nil? ? nil : price.to_hash, :categories => categories.nil? ? nil : categories, :description => description, :attributes => attributes.nil? ? nil : attributes, :dimensions => dimensions.nil? ? nil : dimensions.to_hash, :images => images.nil? ? nil : images.map { |o| o.to_hash } } end |
#to_json ⇒ Object
35018 35019 35020 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35018 def to_json JSON.dump(to_hash) end |