Net::Trac::Ticket(3pm) User Contributed Perl Documentation Net::Trac::Ticket(3pm)NAME
Net::Trac::Ticket - Create, read, and update tickets on a remote Trac instance
SYNOPSIS
my $ticket = Net::Trac::Ticket->new( connection => $trac );
$ticket->load( 1 );
print $ticket->summary, "
";
DESCRIPTION
This class represents a ticket on a remote Trac instance. It provides methods for creating, reading, and updating tickets and their
history as well as adding comments and getting attachments.
timestamp_to_datetime $stamp
Accept's a timestamp in Trac's somewhat idiosyncratic format and returns a DateTime object
METHODS
new HASH
Takes a key "connection" with a value of a Net::Trac::Connection. Returns an empty ticket object.
load ID
Loads up the ticket with the specified ID. Returns the ticket ID loaded on success and undef on failure.
load_from_hashref HASHREF [SKIP]
You should never need to use this method yourself. Loads a ticket from a hashref of data, optionally skipping metadata loading (values of
"valid_*" accessors).
create HASH
Creates and loads a new ticket with the values specified. Returns undef on failure and the new ticket ID on success.
update HASH
Updates the current ticket with the specified values.
Returns undef on failure, and the ID of the current ticket on success.
comment TEXT
Adds a comment to the current ticket. Returns undef on failure, true on success.
history
Returns a Net::Trac::TicketHistory object for this ticket.
comments
Returns an array or arrayref (depending on context) of history entries which have comments included. This will include history entries
representing attachments if they have descriptions.
attach PARAMHASH
Attaches the specified "file" with an optional "description". Returns undef on failure and the new Net::Trac::TicketAttachment object on
success.
attachments
Returns an array or arrayref (depending on context) of all the Net::Trac::TicketAttachment objects for this ticket.
ACCESSORS
connection
id
summary
type
status
priority
severity
resolution
owner
reporter
cc
description
keywords
component
milestone
version
created
Returns a DateTime object
last_modified
Returns a DateTime object
basic_statuses
Returns a list of the basic statuses available for a ticket. Others may be defined by the remote Trac instance, but we have no way of
easily getting them.
valid_props
Returns a list of the valid properties of a ticket.
add_custom_props
Adds custom properties to valid properties list.
valid_create_props
Returns a list of the valid properties specifiable when creating a ticket.
valid_update_props
Returns a list of the valid updatable properties.
Valid property values
These accessors are loaded from the remote Trac instance with the valid values for the properties upon instantiation of a ticket object.
valid_milestones
valid_types
valid_components
valid_priorities
valid_resolutions - Only loaded when a ticket is loaded.
valid_severities - May not be provided by the Trac instance.
LICENSE
Copyright 2008-2009 Best Practical Solutions.
This package is licensed under the same terms as Perl 5.8.8.
perl v5.12.3 2011-04-02 Net::Trac::Ticket(3pm)
Check Out this Related Man Page
RT::Client::REST::Ticket(3pm) User Contributed Perl Documentation RT::Client::REST::Ticket(3pm)NAME
RT::Client::REST::Ticket -- this object represents a ticket.
SYNOPSIS
my $rt = RT::Client::REST->new(server => $ENV{RTSERVER});
# Create a new ticket:
my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
queue => "General",
subject => $subject,
)->store(text => "This is the initial text of the ticket");
print "Created a new ticket, ID ", $ticket->id, "
";
# Update
my $ticket = RT::Client::REST::Ticket->new(
rt => $rt,
id => $id,
priority => 10,
)->store;
# Retrieve
my $ticket => RT::Client::REST::Ticket->new(
rt => $rt,
id => $id,
)->retrieve;
unless ($ticket->owner eq $me) {
$ticket->steal; # Give me more work!
}
DESCRIPTION
RT::Client::REST::Ticket is based on RT::Client::REST::Object. The representation allows one to retrieve, edit, comment on, and create
tickets in RT.
ATTRIBUTES
id
This is the numeric ID of the ticket.
queue
This is the name of the queue (not numeric id).
owner
Username of the owner.
creator
Username of RT user who created the ticket.
subject
Subject of the ticket.
status
The status is usually one of the following: "new", "open", "resolved", "stalled", "rejected", and "deleted". However, custom RT
installations sometimes add their own statuses.
priority
Ticket priority. Usually a numeric value.
initial_priority
final_priority
requestor
This is the attribute for setting the requestor on ticket creation. If you use requestors to do this in 3.8, the recipient may not
receive an autoreply from RT because the ticket is initially created as the user your REST session is connected as.
It is a list attribute (for explanation of list attributes, see LIST ATTRIBUTE PROPERTIES in RT::Client::REST::Object).
requestors
This contains e-mail addresses of the requestors.
It is a list attribute (for explanation of list attributes, see LIST ATTRIBUTE PROPERTIES in RT::Client::REST::Object).
cc
A list of e-mail addresses used to notify people of 'correspond' actions.
admin_cc
A list of e-mail addresses used to notify people of all actions performed on a ticket.
created
Time at which ticket was created. Note that this is an immutable field and therefore the value cannot be changed..
starts
started
due
resolved
told
time_estimated
time_worked
time_left
last_updated
DB METHODS
For full explanation of these, please see "DB METHODS" in RT::Client::REST::Object documentation.
retrieve
Retrieve RT ticket from database.
store ([text => $text])
Create or update the ticket. When creating a new ticket, optional 'text' parameter can be supplied to set the initial text of the
ticket.
search
Search for tickets that meet specific conditions.
TICKET-SPECIFIC METHODS
comment (message => $message, %opts)
Comment on this ticket with message $message. %opts is a list of key-value pairs as follows:
attachments
List of filenames (an array reference) that should be attached to the ticket along with the comment.
cc
List of e-mail addresses to send carbon copies to (an array reference).
bcc
List of e-mail addresses to send blind carbon copies to (an array reference).
correspond (message => $message, %opts)
Add correspondence to the ticket. Takes exactly the same arguments as the comment method above.
attachments
Get attachments associated with this ticket. What is returned is an object of type RT::Client::REST::SearchResult which can then be used
to get at objects of type RT::Client::REST::Attachment.
transactions
Get transactions associated with this ticket. Optionally, you can specify exactly what types of transactions you want listed, for
example:
my $result = $ticket->transactions(type => [qw(Comment Correspond)]);
Please reference RT::Client::REST documentation for the full list of valid transaction types.
Return value is an object of type RT::Client::REST::SearchResult which can then be used to iterate over transaction objects
(RT::Client::REST::Transaction).
take
Take this ticket. If you already the owner of this ticket, "RT::Client::REST::Object::NoopOperationException" will be thrown.
untake
Untake this ticket. If Nobody is already the owner of this ticket, "RT::Client::REST::Object::NoopOperationException" will be thrown.
steal
Steal this ticket. If you already the owner of this ticket, "RT::Client::REST::Object::NoopOperationException" will be thrown.
CUSTOM FIELDS
This class inherits 'cf' method from RT::Client::REST::Object. To create a ticket with a bunch of custom fields, use the following
approach:
RT::Client::REST::Ticket->new(
rt => $rt,
# blah blah
cf => {
'field one' => $value1,
'field two' => $another_value,
},
)->store;
Some more examples:
# Update a custom field value:
$ticket->cf('field one' => $value1);
$ticket->store;
# Get a custom field value:
my $another value = $ticket->cf('field two');
# Get a list of ticket's custom field names:
my @custom_fields = $ticket->cf;
INTERNAL METHODS
rt_type
Returns 'ticket'.
SEE ALSO
RT::Client::REST, RT::Client::REST::Object, RT::Client::REST::Attachment, RT::Client::REST::SearchResult, RT::Client::REST::Transaction.
AUTHOR
Dmitri Tikhonov <dtikhonov@yahoo.com>
LICENSE
Perl license with the exception of RT::Client::REST, which is GPLed.
perl v5.14.2 2012-01-20 RT::Client::REST::Ticket(3pm)