Class: Io::Flow::V0::Models::ExperienceUpserted

Inherits:
Event
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

#to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ExperienceUpserted

Returns a new instance of ExperienceUpserted.



12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12335

def initialize(incoming={})
  super(:discriminator => Event::Types::EXPERIENCE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :key, :name, :delivered_duty, :subcatalog_id, :region_id, :country, :currency, :language, :measurement_system, :position], 'ExperienceUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @delivered_duty = HttpClient::Preconditions.assert_class('delivered_duty', opts.delete(:delivered_duty), String)
  @subcatalog_id = HttpClient::Preconditions.assert_class('subcatalog_id', opts.delete(:subcatalog_id), String)
  @region_id = HttpClient::Preconditions.assert_class('region_id', opts.delete(:region_id), String)
  @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 = HttpClient::Preconditions.assert_class('measurement_system', opts.delete(:measurement_system), String)
  @position = HttpClient::Preconditions.assert_class('position', opts.delete(:position), Integer)
end

Instance Attribute Details

#country ⇒ Object (readonly)

Returns the value of attribute country.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def country
  @country
end

#currency ⇒ Object (readonly)

Returns the value of attribute currency.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def currency
  @currency
end

#delivered_duty ⇒ Object (readonly)

Returns the value of attribute delivered_duty.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def delivered_duty
  @delivered_duty
end

#event_id ⇒ Object (readonly)

Returns the value of attribute event_id.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def event_id
  @event_id
end

#key ⇒ Object (readonly)

Returns the value of attribute key.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def key
  @key
end

#language ⇒ Object (readonly)

Returns the value of attribute language.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def language
  @language
end

#measurement_system ⇒ Object (readonly)

Returns the value of attribute measurement_system.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def measurement_system
  @measurement_system
end

#name ⇒ Object (readonly)

Returns the value of attribute name.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def name
  @name
end

#organization ⇒ Object (readonly)

Returns the value of attribute organization.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def organization
  @organization
end

#position ⇒ Object (readonly)

Returns the value of attribute position.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def position
  @position
end

#region_id ⇒ Object (readonly)

Returns the value of attribute region_id.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def region_id
  @region_id
end

#subcatalog_id ⇒ Object (readonly)

Returns the value of attribute subcatalog_id.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def subcatalog_id
  @subcatalog_id
end

#timestamp ⇒ Object (readonly)

Returns the value of attribute timestamp.



12333
12334
12335
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12333

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



12358
12359
12360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12358

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

#subtype_to_hash ⇒ Object



12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12362

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :key => key,
    :name => name,
    :delivered_duty => delivered_duty,
    :subcatalog_id => subcatalog_id,
    :region_id => region_id,
    :country => country,
    :currency => currency,
    :language => language,
    :measurement_system => measurement_system,
    :position => position
  }
end

#to_json ⇒ Object



12354
12355
12356
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12354

def to_json
  JSON.dump(to_hash)
end