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, find, #from_hash, #invalidate_cache, #set_client, #set_data, #to_hash
Instance Attribute Details
#acknowledged_until ⇒ Object
Returns the value of attribute acknowledged_until.
10 11 12 |
# File 'lib/mms/resource/alert.rb', line 10 def acknowledged_until @acknowledged_until end |
#created ⇒ Object
Returns the value of attribute created.
11 12 13 |
# File 'lib/mms/resource/alert.rb', line 11 def created @created end |
#current_value ⇒ Object
Returns the value of attribute current_value.
15 16 17 |
# File 'lib/mms/resource/alert.rb', line 15 def current_value @current_value end |
#event_type_name ⇒ Object
Returns the value of attribute event_type_name.
8 9 10 |
# File 'lib/mms/resource/alert.rb', line 8 def event_type_name @event_type_name end |
#last_notified ⇒ Object
Returns the value of attribute last_notified.
14 15 16 |
# File 'lib/mms/resource/alert.rb', line 14 def last_notified @last_notified end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/mms/resource/alert.rb', line 5 def name @name end |
#resolved ⇒ Object
Returns the value of attribute resolved.
13 14 15 |
# File 'lib/mms/resource/alert.rb', line 13 def resolved @resolved end |
#status ⇒ Object
Returns the value of attribute status.
9 10 11 |
# File 'lib/mms/resource/alert.rb', line 9 def status @status end |
#type_name ⇒ Object
Returns the value of attribute type_name.
7 8 9 |
# File 'lib/mms/resource/alert.rb', line 7 def type_name @type_name end |
#updated ⇒ Object
Returns the value of attribute updated.
12 13 14 |
# File 'lib/mms/resource/alert.rb', line 12 def updated @updated end |
Class Method Details
._find(client, group_id, id) ⇒ Hash
55 56 57 |
# File 'lib/mms/resource/alert.rb', line 55 def self._find(client, group_id, id) client.get('/groups/' + group_id + '/alerts/' + id) end |
.table_header ⇒ Object
47 48 49 |
# File 'lib/mms/resource/alert.rb', line 47 def self.table_header ['Status', 'Group', 'Type', 'Event name', 'Created', 'Updated', 'Resolved', 'Last notified', 'Value'] end |
Instance Method Details
#ack(time, description) ⇒ TrueClass, FalseClass
26 27 28 29 30 31 32 33 |
# File 'lib/mms/resource/alert.rb', line 26 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
18 19 20 |
# File 'lib/mms/resource/alert.rb', line 18 def group MMS::Resource::Group.find(@client, @data['groupId']) end |
#table_row ⇒ Object
35 36 37 |
# File 'lib/mms/resource/alert.rb', line 35 def table_row [@status, group.name, @type_name, @event_type_name, @created, @updated, @resolved, @last_notified, JSON.dump(@current_value)] end |
#table_section ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/mms/resource/alert.rb', line 39 def table_section rows = [] rows << table_row rows << [{:value => "AlertId: #{@id} GroupId: #{group.id}", :colspan => 9, :alignment => :left}] rows << :separator rows end |