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.



47078
47079
47080
47081
47082
47083
47084
47085
47086
47087
47088
47089
47090
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47078

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)
  @price = (x = opts.delete(:price); x.nil? ? nil : HttpClient::Preconditions.assert_class('price', x, Numeric))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, 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.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def attributes
  @attributes
end

#categoriesObject (readonly)

Returns the value of attribute categories.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def categories
  @categories
end

#currencyObject (readonly)

Returns the value of attribute currency.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def currency
  @currency
end

#descriptionObject (readonly)

Returns the value of attribute description.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def description
  @description
end

#dimensionsObject (readonly)

Returns the value of attribute dimensions.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def dimensions
  @dimensions
end

#imagesObject (readonly)

Returns the value of attribute images.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def images
  @images
end

#numberObject (readonly)

Returns the value of attribute number.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def number
  @number
end

#positionObject (readonly)

Returns the value of attribute position.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def position
  @position
end

#priceObject (readonly)

Returns the value of attribute price.



47076
47077
47078
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47076

def price
  @price
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



47096
47097
47098
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47096

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

#to_hashObject



47100
47101
47102
47103
47104
47105
47106
47107
47108
47109
47110
47111
47112
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47100

def to_hash
  {
    :number => number,
    :price => price,
    :currency => currency,
    :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



47092
47093
47094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47092

def to_json
  JSON.dump(to_hash)
end