class Io::Flow::V0::Models::CheckoutAttribute

A Checkout Attribute defines an attribute that will be made available via the checkout item content. This is useful if you would like to surface a specific attribute (like ‘size’ or ‘color’) in checkout.

Attributes

attribute_keys[R]
experience[R]
id[R]
key[R]
name[R]
position[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 35903
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :experience, :key, :name, :attribute_keys, :position], 'CheckoutAttribute')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceReference) ? x : ::Io::Flow::V0::Models::ExperienceReference.new(x))
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @attribute_keys = HttpClient::Preconditions.assert_class('attribute_keys', opts.delete(:attribute_keys), Array).map { |v| HttpClient::Preconditions.assert_class('attribute_keys', v, String) }
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 35918
def copy(incoming={})
  CheckoutAttribute.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 35922
def to_hash
  {
    :id => id,
    :experience => experience.to_hash,
    :key => key,
    :name => name,
    :attribute_keys => attribute_keys,
    :position => position
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 35914
def to_json
  JSON.dump(to_hash)
end