Class: Nexpose::TicketSummary

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name) ⇒ TicketSummary

Returns a new instance of TicketSummary.



185
186
187
# File 'lib/nexpose/ticket.rb', line 185

def initialize(id, name)
  @id, @name = id, name
end

Instance Attribute Details

#assigned_toObject

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.



170
171
172
# File 'lib/nexpose/ticket.rb', line 170

def assigned_to
  @assigned_to
end

#authorObject

The login name of the person who created the ticket.



177
178
179
# File 'lib/nexpose/ticket.rb', line 177

def author
  @author
end

#created_onObject

Date and time of ticket creation.



180
181
182
# File 'lib/nexpose/ticket.rb', line 180

def created_on
  @created_on
end

#device_idObject

The asset the ticket is created for.



166
167
168
# File 'lib/nexpose/ticket.rb', line 166

def device_id
  @device_id
end

#idObject

The ID number of the ticket.



160
161
162
# File 'lib/nexpose/ticket.rb', line 160

def id
  @id
end

#nameObject

Ticket name.



163
164
165
# File 'lib/nexpose/ticket.rb', line 163

def name
  @name
end

#priorityObject

The relative priority of the ticket, assigned by the creator of the ticket.



174
175
176
# File 'lib/nexpose/ticket.rb', line 174

def priority
  @priority
end

#stateObject

The current status of the ticket.



183
184
185
# File 'lib/nexpose/ticket.rb', line 183

def state
  @state
end

Class Method Details

.parse(xml) ⇒ Object



189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/nexpose/ticket.rb', line 189

def self.parse(xml)
  ticket = new(xml.attributes['id'].to_i,
               xml.attributes['name'])
  ticket.device_id = xml.attributes['device-id'].to_i
  ticket.assigned_to = xml.attributes['assigned-to']
  ticket.priority = xml.attributes['priority']
  ticket.author = xml.attributes['author']
  ticket.created_on = DateTime::parse(xml.attributes['created-on'])
  lookup = Ticket::State.constants.reduce({}) { |a, e| a[Ticket::State.const_get(e)] = e; a }
  ticket.state = lookup[xml.attributes['state']]
  ticket
end