The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
AUTHORS 25
Changes 06
LICENSE 1315
MANIFEST 02
META.yml 23
Makefile.PL 2944
README 22
bin/picasa 83
bin/picasa-get 73
bin/picasa-list 73
dist.ini 01
lib/Net/Google/PicasaWeb/Album.pm 66
lib/Net/Google/PicasaWeb/Base.pm 55
lib/Net/Google/PicasaWeb/Comment.pm 66
lib/Net/Google/PicasaWeb/Feed.pm 55
lib/Net/Google/PicasaWeb/Media.pm 99
lib/Net/Google/PicasaWeb/MediaEntry.pm 618
lib/Net/Google/PicasaWeb/MediaFeed.pm 66
lib/Net/Google/PicasaWeb.pm 13214
t/data/add_album.xml 048
t/offline/Net/Google/PicasaWeb/Test/AddAlbum.pm 043
t/offline/Net/Google/PicasaWeb/Test/GetMediaEntry.pm 23
t/offline/Net/Google/PicasaWeb/Test/ListAlbums.pm 33
t/offline/Net/Google/PicasaWeb/Test/ListComments.pm 33
t/offline/Net/Google/PicasaWeb/Test/ListMediaEntries.pm 44
t/offline/Net/Google/PicasaWeb/Test/ListTags.pm 33
t/offline/Net/Google/PicasaWeb/Test/Role/Offline.pm 01
t/online/Net/Google/PicasaWeb/Test/ListAlbums.pm 10
t/online.t 010
29 files changed (This is a version diff) 142474
@@ -1,2 +1,5 @@
-Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
-Benjamin Thomas <bthomas@cpan.org>
+Sterling Hanenkamp (zostay) <hanenkamp@cpan.org>
+Tomáš Znamenáček (zoul) <tomas.znamenacek@gmail.com>
+Benjamin Thomas (bth0mas) <bthomas@cpan.org>
+Andy Shevchenko (andy-shev) <andy.shevchenko@gmail.com>
+(shroeer) <shroeer@cpan.org>
@@ -1,5 +1,11 @@
 Revision history for Net-Google-PicasaWeb
 
+0.12      2013-09-14 16:55:24 America/Chicago
+
+    * Fixed failing tests. (HT: shroeer)
+    * Added support for the timestamp attribute (HT: shroeer)
+    * Eliminate some Moose whineyness (HT: shroeer)
+
 0.11      2011-05-30 09:35:19 America/Chicago
 
     * Album loading sometimes failed because certain Moose attributes were set
@@ -1,4 +1,4 @@
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -12,21 +12,22 @@ b) the "Artistic License"
 
 --- The GNU General Public License, Version 1, February 1989 ---
 
-This software is Copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is Copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software, licensed under:
 
   The GNU General Public License, Version 1, February 1989
 
-		    GNU GENERAL PUBLIC LICENSE
-		     Version 1, February 1989
+                    GNU GENERAL PUBLIC LICENSE
+                     Version 1, February 1989
 
  Copyright (C) 1989 Free Software Foundation, Inc.
-                59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
+ 51 Franklin St, Suite 500, Boston, MA  02110-1335  USA
+
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
-			    Preamble
+                            Preamble
 
   The license agreements of most software companies try to keep users
 at the mercy of those companies.  By contrast, our General Public
@@ -67,7 +68,7 @@ authors' reputations.
   The precise terms and conditions for copying, distribution and
 modification follow.
 
-		    GNU GENERAL PUBLIC LICENSE
+                    GNU GENERAL PUBLIC LICENSE
    TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 
   0. This License Agreement applies to any program or other work which
@@ -185,7 +186,7 @@ make exceptions for this.  Our decision will be guided by the two goals
 of preserving the free status of all derivatives of our free software and
 of promoting the sharing and reuse of software generally.
 
-			    NO WARRANTY
+                            NO WARRANTY
 
   9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
@@ -207,9 +208,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
 POSSIBILITY OF SUCH DAMAGES.
 
-		     END OF TERMS AND CONDITIONS
+                     END OF TERMS AND CONDITIONS
 
-	Appendix: How to Apply These Terms to Your New Programs
+        Appendix: How to Apply These Terms to Your New Programs
 
   If you develop a new program, and you want it to be of the greatest
 possible use to humanity, the best way to achieve this is to make it
@@ -235,8 +236,9 @@ the exclusion of warranty; and each file should have at least the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software Foundation,
-    Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
+
 
 Also add information on how to contact you by electronic and paper mail.
 
@@ -270,7 +272,7 @@ That's all there is to it!
 
 --- The Artistic License 1.0 ---
 
