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

Inherits:
Object
  • Object
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

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Experience

Returns a new instance of Experience.



12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12113

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :name, :delivered_duty, :region, :country, :currency, :language, :measurement_system, :subcatalog, :position], '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)
end

Instance Attribute Details

#country ⇒ Object (readonly)

Returns the value of attribute country.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def country
  @country
end

#currency ⇒ Object (readonly)

Returns the value of attribute currency.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def currency
  @currency
end

#delivered_duty ⇒ Object (readonly)

Returns the value of attribute delivered_duty.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def delivered_duty
  @delivered_duty
end

#id ⇒ Object (readonly)

Returns the value of attribute id.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def id
  @id
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def key
  @key
end

#language ⇒ Object (readonly)

Returns the value of attribute language.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def language
  @language
end

#measurement_system ⇒ Object (readonly)

Returns the value of attribute measurement_system.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def measurement_system
  @measurement_system
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def name
  @name
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def position
  @position
end

#region ⇒ Object (readonly)

Returns the value of attribute region.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def region
  @region
end

#subcatalog ⇒ Object (readonly)

Returns the value of attribute subcatalog.



12111
12112
12113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12111

def subcatalog
  @subcatalog
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12133
12134
12135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12133

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

#to_hash ⇒ Object



12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12137

def 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
  }
end

#to_json ⇒ Object



12129
12130
12131
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12129

def to_json
  JSON.dump(to_hash)
end