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
-
#asset_id ⇒ Object
(also: #device_id)
The asset the ticket is created for.
-
#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.
-
#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.
80 81 82 |
# File 'lib/nexpose/ticket.rb', line 80 def initialize(name, id) @id, @name = id, name end |
Instance Attribute Details
#asset_id ⇒ Object Also known as: device_id
The asset the ticket is created for.
59 60 61 |
# File 'lib/nexpose/ticket.rb', line 59 def asset_id @asset_id end |
#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 asset-id attribute.
65 66 67 |
# File 'lib/nexpose/ticket.rb', line 65 def assigned_to @assigned_to end |
#author ⇒ Object
The login name of the person who created the ticket.
72 73 74 |
# File 'lib/nexpose/ticket.rb', line 72 def @author end |
#created_on ⇒ Object
Date and time of ticket creation.
75 76 77 |
# File 'lib/nexpose/ticket.rb', line 75 def created_on @created_on 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.
69 70 71 |
# File 'lib/nexpose/ticket.rb', line 69 def priority @priority end |
#state ⇒ Object
The current status of the ticket.
78 79 80 |
# File 'lib/nexpose/ticket.rb', line 78 def state @state end |
Class Method Details
.parse(xml) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/nexpose/ticket.rb', line 84 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. = 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 |