class Io::Flow::V0::Models::Experience

Experiences define a local experience for a given geographic region

Attributes

country[R]
currency[R]
delivered_duty[R]
id[R]
key[R]
language[R]
measurement_system[R]
name[R]
position[R]
region[R]
settings[R]
status[R]
subcatalog[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41399
def initialize(incoming={})
  super(:discriminator => ExpandableExperience::Types::EXPERIENCE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :name, :delivered_duty, :region, :country, :currency, :language, :measurement_system, :subcatalog, :position, :settings], 'Experience')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))
  @region = (x = opts.delete(:region); x.is_a?(::Io::Flow::V0::Models::RegionReference) ? x : ::Io::Flow::V0::Models::RegionReference.new(x))
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @currency = HttpClient::Preconditions.assert_class('currency', opts.delete(:currency), String)
  @language = HttpClient::Preconditions.assert_class('language', opts.delete(:language), String)
  @measurement_system = (x = opts.delete(:measurement_system); x.is_a?(::Io::Flow::V0::Models::MeasurementSystem) ? x : ::Io::Flow::V0::Models::MeasurementSystem.apply(x))
  @subcatalog = (x = opts.delete(:subcatalog); x.is_a?(::Io::Flow::V0::Models::SubcatalogReference) ? x : ::Io::Flow::V0::Models::SubcatalogReference.new(x))
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
  @settings = (x = opts.delete(:settings); x.is_a?(::Io::Flow::V0::Models::ExperienceSettings) ? x : ::Io::Flow::V0::Models::ExperienceSettings.new(x))
  @status = (x = opts.delete(:status); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ExperienceStatus) ? x : ::Io::Flow::V0::Models::ExperienceStatus.apply(x)))
end

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41422
def copy(incoming={})
  Experience.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
subtype_to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41426
def subtype_to_hash
  {
    :id => id,
    :key => key,
    :name => name,
    :delivered_duty => delivered_duty.value,
    :region => region.to_hash,
    :country => country,
    :currency => currency,
    :language => language,
    :measurement_system => measurement_system.value,
    :subcatalog => subcatalog.to_hash,
    :position => position,
    :settings => settings.to_hash,
    :status => status.nil? ? nil : status.value
  }
end
to_json() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 41418
def to_json
  JSON.dump(to_hash)
end