Class: Optimizely::SnapshotEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/optimizely/event/entity/snapshot_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity_id:, uuid:, key:, timestamp:, revenue: nil, value: nil, tags: nil) ⇒ SnapshotEvent

Returns a new instance of SnapshotEvent.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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

Instance Attribute Details

#entity_idObject (readonly)

Returns the value of attribute entity_id.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def entity_id
  @entity_id
end

#keyObject (readonly)

Returns the value of attribute key.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def key
  @key
end

#revenueObject (readonly)

Returns the value of attribute revenue.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def revenue
  @revenue
end

#tagsObject (readonly)

Returns the value of attribute tags.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def tags
  @tags
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def timestamp
  @timestamp
end

#uuidObject (readonly)

Returns the value of attribute uuid.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def uuid
  @uuid
end

#valueObject (readonly)

Returns the value of attribute value.



20
21
22
# File 'lib/optimizely/event/entity/snapshot_event.rb', line 20

def value
  @value
end

Instance Method Details

#as_jsonObject



40
41
42
43
44
45
46
# 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