Class: Nexpose::TicketSummary
- Inherits:
-
Object
- Object
- Nexpose::TicketSummary
- Defined in:
- lib/nexpose/ticket.rb
Overview
Summary of ticket information returned from a ticket listing request. For more details, issue a ticket detail request.
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary collapse
-
#assigned_to ⇒ Object
The login name of person to whom the ticket is assigned.
-
#author ⇒ Object
The login name of the person who created the ticket.
-
#created_on ⇒ Object
Date and time of ticket creation.
-
#device_id ⇒ Object
The asset the ticket is created for.
-
#id ⇒ Object
The ID number of the ticket.
-
#name ⇒ Object
Ticket name.
-
#priority ⇒ Object
The relative priority of the ticket, assigned by the creator of the ticket.
-
#state ⇒ Object
The current status of the ticket.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, id) ⇒ TicketSummary
constructor
A new instance of TicketSummary.
Constructor Details
#initialize(name, id) ⇒ TicketSummary
Returns a new instance of TicketSummary.
78 79 80 |
# File 'lib/nexpose/ticket.rb', line 78 def initialize(name, id) @id, @name = id, name end |
Instance Attribute Details
#assigned_to ⇒ Object
The login name of person to whom the ticket is assigned. The user must have view asset privilege on the asset specified in the device-id attribute.
63 64 65 |
# File 'lib/nexpose/ticket.rb', line 63 def assigned_to @assigned_to end |
#author ⇒ Object
The login name of the person who created the ticket.
70 71 72 |
# File 'lib/nexpose/ticket.rb', line 70 def @author end |
#created_on ⇒ Object
Date and time of ticket creation.
73 74 75 |
# File 'lib/nexpose/ticket.rb', line 73 def created_on @created_on end |
#device_id ⇒ Object
The asset the ticket is created for.
59 60 61 |
# File 'lib/nexpose/ticket.rb', line 59 def device_id @device_id end |
#id ⇒ Object
The ID number of the ticket.
53 54 55 |
# File 'lib/nexpose/ticket.rb', line 53 def id @id end |
#name ⇒ Object
Ticket name.
56 57 58 |
# File 'lib/nexpose/ticket.rb', line 56 def name @name end |
#priority ⇒ Object
The relative priority of the ticket, assigned by the creator of the ticket.
67 68 69 |
# File 'lib/nexpose/ticket.rb', line 67 def priority @priority end |
#state ⇒ Object
The current status of the ticket.
76 77 78 |
# File 'lib/nexpose/ticket.rb', line 76 def state @state end |
Class Method Details
.parse(xml) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/nexpose/ticket.rb', line 82 def self.parse(xml) ticket = new(xml.attributes['name'], xml.attributes['id'].to_i) ticket.device_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. = 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 |