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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Sep 7 03:56:03 EDT 2009


The branch, master has been updated
       via  fc4d8485d6853942b38b4bc4ef17d2be87619d31 (commit)
      from  84e809f4ee9627101a33c7e1249553ff05550df8 (commit)

Summary of changes:
 lib/Net/Lighthouse.pm                   |   41 ++++---------------------------
 lib/Net/Lighthouse/Project.pm           |    2 +-
 lib/Net/Lighthouse/Project/Changeset.pm |    2 +-
 lib/Net/Lighthouse/Project/Message.pm   |    2 +-
 lib/Net/Lighthouse/Project/Milestone.pm |    2 +-
 lib/Net/Lighthouse/Project/Ticket.pm    |    2 +-
 lib/Net/Lighthouse/Project/TicketBin.pm |    2 +-
 lib/Net/Lighthouse/Token.pm             |    2 +-
 lib/Net/Lighthouse/User.pm              |    2 +-
 t/02-project.t                          |    2 +-
 t/03-ticket.t                           |    2 +-
 t/06-user.t                             |    2 +-
 t/09-milestone.t                        |    2 +-
 t/10-changeset.t                        |    2 +-
 t/11-message.t                          |    2 +-
 t/12-ticket-bin.t                       |    2 +-
 16 files changed, 20 insertions(+), 51 deletions(-)

- Log -----------------------------------------------------------------
commit fc4d8485d6853942b38b4bc4ef17d2be87619d31
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Sep 7 15:55:59 2009 +0800

    update for the new added Base.pm

diff --git a/lib/Net/Lighthouse.pm b/lib/Net/Lighthouse.pm
index daf1721..8f4b838 100644
--- a/lib/Net/Lighthouse.pm
+++ b/lib/Net/Lighthouse.pm
@@ -1,46 +1,15 @@
 package Net::Lighthouse;
 
-use Any::Moose;
 use MIME::Base64;
 use LWP::UserAgent;
+use Params::Validate ':all';
+use Net::Lighthouse::Project;
+use Net::Lighthouse::Token;
+use Net::Lighthouse::User;
+use base 'Net::Lighthouse::Base';
 
 our $VERSION = '0.01';
 
-has 'account' => (
-    isa => 'Str',
-    is  => 'ro',
-);
-
-has [ 'email', 'password', 'token' ] => (
-    isa => 'Str',
-    is  => 'rw',
-);
-
-no Any::Moose;
-__PACKAGE__->meta->make_immutable;
-
-sub base_url {
-    my $self = shift;
-    return 'http://' . $self->account . '.lighthouseapp.com';
-}
-
-sub ua {
-    my $self = shift;
-    my $ua = LWP::UserAgent->new( agent => 'net-lighthouse/' . $VERSION );
-    $ua->default_header( 'Content-Type' => 'application/xml' );
-    # email and password have high priority
-    if ( $self->email && $self->password ) {
-        my $base64 = encode_base64( $self->email . ':' . $self->password );
-        chomp $base64;
-        $ua->default_header( Authorization => 'Basic ' . $base64 );
-    }
-    elsif ( $self->token ) {
-        $ua->default_header( 'X-LighthouseToken', $self->token );
-    }
-
-    return $ua;
-}
-
 1;
 
 __END__
