[Bps-public-commit] r17655 - in Net-Google-Code/trunk: lib/Net/Google lib/Net/Google/Code

fayland at bestpractical.com fayland at bestpractical.com
Fri Jan 9 00:07:31 EST 2009


Author: fayland
Date: Fri Jan  9 00:07:31 2009
New Revision: 17655

Modified:
   Net-Google-Code/trunk/lib/Net/Google/Code.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Downloads.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm
   Net-Google-Code/trunk/lib/Net/Google/Code/WikiEntry.pm
   Net-Google-Code/trunk/t/10.downloads.t
   Net-Google-Code/trunk/t/11.wiki.t

Log:
API change.

Modified: Net-Google-Code/trunk/lib/Net/Google/Code.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code.pm	Fri Jan  9 00:07:31 2009
@@ -46,7 +46,7 @@
     lazy    => 1,
     default => sub {
         require Net::Google::Code::Downloads;
-        Net::Google::Code::Downloads->new( connection => $_[0]->connection );
+        Net::Google::Code::Downloads->new( parent => $_[0] );
     }
 );
 
@@ -56,7 +56,7 @@
     lazy    => 1,
     default => sub {
         require Net::Google::Code::Wiki;
-        Net::Google::Code::Wiki->new( connection => $_[0]->connection );
+        Net::Google::Code::Wiki->new( parent => $_[0] );
     }
 );
 

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Downloads.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Downloads.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Downloads.pm	Fri Jan  9 00:07:31 2009
@@ -7,8 +7,8 @@
 our $VERSION = '0.02';
 our $AUTHORITY = 'cpan:FAYLAND';
 
