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.



12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12164

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

#countryObject (readonly)

Returns the value of attribute country.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def delivered_duty
  @delivered_duty
end

#idObject (readonly)

Returns the value of attribute id.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def name
  @name
end

#positionObject (readonly)

Returns the value of attribute position.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def position
  @position
end

#regionObject (readonly)

Returns the value of attribute region.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def region
  @region
end

#subcatalogObject (readonly)

Returns the value of attribute subcatalog.



12162
12163
12164
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12162

def subcatalog
  @subcatalog
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12184
12185
12186
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12184

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

#to_hashObject



12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12188

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_jsonObject



12180
12181
12182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12180

def to_json
  JSON.dump(to_hash)
end