Class: Optimizely::Snapshot

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(events:, decisions: nil) ⇒ Snapshot

Returns a new instance of Snapshot.



22
23
24
25
# File 'lib/optimizely/event/entity/snapshot.rb', line 22

def initialize(events:, decisions: nil)
  @decisions = decisions
  @events = events
end

Instance Attribute Details

#decisionsObject (readonly)

Returns the value of attribute decisions.



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

def decisions
  @decisions
end

#eventsObject (readonly)

Returns the value of attribute events.



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

def events
  @events
end

Instance Method Details

#as_jsonObject



27
28
29
30
31
# File 'lib/optimizely/event/entity/snapshot.rb', line 27

def as_json
  hash = {events: @events}
  hash[:decisions] = @decisions unless @decisions.nil?
  hash
end