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.



18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18344

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

#countryObject (readonly)

Returns the value of attribute country.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def country
  @country
end

#currencyObject (readonly)

Returns the value of attribute currency.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def currency
  @currency
end

#delivered_dutyObject (readonly)

Returns the value of attribute delivered_duty.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def delivered_duty
  @delivered_duty
end

#keyObject (readonly)

Returns the value of attribute key.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def key
  @key
end

#languageObject (readonly)

Returns the value of attribute language.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def language
  @language
end

#measurement_systemObject (readonly)

Returns the value of attribute measurement_system.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def measurement_system
  @measurement_system
end

#nameObject (readonly)

Returns the value of attribute name.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def name
  @name
end

#positionObject (readonly)

Returns the value of attribute position.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def position
  @position
end

#region_idObject (readonly)

Returns the value of attribute region_id.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def region_id
  @region_id
end

#subcatalog_idObject (readonly)

Returns the value of attribute subcatalog_id.



18342
18343
18344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18342

def subcatalog_id
  @subcatalog_id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



18363
18364
18365
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18363

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

#to_hashObject



18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18367

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_jsonObject



18359
18360
18361
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18359

def to_json
  JSON.dump(to_hash)
end