Class: Io::Flow::V0::Models::Experience

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

Overview

Experiences define a local experience for a given geographic region

Instance Attribute Summary collapse

Attributes inherited from ExpandableExperience

#discriminator

Instance Method Summary collapse

Methods inherited from ExpandableExperience

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ Experience

Returns a new instance of Experience.



17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17717

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

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def delivered_duty
  @delivered_duty
end

#idObject (readonly)

Returns the value of attribute id.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def name
  @name
end

#positionObject (readonly)

Returns the value of attribute position.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def position
  @position
end

#regionObject (readonly)

Returns the value of attribute region.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def region
  @region
end

#settingsObject (readonly)

Returns the value of attribute settings.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def settings
  @settings
end

#statusObject (readonly)

Returns the value of attribute status.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def status
  @status
end

#subcatalogObject (readonly)

Returns the value of attribute subcatalog.



17715
17716
17717
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17715

def subcatalog
  @subcatalog
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



17740
17741
17742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17740

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

#subtype_to_hashObject



17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17744

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_jsonObject



17736
17737
17738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17736

def to_json
  JSON.dump(to_hash)
end