Class: RisingDragon::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/rising_dragon/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, type:, timestamp:, data:) ⇒ Event

Returns a new instance of Event.



4
5
6
7
8
9
# File 'lib/rising_dragon/event.rb', line 4

def initialize(id:, type:, timestamp:, data:)
  @id = id
  @type = type
  @timestamp = timestamp
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/rising_dragon/event.rb', line 3

def data
  @data
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/rising_dragon/event.rb', line 3

def id
  @id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



3
4
5
# File 'lib/rising_dragon/event.rb', line 3

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/rising_dragon/event.rb', line 3

def type
  @type
end

Instance Method Details

#to_json(*option) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rising_dragon/event.rb', line 11

def to_json(*option)
  {
    id: @id,
    type: @type,
    timestamp: @timestamp,
    data: @data,
  }.to_json(*option)
end