-has connection => (
-    isa => 'Net::Google::Code::Connection',
+has parent => (
+    isa => 'Net::Google::Code',
     is  => 'ro',
     required => 1,
 );
@@ -16,8 +16,8 @@
 sub all_entries {
 	my $self = shift;
 	
-	my $connection = $self->connection;
-	my $project    = $connection->project;
+	my $connection = $self->parent->connection;
+	my $project    = $self->parent->project;
 	my $feed_url   = "http://code.google.com/feeds/p/$project/downloads/basic";
 	
 	my $content = $connection->_fetch( $feed_url );
@@ -49,8 +49,8 @@
 	
 	# http://code.google.com/p/net-google-code/downloads/detail?name=Net-Google-Code-0.01.tar.gz
 	
-	my $connection = $self->connection;
-	my $project    = $connection->project;
+	my $connection = $self->parent->connection;
+	my $project    = $self->parent->project;
 	
 	my $url = "http://code.google.com/p/$project/downloads/detail?name=$filename";
 	my $content = $connection->_fetch( $url );

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/Wiki.pm	Fri Jan  9 00:07:31 2009
@@ -8,8 +8,8 @@
 our $VERSION = '0.02';
 our $AUTHORITY = 'cpan:FAYLAND';
 
-has connection => (
-    isa => 'Net::Google::Code::Connection',
+has parent => (
+    isa => 'Net::Google::Code',
     is  => 'ro',
     required => 1,
 );
@@ -17,8 +17,8 @@
 sub all_entries {
 	my $self = shift;
 	
-	my $connection = $self->connection;
-	my $project    = $connection->project;
+	my $connection = $self->parent->connection;
+	my $project    = $self->parent->project;
 	
 	my $wiki_svn = "http://$project.googlecode.com/svn/wiki/";
 	my $content = $connection->_fetch( $wiki_svn );
@@ -41,7 +41,7 @@
     
     my ($wiki_item) = validate_pos( @_, { type => SCALAR } );
     
-    return Net::Google::Code::WikiEntry->new( connection => $self->connection, name => $wiki_item );
+    return Net::Google::Code::WikiEntry->new( parent => $self->parent, name => $wiki_item );
 }
 
 no Moose;

Modified: Net-Google-Code/trunk/lib/Net/Google/Code/WikiEntry.pm
==============================================================================
--- Net-Google-Code/trunk/lib/Net/Google/Code/WikiEntry.pm	(original)
+++ Net-Google-Code/trunk/lib/Net/Google/Code/WikiEntry.pm	Fri Jan  9 00:07:31 2009
@@ -6,8 +6,8 @@
 our $VERSION = '0.02';
 our $AUTHORITY = 'cpan:FAYLAND';
 
-has connection => (
-    isa => 'Net::Google::Code::Connection',
+has parent => (
+    isa => 'Net::Google::Code',
     is  => 'ro',
     required => 1,
 );
@@ -22,8 +22,8 @@
         my $self = shift;
         
         my $name       = $self->name;
-        my $connection = $self->connection;
-        my $project    = $connection->project;
+        my $connection = $self->parent->connection;
+	    my $project    = $self->parent->project;
         
         my $wiki_url = "http://$project.googlecode.com/svn/wiki/$name.wiki";
         my $content = $connection->_fetch( $wiki_url );
@@ -40,8 +40,8 @@
         my $self = shift;
         
         my $name       = $self->name;
-        my $connection = $self->connection;
-        my $project    = $connection->project;
+        my $connection = $self->parent->connection;
+	    my $project    = $self->parent->project;
         
         # http://code.google.com/p/net-google-code/wiki/TestPage
         my $wiki_url = "http://code.google.com/p/$project/wiki/$name";
@@ -121,11 +121,13 @@
 
 =head1 SYNOPSIS
 
-    use Net::Google::Code::Connection;
-    my $connection = Net::Google::Code::Connection( project => 'net-google-code' );
+    use Net::Google::Code;
+    
+    my $project = Net::Google::Code->new( project => 'net-google-code' );
+    my $wiki = $project->wiki;
 
-    use Net::Google::Code::WikiEntry;
-    my $wiki_entry = Net::Google::Code::WikiEntry->new( connection => $connection, name => 'AUTHORS' );
+    my $wiki_entry = $wiki->entry('README');
+    print $wiki_entry->source;
 
 =head1 DESCRIPTION
 

Modified: Net-Google-Code/trunk/t/10.downloads.t
==============================================================================
--- Net-Google-Code/trunk/t/10.downloads.t	(original)
+++ Net-Google-Code/trunk/t/10.downloads.t	Fri Jan  9 00:07:31 2009
@@ -3,10 +3,11 @@
 use strict;
 use warnings;
 
-use Test::More tests => 15;
+use Test::More tests => 13;
 use Test::MockModule;
 use FindBin qw/$Bin/;
 use File::Slurp;
+use Net::Google::Code;
 
 my $feed_file = "$Bin/sample/10.download.xml";
 my $down_file = "$Bin/sample/10.download.html";
@@ -27,12 +28,10 @@
     }
 );
 
-use_ok('Net::Google::Code::Connection');
-use_ok('Net::Google::Code::Downloads');
-my $connection = Net::Google::Code::Connection->new( project => 'net-google-code' );
-my $downloads = Net::Google::Code::Downloads->new( connection => $connection );
+my $project = Net::Google::Code->new( project => 'net-google-code' );
+my $downloads = $project->downloads;
 isa_ok( $downloads, 'Net::Google::Code::Downloads' );
-isa_ok( $downloads->connection, 'Net::Google::Code::Connection' );
+isa_ok( $downloads->parent, 'Net::Google::Code' );
 
 my @entries = $downloads->all_entries;
 is( scalar @entries, 1 );

Modified: Net-Google-Code/trunk/t/11.wiki.t
==============================================================================
--- Net-Google-Code/trunk/t/11.wiki.t	(original)
+++ Net-Google-Code/trunk/t/11.wiki.t	Fri Jan  9 00:07:31 2009
@@ -3,10 +3,11 @@
 use strict;
 use warnings;
 
-use Test::More tests => 12;
+use Test::More tests => 10;
 use Test::MockModule;
 use FindBin qw/$Bin/;
 use File::Slurp;
+use Net::Google::Code;
 
 my $svn_file   = "$Bin/sample/11.wiki.html";
 my $wiki_file  = "$Bin/sample/11.TODO.wiki";
@@ -30,12 +31,10 @@
     }
 );
 
-use_ok('Net::Google::Code::Connection');
-use_ok('Net::Google::Code::Wiki');
-my $connection = Net::Google::Code::Connection->new( project => 'foorum' );
-my $wiki = Net::Google::Code::Wiki->new( connection => $connection );
+my $project = Net::Google::Code->new( project => 'foorum' );
+my $wiki = $project->wiki;
 isa_ok( $wiki, 'Net::Google::Code::Wiki' );
-isa_ok( $wiki->connection, 'Net::Google::Code::Connection' );
+isa_ok( $wiki->parent, 'Net::Google::Code' );
 
 my @entries = $wiki->all_entries;
 is( scalar @entries, 16 );



More information about the Bps-public-commit mailing list