Class: Nexpose::TagSummary
- Inherits:
-
Object
- Object
- Nexpose::TagSummary
- Defined in:
- lib/nexpose/tag.rb
Overview
Summary value object for tag information
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
ID of tag.
-
#name ⇒ Object
Name of tag.
-
#type ⇒ Object
One of Tag::Type::Generic.
Class Method Summary collapse
Instance Method Summary collapse
-
#as_xml ⇒ ELEMENT
XML representation of the tag summary as required by Site and AssetGroup.
-
#initialize(name, type, id) ⇒ TagSummary
constructor
A new instance of TagSummary.
Constructor Details
#initialize(name, type, id) ⇒ TagSummary
Returns a new instance of TagSummary.
124 125 126 |
# File 'lib/nexpose/tag.rb', line 124 def initialize(name, type, id) @name, @type, @id = name, type, id end |
Instance Attribute Details
#id ⇒ Object
ID of tag
116 117 118 |
# File 'lib/nexpose/tag.rb', line 116 def id @id end |
#name ⇒ Object
Name of tag
119 120 121 |
# File 'lib/nexpose/tag.rb', line 119 def name @name end |
#type ⇒ Object
One of Tag::Type::Generic
122 123 124 |
# File 'lib/nexpose/tag.rb', line 122 def type @type end |
Class Method Details
.parse(json) ⇒ Object
128 129 130 |
# File 'lib/nexpose/tag.rb', line 128 def self.parse(json) new(json['tag_name'], json['tag_type'], json['tag_id']) end |
.parse_xml(xml) ⇒ Object
132 133 134 |
# File 'lib/nexpose/tag.rb', line 132 def self.parse_xml(xml) new(xml.attributes['name'], xml.attributes['type'], xml.attributes['id'].to_i) end |
Instance Method Details
#as_xml ⇒ ELEMENT
XML representation of the tag summary as required by Site and AssetGroup
140 141 142 143 144 145 146 |
# File 'lib/nexpose/tag.rb', line 140 def as_xml xml = REXML::Element.new('Tag') xml.add_attribute('id', @id) xml.add_attribute('name', @name) xml.add_attribute('type', @type) xml end |