Class: Nexpose::SNMPAlert

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/alert.rb

Overview

SNMP Alert This class should only exist as an element of an Alert.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#communityObject

The community string



174
175
176
# File 'lib/nexpose/alert.rb', line 174

def community
  @community
end

#serverObject

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_xmlObject



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_xmlObject



195
196
197
# File 'lib/nexpose/alert.rb', line 195

def to_xml
  as_xml.to_s
end