Class: Nexpose::SNMPAlert
- Inherits:
-
Object
- Object
- Nexpose::SNMPAlert
- Defined in:
- lib/nexpose/alert.rb
Overview
SNMP Alert This class should only exist as an element of an Alert.
Instance Attribute Summary collapse
-
#community ⇒ Object
The community string.
-
#server ⇒ Object
The server to sent this alert.
Class Method Summary collapse
Instance Method Summary collapse
- #as_xml ⇒ Object
-
#initialize(community, server) ⇒ SNMPAlert
constructor
A new instance of SNMPAlert.
- #to_xml ⇒ Object
Constructor Details
#initialize(community, server) ⇒ SNMPAlert
Returns a new instance of SNMPAlert.
179 180 181 182 |
# File 'lib/nexpose/alert.rb', line 179 def initialize(community, server) @community = community @server = server end |
Instance Attribute Details
#community ⇒ Object
The community string
174 175 176 |
# File 'lib/nexpose/alert.rb', line 174 def community @community end |
#server ⇒ Object
The server to sent this alert
177 178 179 |
# File 'lib/nexpose/alert.rb', line 177 def server @server end |
Class Method Details
.parse(xml) ⇒ Object
184 185 186 |
# File 'lib/nexpose/alert.rb', line 184 def self.parse(xml) new(xml.attributes['community'], xml.attributes['server']) end |
Instance Method Details
#as_xml ⇒ Object
188 189 190 191 192 193 |
# File 'lib/nexpose/alert.rb', line 188 def as_xml xml = REXML::Element.new('snmpAlert') xml.attributes['community'] = @community xml.attributes['server'] = @server xml end |
#to_xml ⇒ Object
195 196 197 |
# File 'lib/nexpose/alert.rb', line 195 def to_xml as_xml.to_s end |