Class: Nexpose::Ticket::Event
- Inherits:
-
Object
- Object
- Nexpose::Ticket::Event
- Defined in:
- lib/nexpose/ticket.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
The login name of the person responsible for the event.
-
#comment ⇒ Object
Comment on the ticket event.
-
#created_on ⇒ Object
readonly
Date and time of the ticket event.
-
#description ⇒ Object
Description of the ticket event.
-
#state ⇒ Object
readonly
The status of the ticket at the time the event was recorded.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(state, author, created) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(state, author, created) ⇒ Event
Returns a new instance of Event.
234 235 236 |
# File 'lib/nexpose/ticket.rb', line 234 def initialize(state, , created) @state, @author, @created = state, , created end |
Instance Attribute Details
#author ⇒ Object (readonly)
The login name of the person responsible for the event.
226 227 228 |
# File 'lib/nexpose/ticket.rb', line 226 def @author end |
#comment ⇒ Object
Comment on the ticket event.
232 233 234 |
# File 'lib/nexpose/ticket.rb', line 232 def comment @comment end |
#created_on ⇒ Object (readonly)
Date and time of the ticket event.
224 225 226 |
# File 'lib/nexpose/ticket.rb', line 224 def created_on @created_on end |
#description ⇒ Object
Description of the ticket event.
230 231 232 |
# File 'lib/nexpose/ticket.rb', line 230 def description @description end |
#state ⇒ Object (readonly)
The status of the ticket at the time the event was recorded.
228 229 230 |
# File 'lib/nexpose/ticket.rb', line 228 def state @state end |
Class Method Details
.parse(xml) ⇒ Object
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/nexpose/ticket.rb', line 238 def self.parse(xml) = xml.attributes['author'] created_on = DateTime.parse(xml.attributes['created-on']).to_time created_on -= created_on.gmt_offset event = REXML::XPath.first(xml, 'Event') lookup = Ticket::State.constants.reduce({}) { |a, e| a[Ticket::State.const_get(e)] = e; a } state = lookup[event.attributes['state']] desc = event.text event = new(state, , created_on) comment = REXML::XPath.first(xml, 'Comment') event.comment = comment.text if comment event.description = desc if desc event end |