Class: Io::Flow::V0::Models::ItemFormOverlayForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ItemFormOverlayForm

Returns a new instance of ItemFormOverlayForm.



21284
21285
21286
21287
21288
21289
21290
21291
21292
21293
21294
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21284

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



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def categories
  @categories
end

#descriptionObject (readonly)

Returns the value of attribute description.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def description
  @description
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def dimensions
  @dimensions
end

#imagesObject (readonly)

Returns the value of attribute images.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def images
  @images
end

#numberObject (readonly)

Returns the value of attribute number.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def number
  @number
end

#positionObject (readonly)

Returns the value of attribute position.



21282
21283
21284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21282

def position
  @position
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



21300
21301
21302
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21300

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

#to_hashObject



21304
21305
21306
21307
21308
21309
21310
21311
21312
21313
21314
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21304

def to_hash
  {
    :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



21296
21297
21298
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21296

def to_json
  JSON.dump(to_hash)
end