Class: MMS::Resource::Alert
- Inherits:
-
MMS::Resource
- Object
- MMS::Resource
- MMS::Resource::Alert
- Defined in:
- lib/mms/resource/alert.rb
Instance Attribute Summary collapse
-
#acknowledged_until ⇒ Object
Returns the value of attribute acknowledged_until.
-
#created ⇒ Object
Returns the value of attribute created.
-
#current_value ⇒ Object
Returns the value of attribute current_value.
-
#event_type_name ⇒ Object
Returns the value of attribute event_type_name.
-
#last_notified ⇒ Object
Returns the value of attribute last_notified.
-
#name ⇒ Object
Returns the value of attribute name.
-
#resolved ⇒ Object
Returns the value of attribute resolved.
-
#status ⇒ Object
Returns the value of attribute status.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
-
#updated ⇒ Object
Returns the value of attribute updated.
Attributes inherited from MMS::Resource
Class Method Summary collapse
Instance Method Summary collapse
- #ack(time, description) ⇒ TrueClass, FalseClass
- #group ⇒ MMS::Resource::Group
- #table_row ⇒ Object
- #table_section ⇒ Object
Methods inherited from MMS::Resource
#_load, cache_key, find, #from_hash, #invalidate_cache, #to_hash
Instance Attribute Details
#acknowledged_until ⇒ Object
Returns the value of attribute acknowledged_until.
8 9 10 |
# File 'lib/mms/resource/alert.rb', line 8 def acknowledged_until @acknowledged_until end |
#created ⇒ Object
Returns the value of attribute created.
9 10 11 |
# File 'lib/mms/resource/alert.rb', line 9 def created @created end |
#current_value ⇒ Object
Returns the value of attribute current_value.
13 14 15 |
# File 'lib/mms/resource/alert.rb', line 13 def current_value @current_value end |
#event_type_name ⇒ Object
Returns the value of attribute event_type_name.
6 7 8 |
# File 'lib/mms/resource/alert.rb', line 6 def event_type_name @event_type_name end |
#last_notified ⇒ Object
Returns the value of attribute last_notified.
12 13 14 |
# File 'lib/mms/resource/alert.rb', line 12 def last_notified @last_notified end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/mms/resource/alert.rb', line 3 def name @name end |
#resolved ⇒ Object
Returns the value of attribute resolved.
11 12 13 |
# File 'lib/mms/resource/alert.rb', line 11 def resolved @resolved end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/mms/resource/alert.rb', line 7 def status @status end |
#type_name ⇒ Object
Returns the value of attribute type_name.
5 6 7 |
# File 'lib/mms/resource/alert.rb', line 5 def type_name @type_name end |
#updated ⇒ Object
Returns the value of attribute updated.
10 11 12 |
# File 'lib/mms/resource/alert.rb', line 10 def updated @updated end |
Class Method Details
._find(client, group_id, id) ⇒ Hash
52 53 54 |
# File 'lib/mms/resource/alert.rb', line 52 def self._find(client, group_id, id) client.get('/groups/' + group_id + '/alerts/' + id) end |
.table_header ⇒ Object
44 45 46 |
# File 'lib/mms/resource/alert.rb', line 44 def self.table_header ['Status', 'Group', 'Type', 'Event name', 'Created', 'Updated', 'Resolved', 'Last notified', 'Value'] end |
Instance Method Details
#ack(time, description) ⇒ TrueClass, FalseClass
23 24 25 26 27 28 29 30 |
# File 'lib/mms/resource/alert.rb', line 23 def ack(time, description) data = { acknowledgedUntil: time.to_i, acknowledgementComment: description } alert = @client.post '/groups/' + group.id + '/alerts/' + @id, data !alert.nil? end |
#group ⇒ MMS::Resource::Group
16 17 18 |
# File 'lib/mms/resource/alert.rb', line 16 def group MMS::Resource::Group.find(@client, @data['groupId']) end |
#table_row ⇒ Object
32 33 34 |
# File 'lib/mms/resource/alert.rb', line 32 def table_row [@status, group.name, @type_name, @event_type_name, @created, @updated, @resolved, @last_notified, JSON.dump(@current_value)] end |
#table_section ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/mms/resource/alert.rb', line 36 def table_section rows = [] rows << table_row rows << [{ value: "AlertId: #{@id} GroupId: #{group.id}", colspan: 9, alignment: :left }] rows << :separator rows end |