Class: Io::Flow::V0::Models::ExperienceForm

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 = {}) ⇒ ExperienceForm

Returns a new instance of ExperienceForm.



12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12234

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:region_id, :name], 'ExperienceForm')
  @region_id = HttpClient::Preconditions.assert_class('region_id', opts.delete(:region_id), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)))
  @country = (x = opts.delete(:country); x.nil? ? nil : HttpClient::Preconditions.assert_class('country', x, String))
  @currency = (x = opts.delete(:currency); x.nil? ? nil : HttpClient::Preconditions.assert_class('currency', x, String))
  @language = (x = opts.delete(:language); x.nil? ? nil : HttpClient::Preconditions.assert_class('language', x, String))
  @key = (x = opts.delete(:key); x.nil? ? nil : HttpClient::Preconditions.assert_class('key', x, String))
  @measurement_system = (x = opts.delete(:measurement_system); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::MeasurementSystem) ? x : ::Io::Flow::V0::Models::MeasurementSystem.apply(x)))
  @subcatalog_id = (x = opts.delete(:subcatalog_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog_id', x, String))
  @position = (x = opts.delete(:position); x.nil? ? nil : HttpClient::Preconditions.assert_class('position', x, Integer))
end

Instance Attribute Details

#country ⇒ Object (readonly)

Returns the value of attribute country.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def country
  @country
end

#currency ⇒ Object (readonly)

Returns the value of attribute currency.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def currency
  @currency
end

#delivered_duty ⇒ Object (readonly)

Returns the value of attribute delivered_duty.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def delivered_duty
  @delivered_duty
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def key
  @key
end

#language ⇒ Object (readonly)

Returns the value of attribute language.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def language
  @language
end

#measurement_system ⇒ Object (readonly)

Returns the value of attribute measurement_system.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def measurement_system
  @measurement_system
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def name
  @name
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def position
  @position
end

#region_id ⇒ Object (readonly)

Returns the value of attribute region_id.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def region_id
  @region_id
end

#subcatalog_id ⇒ Object (readonly)

Returns the value of attribute subcatalog_id.



12232
12233
12234
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12232

def subcatalog_id
  @subcatalog_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12253
12254
12255
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12253

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

#to_hash ⇒ Object



12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12257

def to_hash
  {
    :region_id => region_id,
    :name => name,
    :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value,
    :country => country,
    :currency => currency,
    :language => language,
    :key => key,
    :measurement_system => measurement_system.nil? ? nil : measurement_system.value,
    :subcatalog_id => subcatalog_id,
    :position => position
  }
end

#to_json ⇒ Object



12249
12250
12251
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12249

def to_json
  JSON.dump(to_hash)
end