[Bps-public-commit] r17534 - in Net-Trac/trunk: .
trs at bestpractical.com
trs at bestpractical.com
Fri Jan 2 16:32:01 EST 2009
Author: trs
Date: Fri Jan 2 16:32:01 2009
New Revision: 17534
Modified:
Net-Trac/trunk/ (props changed)
Net-Trac/trunk/TODO
Net-Trac/trunk/lib/Net/Trac/Ticket.pm
Net-Trac/trunk/lib/Net/Trac/TicketHistory.pm
Log:
r43410 at zot: tom | 2009-01-02 16:23:36 -0500
change the way ticket history is loaded (provide an id to ->load rather than ->new)
Modified: Net-Trac/trunk/TODO
==============================================================================
--- Net-Trac/trunk/TODO (original)
+++ Net-Trac/trunk/TODO Fri Jan 2 16:32:01 2009
@@ -11,3 +11,5 @@
Get history from RSS feed for a ticket
+
+add test plans
Modified: Net-Trac/trunk/lib/Net/Trac/Ticket.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/Ticket.pm (original)
+++ Net-Trac/trunk/lib/Net/Trac/Ticket.pm Fri Jan 2 16:32:01 2009
@@ -256,9 +256,8 @@
sub history {
my $self = shift;
- my $hist = Net::Trac::TicketHistory->new(
- { connection => $self->connection, ticket => $self->id } );
- $hist->load;
+ my $hist = Net::Trac::TicketHistory->new({ connection => $self->connection });
+ $hist->load( $self->id );
return $hist;
}
Modified: Net-Trac/trunk/lib/Net/Trac/TicketHistory.pm
==============================================================================
--- Net-Trac/trunk/lib/Net/Trac/TicketHistory.pm (original)
+++ Net-Trac/trunk/lib/Net/Trac/TicketHistory.pm Fri Jan 2 16:32:01 2009
@@ -1,37 +1,34 @@
package Net::Trac::TicketHistory;
-use Net::Trac::TicketHistoryEntry;
+
use Moose;
+use Params::Validate qw(:all);
+use Net::Trac::TicketHistoryEntry;
has connection => (
isa => 'Net::Trac::Connection',
is => 'ro'
);
-has ticket => (
- isa => 'Str',
- is => 'ro'
-);
-
-has entries => (
- isa => 'ArrayRef',
- is => 'rw'
-);
+has ticket => ( isa => 'Str', is => 'rw' );
+has entries => ( isa => 'ArrayRef', is => 'rw' );
sub load {
my $self = shift;
- my $feed = $self->connection->_fetch_feed(
- "/ticket/" . $self->ticket . "?format=rss" );
+ my ($id) = validate_pos( @_, { type => SCALAR } );
+
+ $self->ticket( $id );
+
+ my $feed = $self->connection->_fetch_feed( "/ticket/$id?format=rss" )
+ or return;
my @entries = $feed->entries;
my @history;
foreach my $entry (@entries) {
- my $e = Net::Trac::TicketHistoryEntry->new(
- { connection => $self->connection } );
+ my $e = Net::Trac::TicketHistoryEntry->new({ connection => $self->connection });
$e->parse_feed_entry($entry);
push @history, $e;
}
- # http://barnowl.mit.edu/ticket/1?format=rss
$self->entries( \@history );
return 1;
}
@@ -46,7 +43,7 @@
=head1 METHODS
-=head2 load
+=head2 load ID
=head2 entries
More information about the Bps-public-commit
mailing list