[Bps-public-commit] net-lighthouse branch, master, updated. a0a3215e6181767eaf1b635bb7e0e2e6c80dc2cc

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Sep 1 04:56:41 EDT 2009


The branch, master has been updated
       via  a0a3215e6181767eaf1b635bb7e0e2e6c80dc2cc (commit)
      from  c910a5c62b0b1c47e523b45b73d882857f80e12d (commit)

Summary of changes:
 lib/Net/Lighthouse/Project.pm |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit a0a3215e6181767eaf1b635bb7e0e2e6c80dc2cc
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 1 16:56:30 2009 +0800

    implement project->ticket,ticket_bin...

diff --git a/lib/Net/Lighthouse/Project.pm b/lib/Net/Lighthouse/Project.pm
index b7b0654..85bfa39 100644
--- a/lib/Net/Lighthouse/Project.pm
+++ b/lib/Net/Lighthouse/Project.pm
@@ -243,6 +243,30 @@ sub messages { return shift->_list( 'Message' ) }
 sub milestones { return shift->_list( 'Milestone' ) }
 sub changesets { return shift->_list( 'Changeset' ) }
 
+sub ticket { return shift->_new( 'Ticket' ) }
+sub ticket_bin { return shift->_new( 'TicketBin' ) }
+sub message { return shift->_new( 'Message' ) }
+sub milestone { return shift->_new( 'Milestone' ) }
+sub changeset { return shift->_new( 'Changeset' ) }
+
+sub _new {
+    my $self = shift;
+    validate_pos(
+        @_,
+        {
+            type  => SCALAR,
+            regex => qr/^(TicketBin|Ticket|Message|Changeset|Milestone)$/,
+        }
+    );
+    my $class  = 'Net::Lighthouse::Project::' . shift;
+    my $object = $class->new(
+        project_id => $self->id,
+        map { $_ => $self->$_ }
+          grep { $self->$_ } qw/account email password token/
+    );
+    return $object;
+}
+
 sub _list {
     my $self = shift;
     validate_pos(

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list