diff --git a/lib/Net/Lighthouse/Project.pm b/lib/Net/Lighthouse/Project.pm
index 07abd08..e7016ac 100644
--- a/lib/Net/Lighthouse/Project.pm
+++ b/lib/Net/Lighthouse/Project.pm
@@ -9,7 +9,7 @@ use Net::Lighthouse::Project::Milestone;
 use Net::Lighthouse::Project::Message;
 use Net::Lighthouse::Project::Changeset;
 
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 # read only attr
 
 has [qw/created_at updated_at/] => (
diff --git a/lib/Net/Lighthouse/Project/Changeset.pm b/lib/Net/Lighthouse/Project/Changeset.pm
index 03c7a91..3cf8643 100644
--- a/lib/Net/Lighthouse/Project/Changeset.pm
+++ b/lib/Net/Lighthouse/Project/Changeset.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 # read only attr
 
 has [qw/project_id user_id/] => (
diff --git a/lib/Net/Lighthouse/Project/Message.pm b/lib/Net/Lighthouse/Project/Message.pm
index 82498f8..cd43ef8 100644
--- a/lib/Net/Lighthouse/Project/Message.pm
+++ b/lib/Net/Lighthouse/Project/Message.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 # read only attr
 has [qw/created_at updated_at/] => (
     isa => 'Maybe[DateTime]',
diff --git a/lib/Net/Lighthouse/Project/Milestone.pm b/lib/Net/Lighthouse/Project/Milestone.pm
index ca773ef..cf3189f 100644
--- a/lib/Net/Lighthouse/Project/Milestone.pm
+++ b/lib/Net/Lighthouse/Project/Milestone.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 # read only attr
 has [qw/created_at updated_at/] => (
     isa => 'Maybe[DateTime]',
diff --git a/lib/Net/Lighthouse/Project/Ticket.pm b/lib/Net/Lighthouse/Project/Ticket.pm
index 4fc0d1c..0ed84a0 100644
--- a/lib/Net/Lighthouse/Project/Ticket.pm
+++ b/lib/Net/Lighthouse/Project/Ticket.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 # read only attr
 has [qw/created_at updated_at milestone_due_on/] => (
     isa => 'Maybe[DateTime]',
diff --git a/lib/Net/Lighthouse/Project/TicketBin.pm b/lib/Net/Lighthouse/Project/TicketBin.pm
index 60cfebb..8f7104d 100644
--- a/lib/Net/Lighthouse/Project/TicketBin.pm
+++ b/lib/Net/Lighthouse/Project/TicketBin.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 
 # read only attr
 has 'updated_at' => (
diff --git a/lib/Net/Lighthouse/Token.pm b/lib/Net/Lighthouse/Token.pm
index 5ca0252..7256f7a 100644
--- a/lib/Net/Lighthouse/Token.pm
+++ b/lib/Net/Lighthouse/Token.pm
@@ -2,7 +2,7 @@ package Net::Lighthouse::Token;
 use Any::Moose;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-use base 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 
 # read only attr
 has 'created_at' => (
diff --git a/lib/Net/Lighthouse/User.pm b/lib/Net/Lighthouse/User.pm
index ea59172..5a3d36b 100644
--- a/lib/Net/Lighthouse/User.pm
+++ b/lib/Net/Lighthouse/User.pm
@@ -3,7 +3,7 @@ use Any::Moose;
 use XML::Simple;
 use Params::Validate ':all';
 use Net::Lighthouse::Util;
-extends 'Net::Lighthouse';
+extends 'Net::Lighthouse::Base';
 
 # read only attr
 has 'id' => (
diff --git a/t/02-project.t b/t/02-project.t
index dc818b4..e7586ba 100644
--- a/t/02-project.t
+++ b/t/02-project.t
@@ -9,7 +9,7 @@ can_ok( 'Net::Lighthouse::Project', 'new' );
 
 my $project = Net::Lighthouse::Project->new( account => 'sunnavy', id => 1 );
 isa_ok( $project, 'Net::Lighthouse::Project' );
-isa_ok( $project, 'Net::Lighthouse' );
+isa_ok( $project, 'Net::Lighthouse::Base' );
 for my $attr (
     qw/archived created_at default_assigned_user_id
     default_milestone_id description description_html hidden
diff --git a/t/03-ticket.t b/t/03-ticket.t
index 0b7584d..ab6bb53 100644
--- a/t/03-ticket.t
+++ b/t/03-ticket.t
@@ -10,7 +10,7 @@ can_ok( 'Net::Lighthouse::Project::Ticket', 'new' );
 
 my $ticket = Net::Lighthouse::Project::Ticket->new;
 isa_ok( $ticket, 'Net::Lighthouse::Project::Ticket' );
-isa_ok( $ticket, 'Net::Lighthouse' );
+isa_ok( $ticket, 'Net::Lighthouse::Base' );
 
 my @attrs = (
     'priority',           'raw_data',
diff --git a/t/06-user.t b/t/06-user.t
index 00b34f6..459c544 100644
--- a/t/06-user.t
+++ b/t/06-user.t
@@ -9,7 +9,7 @@ can_ok( 'Net::Lighthouse::User', 'new' );
 
 my $user = Net::Lighthouse::User->new( account => 'sunnavy' );
 isa_ok( $user, 'Net::Lighthouse::User' );
-isa_ok( $user, 'Net::Lighthouse' );
+isa_ok( $user, 'Net::Lighthouse::Base' );
 
 for my $attr( qw/id name job name website avatar_url/ ) {
     can_ok( $user, $attr );
diff --git a/t/09-milestone.t b/t/09-milestone.t
index 7bd7f0f..1a9da01 100644
--- a/t/09-milestone.t
+++ b/t/09-milestone.t
@@ -11,7 +11,7 @@ can_ok( 'Net::Lighthouse::Project::Milestone', 'new' );
 
 my $milestone = Net::Lighthouse::Project::Milestone->new;
 isa_ok( $milestone, 'Net::Lighthouse::Project::Milestone' );
-isa_ok( $milestone, 'Net::Lighthouse' );
+isa_ok( $milestone, 'Net::Lighthouse::Base' );
 
 my @attrs = (
     'open_tickets_count', 'created_at',
diff --git a/t/10-changeset.t b/t/10-changeset.t
index 1dc23bf..578be6e 100644
--- a/t/10-changeset.t
+++ b/t/10-changeset.t
@@ -11,7 +11,7 @@ can_ok( 'Net::Lighthouse::Project::Changeset', 'new' );
 
 my $changeset = Net::Lighthouse::Project::Changeset->new;
 isa_ok( $changeset, 'Net::Lighthouse::Project::Changeset' );
-isa_ok( $changeset, 'Net::Lighthouse' );
+isa_ok( $changeset, 'Net::Lighthouse::Base' );
 
 my @attrs = (
     'body',    'revision', 'project_id', 'changed_at',
diff --git a/t/11-message.t b/t/11-message.t
index ba2d5d1..2bfb1a6 100644
--- a/t/11-message.t
+++ b/t/11-message.t
@@ -11,7 +11,7 @@ can_ok( 'Net::Lighthouse::Project::Message', 'new' );
 
 my $message = Net::Lighthouse::Project::Message->new;
 isa_ok( $message, 'Net::Lighthouse::Project::Message' );
-isa_ok( $message, 'Net::Lighthouse' );
+isa_ok( $message, 'Net::Lighthouse::Base' );
 
 my @attrs = (
     'created_at',        'comments',
diff --git a/t/12-ticket-bin.t b/t/12-ticket-bin.t
index 3b093bd..a1d4f49 100644
--- a/t/12-ticket-bin.t
+++ b/t/12-ticket-bin.t
@@ -11,7 +11,7 @@ can_ok( 'Net::Lighthouse::Project::TicketBin', 'new' );
 
 my $bin = Net::Lighthouse::Project::TicketBin->new;
 isa_ok( $bin, 'Net::Lighthouse::Project::TicketBin' );
-isa_ok( $bin, 'Net::Lighthouse' );
+isa_ok( $bin, 'Net::Lighthouse::Base' );
 
 my @attrs = (
     'query',      'user_id', 'position',   'name',

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



More information about the Bps-public-commit mailing list