Class: Zenoss::Events::Event
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Zenoss::Events::Event
- Defined in:
- lib/zenoss/events/event.rb
Direct Known Subclasses
Instance Method Summary collapse
- #acknowledge ⇒ Object
-
#convert_time(time) ⇒ Object
Converts a string or float to a Time object Zenoss version 4 emits the time format as a string Zenoss version 6 emits the time as a float @return.
- #detail(history = false) ⇒ Object
- #initialize(zenoss, zhash) ⇒ Event constructor
Constructor Details
#initialize(zenoss, zhash) ⇒ Event
28 29 30 31 32 33 |
# File 'lib/zenoss/events/event.rb', line 28 def initialize(zenoss,zhash) @zenoss = zenoss super zhash self.firstTime &&= convert_time(self.firstTime) self.lastTime &&= convert_time(self.lastTime) end |
Instance Method Details
#acknowledge ⇒ Object
59 60 |
# File 'lib/zenoss/events/event.rb', line 59 def acknowledge end |
#convert_time(time) ⇒ Object
Converts a string or float to a Time object Zenoss version 4 emits the time format as a string Zenoss version 6 emits the time as a float @return
39 40 41 42 43 44 45 |
# File 'lib/zenoss/events/event.rb', line 39 def convert_time(time) if time.is_a?(String) Time.parse(time) else Time.at(time) end end |
#detail(history = false) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/zenoss/events/event.rb', line 47 def detail(history = false) data = { :evid => self.evid, :history => history, } resp = @zenoss.json_request('EventsRouter', 'detail', [data]) resp['event'].first.each_pair do |k,v| self.new_ostruct_member(k) @table[k.to_sym] = v end end |