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.



21813
21814
21815
21816
21817
21818
21819
21820
21821
21822
21823
21824
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21813

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :number, :position], 'ItemFormOverlay')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
  @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.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def categories
  @categories
end

#descriptionObject (readonly)

Returns the value of attribute description.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def description
  @description
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def dimensions
  @dimensions
end

#idObject (readonly)

Returns the value of attribute id.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def id
  @id
end

#imagesObject (readonly)

Returns the value of attribute images.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def images
  @images
end

#numberObject (readonly)

Returns the value of attribute number.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def number
  @number
end

#positionObject (readonly)

Returns the value of attribute position.



21811
21812
21813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21811

def position
  @position
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21830
21831
21832
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21830

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

#to_hashObject



21834
21835
21836
21837
21838
21839
21840
21841
21842
21843
21844
21845
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21834

def to_hash
  {
    :id => id,
    :number => number,
    :position => position,
    :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



21826
21827
21828
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21826

def to_json
  JSON.dump(to_hash)
end