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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ TargetingItemUpserted

Returns a new instance of TargetingItemUpserted.



16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16775

def initialize(incoming={})
  super(:name => Event::Types::TARGETING_ITEM_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :catalog, :number, :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)
  @catalog = HttpClient::Preconditions.assert_class('catalog', opts.delete(:catalog), String)
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
end

Instance Attribute Details

#catalogObject (readonly)

Returns the value of attribute catalog.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def catalog
  @catalog
end

#event_idObject (readonly)

Returns the value of attribute event_id.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def event_id
  @event_id
end

#keyObject (readonly)

Returns the value of attribute key.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def key
  @key
end

#numberObject (readonly)

Returns the value of attribute number.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def number
  @number
end

#organizationObject (readonly)

Returns the value of attribute organization.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def organization
  @organization
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



16773
16774
16775
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16773

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



16791
16792
16793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16791

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

#subtype_to_hashObject



16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16795

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :catalog => catalog,
    :number => number,
    :key => key
  }
end

#to_jsonObject



16787
16788
16789
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16787

def to_json
  JSON.dump(to_hash)
end