class Io::Flow::V0::Models::LocalItem

The Local Item represents all of the data for a given item that is localized to a given experience.

Attributes

attributes[R]
center[R]
experience[R]
id[R]
item[R]
pricing[R]
status[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 48661
def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :experience, :item, :pricing, :status], 'LocalItem')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @experience = (x = opts.delete(:experience); x.is_a?(::Io::Flow::V0::Models::ExperienceSummary) ? x : ::Io::Flow::V0::Models::ExperienceSummary.new(x))
  @center = (x = opts.delete(:center); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::CenterSummary) ? x : ::Io::Flow::V0::Models::CenterSummary.new(x)))
  @item = (x = opts.delete(:item); x.is_a?(::Io::Flow::V0::Models::CatalogItemReference) ? x : ::Io::Flow::V0::Models::CatalogItemReference.new(x))
  @pricing = (x = opts.delete(:pricing); x.is_a?(::Io::Flow::V0::Models::LocalItemPricing) ? x : ::Io::Flow::V0::Models::LocalItemPricing.new(x))
  @status = (x = opts.delete(:status); x.is_a?(::Io::Flow::V0::Models::SubcatalogItemStatus) ? x : ::Io::Flow::V0::Models::SubcatalogItemStatus.apply(x))
  @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 })
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 48677
def copy(incoming={})
  LocalItem.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 48681
def to_hash
  {
    :id => id,
    :experience => experience.to_hash,
    :center => center.nil? ? nil : center.to_hash,
    :item => item.to_hash,
    :pricing => pricing.to_hash,
    :status => status.value,
    :attributes => attributes.nil? ? nil : attributes
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 48673
def to_json
  JSON.dump(to_hash)
end