-This software is Copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is Copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software, licensed under:
 
@@ -19,6 +19,7 @@ lib/Net/Google/PicasaWeb/Media.pm
 lib/Net/Google/PicasaWeb/MediaEntry.pm
 lib/Net/Google/PicasaWeb/MediaFeed.pm
 t/00-load.t
+t/data/add_album.xml
 t/data/get_album.xml
 t/data/get_comment.xml
 t/data/get_media_entry.xml
@@ -28,6 +29,7 @@ t/data/list_media_entries.xml
 t/data/list_tags.xml
 t/lib/Net/Google/PicasaWeb/Test.pm
 t/offline.t
+t/offline/Net/Google/PicasaWeb/Test/AddAlbum.pm
 t/offline/Net/Google/PicasaWeb/Test/GetAlbum.pm
 t/offline/Net/Google/PicasaWeb/Test/GetComment.pm
 t/offline/Net/Google/PicasaWeb/Test/GetMediaEntry.pm
@@ -6,7 +6,7 @@ build_requires: {}
 configure_requires:
   ExtUtils::MakeMaker: 6.30
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.200006, CPAN::Meta::Converter version 2.102400'
+generated_by: 'Dist::Zilla version 4.300038, CPAN::Meta::Converter version 2.120921'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -14,6 +14,7 @@ meta-spec:
 name: Net-Google-PicasaWeb
 requires:
   IO::Prompt: 0
+  LWP::Protocol::https: 0
   LWP::UserAgent: 0
   Moose: 0
   MooseX::Role::Matcher: 0
@@ -26,4 +27,4 @@ requires:
 resources:
   bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Google-PicasaWeb
   repository: git://github.com/zostay/net-google-picasaweb.git
