Class: Io::Flow::V0::Models::ItemFormOverlay

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemFormOverlay

Returns a new instance of ItemFormOverlay.



43761
43762
43763
43764
43765
43766
43767
43768
43769
43770
43771
43772
43773
43774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43761

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

#attributesObject (readonly)

Returns the value of attribute attributes.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def categories
  @categories
end

#descriptionObject (readonly)

Returns the value of attribute description.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def description
  @description
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def dimensions
  @dimensions
end

#idObject (readonly)

Returns the value of attribute id.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def images
  @images
end

#keyObject (readonly)

Returns the value of attribute key.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def key
  @key
end

#numberObject (readonly)

Returns the value of attribute number.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def number
  @number
end

#positionObject (readonly)

Returns the value of attribute position.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def position
  @position
end

#priceObject (readonly)

Returns the value of attribute price.



43759
43760
43761
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43759

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



43780
43781
43782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43780

def copy(incoming={})
  ItemFormOverlay.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



43784
43785
43786
43787
43788
43789
43790
43791
43792
43793
43794
43795
43796
43797
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43784

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_jsonObject



43776
43777
43778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43776

def to_json
  JSON.dump(to_hash)
end