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 |
# File 'lib/nexpose/tag.rb', line 125 def initialize(name, type, id) @name, @type, @id = name, type, 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
129 130 131 |
# File 'lib/nexpose/tag.rb', line 129 def self.parse(json) new(json['tag_name'], json['tag_type'], json['tag_id']) end |
.parse_xml(xml) ⇒ Object
133 134 135 |
# File 'lib/nexpose/tag.rb', line 133 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
141 142 143 144 145 146 147 |
# File 'lib/nexpose/tag.rb', line 141 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 |