Class: Io::Flow::V0::Models::TargetingItemUpserted

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

Overview

Indiciates that a given item has been targeted by the query q producing an outcome. The item number is unique within its targeting_id.

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ TargetingItemUpserted

Returns a new instance of TargetingItemUpserted.



31032
31033
31034
31035
31036
31037
31038
31039
31040
31041
31042
31043
31044
31045
31046
31047
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31032

def initialize(incoming={})
  super(:discriminator => Event::Types::TARGETING_ITEM_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :id, :targeting_id, :item_number, :q, :outcome_id, :catalog_id, :key], 'TargetingItemUpserted')
  @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)
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @targeting_id = HttpClient::Preconditions.assert_class('targeting_id', opts.delete(:targeting_id), String)
  @item_number = HttpClient::Preconditions.assert_class('item_number', opts.delete(:item_number), String)
  @q = HttpClient::Preconditions.assert_class('q', opts.delete(:q), String)
  @outcome_id = HttpClient::Preconditions.assert_class('outcome_id', opts.delete(:outcome_id), String)
  @catalog_id = HttpClient::Preconditions.assert_class('catalog_id', opts.delete(:catalog_id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @subcatalog_id = (x = opts.delete(:subcatalog_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('subcatalog_id', x, String))
end

Instance Attribute Details

#catalog_idObject (readonly)

Returns the value of attribute catalog_id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def catalog_id
  @catalog_id
end

#event_idObject (readonly)

Returns the value of attribute event_id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def event_id
  @event_id
end

#idObject (readonly)

Returns the value of attribute id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def id
  @id
end

#item_numberObject (readonly)

Returns the value of attribute item_number.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def item_number
  @item_number
end

#keyObject (readonly)

Returns the value of attribute key.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def key
  @key
end

#organizationObject (readonly)

Returns the value of attribute organization.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def organization
  @organization
end

#outcome_idObject (readonly)

Returns the value of attribute outcome_id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def outcome_id
  @outcome_id
end

#qObject (readonly)

Returns the value of attribute q.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def q
  @q
end

#subcatalog_idObject (readonly)

Returns the value of attribute subcatalog_id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def subcatalog_id
  @subcatalog_id
end

#targeting_idObject (readonly)

Returns the value of attribute targeting_id.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def targeting_id
  @targeting_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



31030
31031
31032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31030

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



31053
31054
31055
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31053

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

#subtype_to_hashObject



31057
31058
31059
31060
31061
31062
31063
31064
31065
31066
31067
31068
31069
31070
31071
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31057

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :id => id,
    :targeting_id => targeting_id,
    :item_number => item_number,
    :q => q,
    :outcome_id => outcome_id,
    :catalog_id => catalog_id,
    :key => key,
    :subcatalog_id => subcatalog_id
  }
end

#to_jsonObject



31049
31050
31051
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 31049

def to_json
  JSON.dump(to_hash)
end