class Nexpose::Ticket::Event

Attributes

author[R]

The login name of the person responsible for the event.

comment[RW]

Comment on the ticket event.

created_on[R]

Date and time of the ticket event.

description[RW]

Description of the ticket event.

state[R]

The status of the ticket at the time the event was recorded.

Public Class Methods

new(state, author, created) click to toggle source
# File lib/nexpose/ticket.rb, line 235
def initialize(state, author, created)
  @state   = state
  @author  = author
  @created = created
end
parse(xml) click to toggle source
# File lib/nexpose/ticket.rb, line 241
def self.parse(xml)
  author        = 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, author, created_on)

  comment       = REXML::XPath.first(xml, 'Comment')
  event.comment = comment.text if comment

  event.description = desc if desc
  event
end