Class: FyipeListener

Inherits:
Object
  • Object
show all
Defined in:
lib/fyipe/fyipeListener.rb

Instance Method Summary collapse

Constructor Details

#initialize(eventId, options) ⇒ FyipeListener



5
6
7
8
9
10
# File 'lib/fyipe/fyipeListener.rb', line 5

def initialize(eventId, options)
    # start the timeline manager
    @timelineObj = FyipeTimelineManager.new(options)
    @currentEventId = eventId
    @utilObj = Util.new(options)
end

Instance Method Details

#clearTimeline(eventId) ⇒ Object



35
36
37
38
39
40
# File 'lib/fyipe/fyipeListener.rb', line 35

def clearTimeline(eventId)
    # set a new eventId
    @currentEventId = eventId
    # this will reset the state of the timeline array
    return @timelineObj.clearTimeline()
end

#getTimelineObject



30
31
32
33
# File 'lib/fyipe/fyipeListener.rb', line 30

def getTimeline()
    # this always get the current state of the timeline array
    return @timelineObj.getTimeline()
end

#logCustomTimelineEvent(timelineObj) ⇒ Object



23
24
25
26
27
28
# File 'lib/fyipe/fyipeListener.rb', line 23

def logCustomTimelineEvent(timelineObj)
    timelineObj["eventId"] = @currentEventId

    # add timeline to the stack
    @timelineObj.addToTimeline(timelineObj)
end

#logErrorEvent(content, category = 'exception') ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/fyipe/fyipeListener.rb', line 12

def logErrorEvent(content, category = 'exception')
    timelineObj = {}
    timelineObj["category"]= category
    timelineObj["data"]= content
    timelineObj["type"]= @utilObj.getErrorType('ERROR')
    timelineObj["eventId"]= @currentEventId

    # add timeline to the stack
    @timelineObj.addToTimeline(timelineObj)
end