-version: 0.11
+version: 0.12
@@ -9,42 +9,57 @@ use ExtUtils::MakeMaker 6.30;
 
 
 my %WriteMakefileArgs = (
-  'ABSTRACT' => 'use Google\'s Picasa Web API',
-  'AUTHOR' => 'Andrew Sterling Hanenkamp <hanenkamp@cpan.org>',
-  'BUILD_REQUIRES' => {},
-  'CONFIGURE_REQUIRES' => {
-    'ExtUtils::MakeMaker' => '6.30'
+  "ABSTRACT" => "use Google's Picasa Web API",
+  "AUTHOR" => "Andrew Sterling Hanenkamp <hanenkamp\@cpan.org>",
+  "BUILD_REQUIRES" => {},
+  "CONFIGURE_REQUIRES" => {
+    "ExtUtils::MakeMaker" => "6.30"
   },
-  'DISTNAME' => 'Net-Google-PicasaWeb',
-  'EXE_FILES' => [
-    'bin/picasa',
-    'bin/picasa-get',
-    'bin/picasa-list',
-    'bin/picasa',
-    'bin/picasa-get',
-    'bin/picasa-list'
+  "DISTNAME" => "Net-Google-PicasaWeb",
+  "EXE_FILES" => [
+    "bin/picasa",
+    "bin/picasa-get",
+    "bin/picasa-list",
+    "bin/picasa",
+    "bin/picasa-get",
+    "bin/picasa-list"
   ],
-  'LICENSE' => 'perl',
-  'NAME' => 'Net::Google::PicasaWeb',
-  'PREREQ_PM' => {
-    'IO::Prompt' => '0',
-    'LWP::UserAgent' => '0',
-    'Moose' => '0',
-    'MooseX::Role::Matcher' => '0',
-    'Net::Google::AuthSub' => '0',
-    'Test::Able' => '0.09',
-    'Test::Able::Runner' => '1.000',
-    'Test::Mock::LWP' => '0',
-    'URI' => '0',
-    'XML::Twig' => '3.30'
+  "LICENSE" => "perl",
+  "NAME" => "Net::Google::PicasaWeb",
+  "PREREQ_PM" => {
+    "IO::Prompt" => 0,
+    "LWP::Protocol::https" => 0,
+    "LWP::UserAgent" => 0,
+    "Moose" => 0,
+    "MooseX::Role::Matcher" => 0,
+    "Net::Google::AuthSub" => 0,
+    "Test::Able" => "0.09",
+    "Test::Able::Runner" => "1.000",
+    "Test::Mock::LWP" => 0,
+    "URI" => 0,
+    "XML::Twig" => "3.30"
   },
-  'VERSION' => '0.11',
-  'test' => {
-    'TESTS' => 't/*.t'
+  "TEST_REQUIRES" => {},
+  "VERSION" => "0.12",
+  "test" => {
+    "TESTS" => "t/*.t"
   }
 );
 
 
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+  my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
+  my $br = $WriteMakefileArgs{BUILD_REQUIRES};
+  for my $mod ( keys %$tr ) {
+    if ( exists $br->{$mod} ) {
+      $br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
+    }
+    else {
+      $br->{$mod} = $tr->{$mod};
+    }
+  }
+}
+
 unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
   my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
   my $pp = $WriteMakefileArgs{PREREQ_PM};
@@ -1,11 +1,11 @@
 
 
 This archive contains the distribution Net-Google-PicasaWeb,
-version 0.11:
+version 0.12:
 
   use Google's Picasa Web API
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
@@ -77,7 +77,7 @@ just dispatch {
     };
 };
 
-
+__END__
 
 =pod
 
@@ -87,7 +87,7 @@ picasa - master command for the Picasa Web scripts
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -114,14 +114,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
-
-__END__
-
-
@@ -173,7 +173,7 @@ sub download_photos {
     }
 }
 
-
+__END__
 
 =pod
 
@@ -183,7 +183,7 @@ picasa-get - fetch albums and photos from Google Picasa Web
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -353,13 +353,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
-
-__END__
-
@@ -369,7 +369,7 @@ else {
     pod2usage(1);
 }
 
-
+__END__
 
 =pod
 
@@ -379,7 +379,7 @@ picasa-list - list albums, photos, tags, or comments from Google Picasa Web
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -558,13 +558,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
-
-__END__
-
@@ -20,6 +20,7 @@ dir = bin
 
 [Prereqs]
 IO::Prompt              = 0
+LWP::Protocol::https    = 0
 LWP::UserAgent          = 0
 Moose                   = 0
 MooseX::Role::Matcher   = 0
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::Album;
-BEGIN {
-  $Net::Google::PicasaWeb::Album::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Album::VERSION = '0.12';
 }
 use Moose;
 
@@ -27,7 +27,7 @@ has number_of_photos => (
 
 override from_feed => sub {
     my ($class, $service, $entry) = @_;
-    my $self = $class->super($service, $entry);
+    my $self = super();
 
     $self->bytes_used($entry->field('gphoto:bytesUsed'))
         if $entry->field('gphoto:bytesUsed');
@@ -70,6 +70,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -78,7 +79,7 @@ Net::Google::PicasaWeb::Album - represents a single Picasa Web photo album
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -169,10 +170,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::Base;
-BEGIN {
-  $Net::Google::PicasaWeb::Base::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Base::VERSION = '0.12';
 }
 use Moose;
 
@@ -31,6 +31,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -39,7 +40,7 @@ Net::Google::PicasaWeb::Base - base class
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 DESCRIPTION
 
@@ -75,10 +76,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::Comment;
-BEGIN {
-  $Net::Google::PicasaWeb::Comment::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Comment::VERSION = '0.12';
 }
 use Moose;
 
@@ -17,7 +17,7 @@ has content => (
 
 override from_feed => sub {
     my ($class, $service, $entry) = @_;
-    my $self = $class->super($service, $entry);
+    my $self = super();
 
     $self->content($entry->field('content'));
     return $self;
@@ -29,6 +29,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -37,7 +38,7 @@ Net::Google::PicasaWeb::Comment - represents a single Picasa Web comment
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -83,10 +84,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::Feed;
-BEGIN {
-  $Net::Google::PicasaWeb::Feed::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Feed::VERSION = '0.12';
 }
 use Moose;
 
@@ -110,6 +110,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -118,7 +119,7 @@ Net::Google::PicasaWeb::Feed - base class for feed entries
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 DESCRIPTION
 
@@ -178,10 +179,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::Media;
-BEGIN {
-  $Net::Google::PicasaWeb::Media::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Media::VERSION = '0.12';
 }
 use Moose;
 
@@ -97,8 +97,8 @@ sub _fetch {
 }
 
 package Net::Google::PicasaWeb::Media::Content;
-BEGIN {
-  $Net::Google::PicasaWeb::Media::Content::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Media::Content::VERSION = '0.12';
 }
 use Moose;
 
@@ -153,8 +153,8 @@ sub fetch {
 }
 
 package Net::Google::PicasaWeb::Media::Thumbnail;
-BEGIN {
-  $Net::Google::PicasaWeb::Media::Thumbnail::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Media::Thumbnail::VERSION = '0.12';
 }
 use Moose;
 
@@ -195,6 +195,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -203,7 +204,7 @@ Net::Google::PicasaWeb::Media - hold information about a photo or video
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -374,10 +375,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::MediaEntry;
-BEGIN {
-  $Net::Google::PicasaWeb::MediaEntry::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::MediaEntry::VERSION = '0.12';
 }
 use Moose;
 
@@ -33,9 +33,15 @@ has size => (
 );
 
 
+has timestamp => (
+    is => 'rw',  # should probably be 'ro'
+    isa => 'Int',
+);
+
+
 override from_feed => sub {
     my ($class, $service, $entry) = @_;
-    my $self = $class->super($service, $entry);
+    my $self = super();
 
     $self->album_id($entry->field('gphoto:albumid'));
 
@@ -45,6 +51,8 @@ override from_feed => sub {
         if $entry->field('gphoto:height');
     $self->size($entry->field('gphoto:size'))
         if $entry->field('gphoto:size');
+    $self->timestamp($entry->field('gphoto:timestamp'))
+         if $entry->field('gphoto:timestamp');
 
     return $self;
 };
@@ -78,6 +86,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -86,7 +95,7 @@ Net::Google::PicasaWeb::MediaEntry - represents a single Picasa Web photo or vid
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -153,6 +162,10 @@ The height of the video or photo in pixels.
 
 The size of the video or photo in bytes.
 
+=head2 timestamp
+
+The timestamp of the video or photo in bytes.
+
 =head1 METHODS
 
 =head2 list_tags
@@ -173,10 +186,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,6 +1,6 @@
 package Net::Google::PicasaWeb::MediaFeed;
-BEGIN {
-  $Net::Google::PicasaWeb::MediaFeed::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::MediaFeed::VERSION = '0.12';
 }
 use Moose;
 
@@ -16,7 +16,7 @@ has photo => (
 
 override from_feed => sub {
     my ($class, $service, $entry) = @_;
-    my $self = $class->super($service, $entry);
+    my $self = super();
 
     if ($entry->has_child('media:group')) {
         my $media = Net::Google::PicasaWeb::Media->from_feed(
@@ -33,6 +33,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -41,7 +42,7 @@ Net::Google::PicasaWeb::MediaFeed - base class for media feed entries
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 DESCRIPTION
 
@@ -59,10 +60,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -1,13 +1,15 @@
 package Net::Google::PicasaWeb;
-BEGIN {
-  $Net::Google::PicasaWeb::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::VERSION = '0.12';
 }
 use Moose;
 
 # ABSTRACT: use Google's Picasa Web API
 
 use Carp;
+use HTTP::Message;
 use HTTP::Request::Common;
+use HTTP::Request;
 use LWP::UserAgent;
 use Net::Google::AuthSub;
 use URI;
@@ -113,11 +115,63 @@ sub get_album {
 }
 
 
+sub add_album {
+    my ($self, %params) = @_;
+
+    my $twig = XML::Twig->new(
+        pretty_print => 'indented',
+        empty_tags   => 'expand',
+    );
+
+    my $root = XML::Twig::Elt->new(
+        'entry' => {
+            'xmlns'        => 'http://www.w3.org/2005/Atom',
+            'xmlns:media'  => 'http://search.yahoo.com/mrss/',
+            'xmlns:gphoto' => 'http://schemas.google.com/photos/2007',
+        }
+    );
+
+    $twig->set_root($root);
+
+    $root->insert_new_elt('last_child', title => {type => 'text'}, $params{title});
+    $root->insert_new_elt('last_child', summary => {type => 'text'}, $params{summary});
+
+    foreach my $gphoto ('location', 'access', 'commentingEnabled', 'timestamp') {
+        $root->insert_new_elt('last_child', 'gphoto:' . $gphoto, $params{$gphoto});
+    }
+
+    my $group = $root->insert_new_elt('last_child', 'media:group');
+
+    if (defined $params{keywords}) {
+        $group->insert_new_elt('last_child', 'media:keywords', join(', ', $params{keywords}));
+    }
+
+    $root->insert_new_elt('last_child',
+        'category' => {
+            'scheme' => 'http://schemas.google.com/g/2005#kind',
+            'term'   => 'http://schemas.google.com/photos/2007#album'
+        }
+    );
+
+    my $uri = $self->service_base_url . 'user/default';
+    my $response = $self->request('POST', $uri, $twig->sprint(), 'application/atom+xml');
+
+    $twig->purge();
+
+    if ($response->is_error) {
+        croak $response->status_line;
+    }
+
+    my @entries = $self->_parse_feed('Net::Google::PicasaWeb::Album', 'entry', $response->content);
+    return scalar $entries[0];
+}
+
+
 # This is a tiny cheat that allows us to reuse the list_entries method
 {
     package Net::Google::PicasaWeb::Tag;
-BEGIN {
-  $Net::Google::PicasaWeb::Tag::VERSION = '0.11';
+{
+  $Net::Google::PicasaWeb::Tag::VERSION = '0.12';
 }
 
     sub from_feed {
@@ -241,12 +295,79 @@ sub get_photo { shift->get_media_entry(@_) }
 sub get_video { shift->get_media_entry(@_) }
 
 
+sub add_media_entry {
+    my ($self, %params) = @_;
+
+    my $user_id   = delete $params{user_id} || 'default';
+    my $album_id  = delete $params{album_id} || 'default';
+    my $data_type = delete $params{data_type} || 'image/jpeg';
+
+    # Prepare Atom
+    my $twig = XML::Twig->new(
+        pretty_print => 'indented',
+        empty_tags   => 'expand',
+    );
+
+    my $root = XML::Twig::Elt->new(
+        'entry' => {
+            'xmlns'        => 'http://www.w3.org/2005/Atom',
+        }
+    );
+
+    $twig->set_root($root);
+
+    $root->insert_new_elt('last_child', title => {type => 'text'}, $params{title});
+    $root->insert_new_elt('last_child', summary => {type => 'text'}, $params{summary});
+
+    # TODO:
+    #   <media:group>
+    #       <media:keywords>
+    #           keyword, keyword, ...
+    #       </media:keywords>
+    #   </media:group>
+
+    $root->insert_new_elt('last_child',
+        'category' => {
+            'scheme' => 'http://schemas.google.com/g/2005#kind',
+            'term'   => 'http://schemas.google.com/photos/2007#photo'
+        }
+    );
+
+    # Prepare REST message
+    my $uri = $self->service_base_url . "user/$user_id/albumid/$album_id";
+    my $request = HTTP::Request->new(POST => $uri, [$self->authenticator->auth_params,
+                                                    'Content-Type' => 'multipart/related',
+                                                    'MIME-version' => '1.0']);
+    $request->add_part(HTTP::Message->new(['Content-Type' => 'application/atom+xml'], $twig->sprint()));
+    $request->add_part(HTTP::Message->new(['Content-Type' => $data_type], $params{data}));
+
+    # Clear unneeded Twig
+    $twig->purge();
+
+    my $response = $self->user_agent->request($request);
+
+    $request->clear();
+
+    if ($response->is_error) {
+        croak $response->status_line;
+    }
+
+    # FIXME: Should be proper parser here
+    my @entries = $self->_parse_feed('Net::Google::PicasaWeb::MediaEntry', 'entry', $response->content);
+    return scalar $entries[0];
+}
+
+*add_photo = *add_media_entry;
+*add_video = *add_media_entry;
+
+
 sub request {
     my $self    = shift;
     my $method  = shift;
     my $path    = shift;
-    my $query   = $method eq 'GET' ? shift : undef;
+    my $query   = ($method eq 'GET') ? shift : undef;
     my $content = shift;
+    my $type    = (($method eq 'POST') or ($method eq 'PUT')) ? shift : undef;
 
     my @headers = $self->authenticator->auth_params;
 
@@ -256,8 +377,8 @@ sub request {
     {
         local $_ = $method;
         if    (/GET/)    { $request = GET   ($url, @headers) }
-        elsif (/POST/)   { $request = POST  ($url, @headers, Content => $content) }
-        elsif (/PUT/)    { $request = PUT   ($url, @headers, Content => $content) }
+        elsif (/POST/)   { $request = POST  ($url, @headers, Content => $content, Content_Type => $type) }
+        elsif (/PUT/)    { $request = PUT   ($url, @headers, Content => $content, Content_Type => $type) }
         elsif (/DELETE/) { $request = DELETE($url, @headers) }
         else             { confess "unknown method [$_]" }
     }
@@ -322,6 +443,7 @@ __PACKAGE__->meta->make_immutable;
 1;
 
 __END__
+
 =pod
 
 =head1 NAME
@@ -330,7 +452,7 @@ Net::Google::PicasaWeb - use Google's Picasa Web API
 
 =head1 VERSION
 
-version 0.11
+version 0.12
 
 =head1 SYNOPSIS
 
@@ -363,6 +485,8 @@ version 0.11
   my @recent         = $service->list_comments( user_id => 'jondoe', max_results => 10 );
   my @photo_comments = $photo->list_comments;
 
+=encoding utf8
+
 =head1 ATTRIBUTES
 
 This module uses L<Moose> to handle attributes and such. These attributes are readable, writable, and may be passed to the constructor unless otherwise noted.
@@ -439,6 +563,46 @@ This will fetch a single album from the Picasa Web Albums using the given C<user
 
 This method returns C<undef> if no such album exists.
 
+=head2 add_album
+
+Create a new album for the current authenticated user.
+
+  my $album = $service->add_album(
+      title             => 'Trip to Italy',
+      summary           => 'This was the recent trip I took to Italy',
+      location          => 'Italy',
+      access            => 'public',
+      commentingEnabled => 'true',
+      timestamp         => '1152255600000',
+      keywords          => ('italy', 'vacation'),
+  );
+
+=over
+
+=item title
+
+The title of a new album.
+
+=item summary
+
+A small description of the album.
+
+=item location
+
+The location of the place where the photos have been taken.
+
+=item access
+
+The type of access to this album. It could be C<public> or C<private>.
+
+=back
+
+The default values will be applied by PicasaWeb on the server side.
+
+See
+C<http://code.google.com/intl/en-US/apis/picasaweb/developers_guide_protocol.html#AddAlbums>
+for details.
+
 =head2 list_tags
 
 Returns a list of tags that have been used by the logged user or the user named in the C<user_id> parameter.
@@ -526,6 +690,22 @@ Returns a specific photo or video entry when given a C<user_id>, C<album_id>, an
 
 If no such photo or video can be found, C<undef> will be returned.
 
+=head2 add_media_entry
+
+=head2 add_photo
+
+=head2 add_video
+
+  my $media_entry = $service->add_media_entry(
+      user_id   => $user_id,
+      album_id  => $album_id,
+      title     => $title,
+      summary   => $summary,
+      keywords  => ($keyword, $keyword, ),
+      data      => $binary,
+      data_type => $content_type,
+  );
+
 =head1 HELPERS
 
 These helper methods are used to do some of the work.
@@ -556,7 +736,7 @@ Several of the listing methods return entries that can be modified by setting th
 
 =item access
 
-This is the L<http://code.google.com/apis/picasaweb/reference.html#Visibility|visibility value> to limit the returned results to.
+This is the L<visibility value|http://code.google.com/apis/picasaweb/reference.html#Visibility> to limit the returned results to.
 
 =item thumbsize
 
@@ -568,13 +748,13 @@ By passing a single scalar or an array reference of scalars, e.g.,
   thumbsize => [ qw( 104c 640u d ) ],
   thumbsize => '1440u,1280u',
 
-You may select the size or sizes of thumbnails attached to the items returned. Please see the L<http://code.google.com/apis/picasaweb/reference.html#Parameters|parameters> documentation for a description of valid values.
+You may select the size or sizes of thumbnails attached to the items returned. Please see the L<parameters|http://code.google.com/apis/picasaweb/reference.html#Parameters> documentation for a description of valid values.
 
 =item imgmax
 
 This option is only used when listing albums and photos or videos.
 
-This is a single scalar selecting the size of the main image to return with the items found. Please see the L<http://code.google.com/apis/picasaweb/reference.html#Parameters|parameters> documentation for a description of valid values.
+This is a single scalar selecting the size of the main image to return with the items found. Please see the L<parameters|http://code.google.com/apis/picasaweb/reference.html#Parameters> documentation for a description of valid values.
 
 =item tag
 
@@ -644,6 +824,28 @@ L<http://search.cpan.org/dist/Net-Google-PicasaWeb>
 
 =head1 ACKNOWLEDGEMENTS
 
+Authors:
+
+=over
+
+=item *
+
+Sterling Hanenkamp (zostay)
+
+=item *
+
+Andy Shevchenko (andy-shev)
+
+=item *
+
+Benjamin Thomas (bth0mas)
+
+=item *
+
+Tomáš Znamenáček (zoul)
+
+=back
+
 Thanks to:
 
 =over
@@ -664,10 +866,9 @@ Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
-This software is copyright (c) 2011 by Andrew Sterling Hanenkamp.
+This software is copyright (c) 2013 by Andrew Sterling Hanenkamp.
 
 This is free software; you can redistribute it and/or modify it under
 the same terms as the Perl 5 programming language system itself.
 
 =cut
-
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:gphoto="http://schemas.google.com/photos/2007" xmlns:media="http://search.yahoo.com/mrss/">
+  <id>http://picasaweb.google.com/data/entry/api/user/andy.shevchenko/albumid/5632941380050677889</id>
+  <published>2006-07-07T07:00:00.000Z</published>
+  <updated>2011-07-24T15:29:27.102Z</updated>
+  <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#album"/>
+  <title type="text">Net::PicasaWeb test</title>
+  <summary type="text">Summary of the album</summary>
+  <rights type="text">private</rights>
+  <link href="http://picasaweb.google.com/data/feed/api/user/andy.shevchenko/albumid/5632941380050677889" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
+  <link href="https://picasaweb.google.com/andy.shevchenko/NetPicasaWebTest" rel="alternate" type="text/html"/>
+  <link href="http://picasaweb.google.com/data/entry/api/user/andy.shevchenko/albumid/5632941380050677889" rel="self" type="application/atom+xml"/>
+  <link href="http://picasaweb.google.com/data/entry/api/user/andy.shevchenko/albumid/5632941380050677889/1" rel="edit" type="application/atom+xml"/>
+  <link href="http://picasaweb.google.com/data/entry/api/user/andy.shevchenko/albumid/5632941380050677889/acl" rel="http://schemas.google.com/acl/2007#accessControlList" type="application/atom+xml"/>
+  <author>
+    <name>Andy Shevchenko</name>
+    <uri>https://picasaweb.google.com/andy.shevchenko</uri>
+  </author>
+  <gphoto:id>5632941380050677889</gphoto:id>
+  <gphoto:name>NetPicasaWebTest</gphoto:name>
+  <gphoto:location>Finland</gphoto:location>
+  <gphoto:access>private</gphoto:access>
+  <gphoto:timestamp>1152255600000</gphoto:timestamp>
+  <gphoto:numphotos>0</gphoto:numphotos>
+  <gphoto:numphotosremaining>1000</gphoto:numphotosremaining>
+  <gphoto:bytesUsed>0</gphoto:bytesUsed>
+  <gphoto:user>andy.shevchenko</gphoto:user>
+  <gphoto:nickname>Andy Shevchenko</gphoto:nickname>
+  <gphoto:commentingEnabled>true</gphoto:commentingEnabled>
+  <gphoto:commentCount>0</gphoto:commentCount>
+  <media:group>
+    <media:content medium="image" type="image/jpeg" url="http://lh3.ggpht.com/-NNn-snyeFYk/Tiw6Vy6E8IE/AAAAAAAAJXI/2lAmmsqutbk/NetPicasaWebTest.jpg"/>
+    <media:credit>Andy Shevchenko</media:credit>
+    <media:description type="plain">Summary of the album</media:description>
+    <media:keywords/>
+    <media:thumbnail height="160" url="http://lh3.ggpht.com/-NNn-snyeFYk/Tiw6Vy6E8IE/AAAAAAAAJXI/2lAmmsqutbk/s160-c/NetPicasaWebTest.jpg" width="160"/>
+    <media:title type="plain">Net::PicasaWeb test</media:title>
+  </media:group>
+  <georss:where>
+    <gml:Envelope>
+      <gml:lowerCorner>56.7215633 19.559401</gml:lowerCorner>
+      <gml:upperCorner>67.1266565 31.936901</gml:upperCorner>
+    </gml:Envelope>
+    <gml:Point>
+      <gml:pos>61.9241099 25.748151</gml:pos>
+    </gml:Point>
+  </georss:where>
+</entry>
@@ -0,0 +1,43 @@
+package Net::Google::PicasaWeb::Test::AddAlbum;
+use Test::Able;
+use Test::More;
+
+use URI;
+
+with qw( Net::Google::PicasaWeb::Test::Role::Offline );
+
+test plan => 8, add_album_ok => sub {
+    my $self = shift;
+
+    # Setup the response
+    $self->set_response_content('add_album');
+
+    my $service = $self->service;
+
+    my @albums = $service->add_album(
+        title => 'Net::PicasaWeb test',
+        summary => 'Summary of the album',
+        location => 'Finland',
+        access => 'private',
+        commentingEnabled => 'true',
+        timestamp => 1152255600000,
+        keywords => ('trip', 'Italy', 'spring'),
+    );
+    is($self->request->{new_args}[1], 'POST', 'method is POST');
+    is($self->request->{new_args}[2],
+        'http://picasaweb.google.com/data/feed/api/user/default',
+        'URL is correct');
+    is(scalar @albums, 1, 'found 1 albums');
+
+    my $album = $albums[0];
+    is($album->title, 'Net::PicasaWeb test', 'title is "Net::PicasaWeb test"');
+    is($album->summary, 'Summary of the album',
+        'summary is "Summary of the album"');
+    is($album->author_name, 'Andy Shevchenko',
+        'author_name is "Andy Shevchenko"');
+    is($album->author_uri,
+        'https://picasaweb.google.com/andy.shevchenko',
+        'author_uri is correct');
+};
+
+1;
@@ -13,7 +13,7 @@ setup get_media_entry_data => sub {
     $self->set_response_content('get_media_entry');
 };
 
-test plan => 23, get_media_entry_ok => sub {
+test plan => 24, get_media_entry_ok => sub {
     my $self = shift;
 
     my $service = $self->service;
@@ -35,7 +35,8 @@ test plan => 23, get_media_entry_ok => sub {
     is($media->author_name, 'Chuck G', 'author_name is Chuck G');
     is($media->author_uri, 'http://picasaweb.google.com/captaincool', 
         'author_uri is correct');
-
+    is($media->timestamp, '1196770081000', 'timestamp is correct');
+	 
     my $photo = $media->photo;
     is($photo->title, 'Nash2.jpg', 'photo title is correct');
     is($photo->description, "", 'photo description is empty');
@@ -77,11 +77,11 @@ test plan => 29, list_albums_for_other_user_ok => sub {
     my $request  = $self->request;
     my $response = $self->response;
 
-    my @albums = $service->list_albums( user_id => 'foobar', q => 'blah', thumbsize => [ qw( 72c 104u d ) ] );
+    my @albums = $service->list_albums( user_id => 'foobar' );
     is($request->{new_args}[1], 'GET', 'method is GET');
     ok(URI::eq($request->{new_args}[2], 
-        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=album&q=blah&thumbsize=72c%2C104u%2Cd'), 
-        'URL is user/foobar with expected arguments') or diag explain $request->{new_args}[2];
+        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=album'), 
+        'URL is user/foobar with expected arguments') or diag $request->{new_args}[2];
 
     # Setup the list photos response
     $self->set_response_content('list_media_entries');
@@ -41,11 +41,11 @@ test plan => 2, user_list_comments_ok => sub {
     my $service = $self->service;
     my $request = $self->request;
     
-    $service->list_comments( user_id => 'foobar', q => 'blah' );
+    $service->list_comments( user_id => 'foobar' );
     is($request->{new_args}[1], 'GET', 'method is GET');
     ok(URI::eq($request->{new_args}[2], 
-        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=comment&q=blah'), 
-        'URL is user/foobar');
+        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=comment'), 
+        'URL is user/foobar') or diag $request->{new_args}[2];
 };
 
 1;
@@ -73,11 +73,11 @@ test plan => 37, list_media_entries_ok => sub {
         is($thumbnail->width, 288, 'photo thumbnail width is 288');
     }
 
-    $service->list_photos( user_id => 'foobar', q => 'blah' );
+    $service->list_photos( user_id => 'foobar' );
     is($request->{new_args}[1], 'GET', 'method is GET');
-    ok(URI::eq($request->{new_args}[2], 
-        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=photo&q=blah'), 
-        'URL is user/foobar');
+	ok(URI::eq($request->{new_args}[2], 
+        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=photo'), 
+        'URL is user/foobar') or diag $request->{new_args}[2];
 
     # Setup the list albums response
     $self->set_response_content('list_tags');
@@ -36,11 +36,11 @@ test plan => 2, user_list_tags_ok => sub {
     my $service = $self->service;
     my $request = $self->request;
 
-    $service->list_tags( user_id => 'foobar', q => 'blah' );
+    $service->list_tags( user_id => 'foobar' );
     is($request->{new_args}[1], 'GET', 'method is GET');
     ok(URI::eq($request->{new_args}[2], 
-        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=tag&q=blah'), 
-        'URL is user/foobar');
+        'http://picasaweb.google.com/data/feed/api/user/foobar?kind=tag'), 
+        'URL is user/foobar') or diag $request->{new_args}[2];
 };
 
 1;
@@ -75,6 +75,7 @@ setup order => -10, setup_mock_request => sub {
     $request->set_always('header', '');
     $request->set_always('content', '');
 
+    $request->mock(push_header => sub { });
     $request->mock('-new_args', sub { delete $request->{new_args} });
 
     $self->request($request);
@@ -12,7 +12,6 @@ sub limit_to($@) {
     my $max = shift;
     return () unless @_;
 
-#    return @_;
     return @_ if @_ <= $max;
 
     my @list = shuffle(@_);
@@ -1,8 +1,18 @@
 use Test::Able::Runner;
 use Test::Builder;
+use Net::Netrc;
 
 {
     no warnings 'once';
+
+    # Fallback to ~/.netrc
+    if (not defined $ENV{TEST_NGP_USER}) {
+        my $mach = Net::Netrc->lookup("picasaweb.google.com");
+        if ($mach) {
+            $ENV{TEST_NGP_USER} = $mach->login;
+            $ENV{TEST_NGP_PWD}  = $mach->password;
+        }
+    }
     $Net::Google::PicasaWeb::Test::USER = $ENV{TEST_NGP_USER};
     $Net::Google::PicasaWeb::Test::PWD  = $ENV{TEST_NGP_PWD};
 }