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.
125 126 127 128 129 |
# File 'lib/nexpose/tag.rb', line 125 def initialize(name, type, id) @name = name @type = type @id = id end |
Instance Attribute Details
#id ⇒ Object
ID of tag
117 118 119 |
# File 'lib/nexpose/tag.rb', line 117 def id @id end |
#name ⇒ Object
Name of tag
120 121 122 |
# File 'lib/nexpose/tag.rb', line 120 def name @name end |
#type ⇒ Object
One of Tag::Type::Generic
123 124 125 |
# File 'lib/nexpose/tag.rb', line 123 def type @type end |
Class Method Details
.parse(json) ⇒ Object
131 132 133 |
# File 'lib/nexpose/tag.rb', line 131 def self.parse(json) new(json['tag_name'], json['tag_type'], json['tag_id']) end |
.parse_xml(xml) ⇒ Object
135 136 137 |
# File 'lib/nexpose/tag.rb', line 135 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
143 144 145 146 147 148 149 |
# File 'lib/nexpose/tag.rb', line 143 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 |