class Nexpose::TicketSummary

Summary of ticket information returned from a ticket listing request. For more details, issue a ticket detail request.

Attributes

asset_id[RW]

The asset the ticket is created for.

assigned_to[RW]

The login name of person to whom the ticket is assigned. The user must have view asset privilege on the asset specified in the asset-id attribute.

author[RW]

The login name of the person who created the ticket.

created_on[RW]

Date and time of ticket creation.

device_id[RW]

The asset the ticket is created for.

device_id=[RW]

The asset the ticket is created for.

id[RW]

The ID number of the ticket.

name[RW]

Ticket name.

priority[RW]

The relative priority of the ticket, assigned by the creator of the ticket. @see Nexpose::Ticket::Priority

state[RW]

The current status of the ticket.

Public Class Methods

new(name, id) click to toggle source
# File lib/nexpose/ticket.rb, line 80
def initialize(name, id)
  @id   = id
  @name = name
end
parse(xml) click to toggle source
# File lib/nexpose/ticket.rb, line 85
def self.parse(xml)
  ticket              = new(xml.attributes['name'], xml.attributes['id'].to_i)
  ticket.asset_id     = xml.attributes['device-id'].to_i
  ticket.assigned_to  = xml.attributes['assigned-to']
  lookup              = Ticket::Priority.constants.reduce({}) { |a, e| a[Ticket::Priority.const_get(e)] = e; a }
  ticket.priority     = lookup[xml.attributes['priority']]
  ticket.author       = xml.attributes['author']
  ticket.created_on   = DateTime.parse(xml.attributes['created-on']).to_time
  ticket.created_on -= ticket.created_on.gmt_offset
  lookup              = Ticket::State.constants.reduce({}) { |a, e| a[Ticket::State.const_get(e)] = e; a }
  ticket.state        = lookup[xml.attributes['state']]
  ticket
end