Class: PrePlaySports::Event
- Inherits:
-
Object
- Object
- PrePlaySports::Event
- Defined in:
- lib/pre_play_sports/event.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#data ⇒ Object
Returns the value of attribute data.
-
#event_type ⇒ Object
Returns the value of attribute event_type.
Instance Method Summary collapse
-
#initialize(event_type, data, context) ⇒ Event
constructor
A new instance of Event.
- #to_scrolls_hash ⇒ Object
Constructor Details
#initialize(event_type, data, context) ⇒ Event
Returns a new instance of Event.
6 7 8 9 10 |
# File 'lib/pre_play_sports/event.rb', line 6 def initialize(event_type, data, context) @event_type = event_type @data = filter(data) @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
4 5 6 |
# File 'lib/pre_play_sports/event.rb', line 4 def context @context end |
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/pre_play_sports/event.rb', line 4 def data @data end |
#event_type ⇒ Object
Returns the value of attribute event_type.
4 5 6 |
# File 'lib/pre_play_sports/event.rb', line 4 def event_type @event_type end |
Instance Method Details
#to_scrolls_hash ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pre_play_sports/event.rb', line 12 def to_scrolls_hash event = { d: { type: event_type }.merge!(data), c: context, m: { dyno: $dyno_name, created_at: Time.now.to_s } } flatten_keys(event).merge!(preplay_event: true) end |