Class: NetuitiveD::IngestEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/netuitived/ingest_event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elementId, message, timestamp, title, level, source, type, tags) ⇒ IngestEvent

Returns a new instance of IngestEvent.



4
5
6
7
8
9
10
11
12
13
# File 'lib/netuitived/ingest_event.rb', line 4

def initialize(elementId, message, timestamp, title, level, source, type, tags)
  @source = source
  @timestamp = timestamp
  @title = title
  @type = type
  @tags = tags
  @data = { 'elementId' => elementId,
            'level' => level,
            'message' => message }
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def data
  @data
end

#sourceObject

Returns the value of attribute source.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def source
  @source
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def tags
  @tags
end

#timestampObject

Returns the value of attribute timestamp.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def timestamp
  @timestamp
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def title
  @title
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/netuitived/ingest_event.rb', line 3

def type
  @type
end

Instance Method Details

#to_json(_options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/netuitived/ingest_event.rb', line 15

def to_json(_options = {})
  millis = @timestamp.to_f * 1000
  { 'source' => @source,
    'timestamp' => millis.round,
    'title' => @title,
    'type' => @type,
    'tags' => @tags,
    'data' => @data }.to_json.tr('\\"', '"')
end