class Optimizely::SnapshotEvent

Attributes

entity_id[R]
key[R]
revenue[R]
tags[R]
timestamp[R]
uuid[R]
value[R]

Public Class Methods

new( entity_id:, uuid:, key:, timestamp:, revenue: nil, value: nil, tags: nil ) click to toggle source
# File lib/optimizely/event/entity/snapshot_event.rb, line 22
def initialize(
  entity_id:,
  uuid:,
  key:,
  timestamp:,
  revenue: nil,
  value: nil,
  tags: nil
)
  @entity_id = entity_id
  @uuid = uuid
  @key = key
  @timestamp = timestamp
  @revenue = revenue
  @value = value
  @tags = tags
end

Public Instance Methods

as_json() click to toggle source
# File lib/optimizely/event/entity/snapshot_event.rb, line 40
def as_json
  hash = {entity_id: @entity_id, uuid: @uuid, key: @key, timestamp: @timestamp}
  hash[:revenue] = @revenue unless @revenue.nil?
  hash[:value] = @value unless @value.nil?
  hash[:tags] = @tags unless @tags.nil?
  hash
end