r54785 - in /branches/upstream/libnet-twitter-perl/current: ./ lib/Net/ lib/Net/Twitter/ lib/Net/Twitter/Role/API/ t/

franck at users.alioth.debian.org franck at users.alioth.debian.org
Thu Mar 25 22:36:00 UTC 2010


Author: franck
Date: Thu Mar 25 22:35:53 2010
New Revision: 54785

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=54785
Log:
[svn-upgrade] Integrating new upstream version, libnet-twitter-perl (3.12000)

Modified:
    branches/upstream/libnet-twitter-perl/current/Changes
    branches/upstream/libnet-twitter-perl/current/META.yml
    branches/upstream/libnet-twitter-perl/current/README
    branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/API.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Core.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/REST.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm
    branches/upstream/libnet-twitter-perl/current/t/20_generated.t
    branches/upstream/libnet-twitter-perl/current/t/51_since.t

Modified: branches/upstream/libnet-twitter-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/Changes?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/Changes (original)
+++ branches/upstream/libnet-twitter-perl/current/Changes Thu Mar 25 22:35:53 2010
@@ -1,3 +1,7 @@
+3.12000 2010-03-19
+    - added new API methods: retweeted_by and retweeted_by_ids
+    - fixed: t/51_since.t was actually connecting to twitter
+
 3.11012 2010-03-13
     - fixed: added fallback since Test::More 0.95_01 does not stringify in "is" (tokuhirom)
 

Modified: branches/upstream/libnet-twitter-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/META.yml?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/META.yml (original)
+++ branches/upstream/libnet-twitter-perl/current/META.yml Thu Mar 25 22:35:53 2010
@@ -50,4 +50,4 @@
   homepage: http://github.com/semifor/Net-Twitter
   license: http://dev.perl.org/licenses/
   repository: git://github.com/semifor/Net-Twitter.git
-version: 3.11012
+version: 3.12000

Modified: branches/upstream/libnet-twitter-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/README?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/README (original)
+++ branches/upstream/libnet-twitter-perl/current/README Thu Mar 25 22:35:53 2010
@@ -2,7 +2,7 @@
     Net::Twitter - A perl interface to the Twitter API
 
 VERSION
-    This document describes Net::Twitter version 3.11012
+    This document describes Net::Twitter version 3.12000
 
 SYNOPSIS
       use Net::Twitter;
@@ -918,6 +918,27 @@
 
         Returns: Status
 
+    retweeted_by
+    retweeted_by(id)
+
+        Parameters: id, count, page
+        Required: id
+
+        Returns up to 100 users who retweeted the status identified by "id".
+
+        Returns: ArrayRef[User]
+
+    retweeted_by_ids
+    retweeted_by_ids(id)
+
+        Parameters: id, count, page
+        Required: id
+
+        Returns the IDs of up to 100 users who retweeted the status
+        identified by "id".
+
+        Returns: ArrayRef[User]
+
     retweeted_by_me
 
         Parameters: since_id, max_id, count, page

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm Thu Mar 25 22:35:53 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11012';
+our $VERSION = '3.12000';
 $VERSION     = eval $VERSION; # numify for warning-free dev releases
 
 extends 'Net::Twitter::Core';

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm Thu Mar 25 22:35:53 2010
@@ -11,7 +11,7 @@
 );
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11012';
+our $VERSION = '3.12000';
 
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod Thu Mar 25 22:35:53 2010
@@ -4,7 +4,7 @@
 
 =head1 VERSION
 
-This document describes Net::Twitter version 3.11012
+This document describes Net::Twitter version 3.12000
 
 =head1 SYNOPSIS
 
@@ -1239,6 +1239,44 @@
 
 Returns: Status
 
+=item B<retweeted_by>
+
+=item B<retweeted_by(id)>
+
+
+
+=over 4
+
+=item Parameters: id, count, page
+
+=item Required: id
+
+=back
+
+Returns up to 100 users who retweeted the status identified by C<id>.
+
+
+Returns: ArrayRef[User]
+
+=item B<retweeted_by_ids>
+
+=item B<retweeted_by_ids(id)>
+
+
+
+=over 4
+
+=item Parameters: id, count, page
+
+=item Required: id
+
+=back
+
+Returns the IDs of up to 100 users who retweeted the status identified by C<id>.
+
+
+Returns: ArrayRef[User]
+
 =item B<retweeted_by_me>
 
 

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/API.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/API.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/API.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/API.pm Thu Mar 25 22:35:53 2010
@@ -25,18 +25,6 @@
 my $datetime_parser = DateTime::Format::Strptime->new(pattern => '%a %b %d %T %z %Y');
 sub datetime_parser { $datetime_parser = $_[1] }
 
-my $with_url_arg = sub {
-    my ($path, $args) = @_;
-
-    if ( defined(my $id = delete $args->{id}) ) {
-        $path .= uri_escape($id);
-    }
-    else {
-        chop($path);
-    }
-    return $path;
-};
-
 sub twitter_api_method {
     my $caller = shift;
     my $name   = shift;
@@ -46,8 +34,6 @@
 
     my ($arg_names, $path) = @options{qw/required path/};
     $arg_names = $options{params} if @$arg_names == 0 && @{$options{params}} == 1;
-
-    my $modify_path = $path =~ s,/id$,/, ? $with_url_arg : sub { $_[0] };
 
     my $code = sub {
         my $self = shift;
@@ -76,7 +62,10 @@
             }
         }
 
-        my $local_path = $modify_path->($path, $args);
+        # replace placeholder arguments
+        my $local_path = $path;
+        $local_path =~ s,/:id$,, unless exists $args->{id}; # remove optional trailing id
+        $local_path =~ s/:(\w+)/delete $args->{$1} or croak "required arg '$1' missing"/eg;
         
         my $uri = URI->new($caller->_base_url($self) . "/$local_path.json");
 

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Core.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Core.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Core.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Core.pm Thu Mar 25 22:35:53 2010
@@ -17,7 +17,7 @@
 use namespace::autoclean;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11012';
+our $VERSION = '3.12000';
 
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth.pm Thu Mar 25 22:35:53 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11012';
+our $VERSION = '3.12000';
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 
 extends  'Net::Twitter::Core';

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/REST.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/REST.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/REST.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/REST.pm Thu Mar 25 22:35:53 2010
@@ -87,7 +87,7 @@
 Retweets a tweet. Requires the id parameter of the tweet you are retweeting.
 Returns the original tweet with retweet details embedded.
 
-    path      => 'statuses/retweet/id',
+    path      => 'statuses/retweet/:id',
     method    => 'POST',
     params    => [qw/id/],
     required  => [qw/id/],
@@ -98,7 +98,7 @@
     description => <<'',
 Returns up to 100 of the first retweets of a given tweet.
 
-    path    => 'statuses/retweets/id',
+    path    => 'statuses/retweets/:id',
     method  => 'GET',
     params  => [qw/id count/],
     required => [qw/id/],
@@ -160,7 +160,7 @@
 parameter. This is the equivalent of the Web /archive page for
 your own user, or the profile page for a third party.
 
-    path    => 'statuses/user_timeline/id',
+    path    => 'statuses/user_timeline/:id',
     method  => 'GET',
     params  => [qw/id user_id screen_name since_id max_id count page/],
     required => [],
@@ -189,7 +189,7 @@
 Returns a single status, specified by the id parameter.  The
 status's author will be returned inline.
 
-    path     => 'statuses/show/id',
+    path     => 'statuses/show/:id',
     method   => 'GET',
     params   => [qw/id/],
     required => [qw/id/],
@@ -263,7 +263,7 @@
 Destroys the status specified by the required ID parameter.  The
 authenticating user must be the author of the specified status.
 
-    path     => 'statuses/destroy/id',
+    path     => 'statuses/destroy/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -290,7 +290,7 @@
 EOT
 
     aliases  => [qw/following/],
-    path     => 'statuses/friends/id',
+    path     => 'statuses/friends/:id',
     method   => 'GET',
     params   => [qw/id user_id screen_name cursor/],
     required => [qw//],
@@ -316,7 +316,7 @@
 C<next_cursor> will be 0.
 EOT
 
-    path     => 'statuses/followers/id',
+    path     => 'statuses/followers/:id',
     method   => 'GET',
     params   => [qw/id user_id screen_name cursor/],
     required => [qw//],
@@ -331,7 +331,7 @@
 according to a given user's preferences. You must be properly
 authenticated to request the page of a protected user.
 
-    path     => 'users/show/id',
+    path     => 'users/show/:id',
     method   => 'GET',
     params   => [qw/id/],
     required => [qw/id/],
@@ -382,7 +382,7 @@
 The authenticating user must be the recipient of the specified direct
 message.
 
-    path     => 'direct_messages/destroy/id',
+    path     => 'direct_messages/destroy/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -408,7 +408,7 @@
 failure condition when unsuccessful.
 
     aliases  => [qw/follow_new/],
-    path     => 'friendships/create/id',
+    path     => 'friendships/create/:id',
     method   => 'POST',
     params   => [qw/id user_id screen_name follow/],
     required => [qw/id/],
@@ -422,7 +422,7 @@
 Returns a string describing the failure condition when unsuccessful.
 
     aliases  => [qw/unfollow/],
-    path     => 'friendships/destroy/id',
+    path     => 'friendships/destroy/:id',
     method   => 'POST',
     params   => [qw/id user_id screen_name/],
     required => [qw/id/],
@@ -458,7 +458,7 @@
 EOT
 
     aliases  => [qw/following_ids/],
-    path     => 'friends/ids/id',
+    path     => 'friends/ids/:id',
     method   => 'GET',
     params   => [qw/id user_id screen_name cursor/],
     required => [qw/id/],
@@ -480,7 +480,7 @@
 there are no subsequent pages, the value of C<next_cursor> will be 0.
 EOT
 
-    path     => 'followers/ids/id',
+    path     => 'followers/ids/:id',
     method   => 'GET',
     params   => [qw/id user_id screen_name cursor/],
     required => [qw/id/],
@@ -638,7 +638,7 @@
 Returns the 20 most recent favorite statuses for the authenticating
 user or user specified by the ID parameter.
 
-    path     => 'favorites/id',
+    path     => 'favorites/:id',
     method   => 'GET',
     params   => [qw/id page/],
     required => [qw//],
@@ -650,7 +650,7 @@
 Favorites the status specified in the ID parameter as the
 authenticating user.  Returns the favorite status when successful.
 
-    path     => 'favorites/create/id',
+    path     => 'favorites/create/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -662,7 +662,7 @@
 Un-favorites the status specified in the ID parameter as the
 authenticating user.  Returns the un-favorited status.
 
-    path     => 'favorites/destroy/id',
+    path     => 'favorites/destroy/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -674,7 +674,7 @@
 Enables notifications for updates from the specified user to the
 authenticating user.  Returns the specified user when successful.
 
-    path     => 'notifications/follow/id',
+    path     => 'notifications/follow/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -686,7 +686,7 @@
 Disables notifications for updates from the specified user to the
 authenticating user.  Returns the specified user when successful.
 
-    path     => 'notifications/leave/id',
+    path     => 'notifications/leave/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -699,7 +699,7 @@
 Returns the blocked user when successful.  You can find out more about
 blocking in the Twitter Support Knowledge Base.
 
-    path     => 'blocks/create/id',
+    path     => 'blocks/create/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -712,7 +712,7 @@
 Un-blocks the user specified in the ID parameter as the authenticating user.
 Returns the un-blocked user when successful.
 
-    path     => 'blocks/destroy/id',
+    path     => 'blocks/destroy/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -725,7 +725,7 @@
 Returns if the authenticating user is blocking a target user. Will return the blocked user's
 object if a block exists, and error with HTTP 404 response code otherwise.
 
-    path     => 'blocks/exists/id',
+    path     => 'blocks/exists/:id',
     method   => 'GET',
     params   => [qw/id user_id screen_name/],
     required => [qw/id/],
@@ -795,7 +795,7 @@
     description => <<'',
 Retrieve the data for a saved search, by C<id>, owned by the authenticating user.
 
-    path     => 'saved_searches/show/id',
+    path     => 'saved_searches/show/:id',
     method   => 'GET',
     params   => [qw/id/],
     required => [qw/id/],
@@ -806,7 +806,7 @@
     description => <<'',
 Retrieve the data for a saved search, by ID, owned by the authenticating user.
 
-    path     => 'saved_searches/show/id',
+    path     => 'saved_searches/show/:id',
     method   => 'GET',
     params   => [qw/id/],
     required => [qw/id/],
@@ -829,7 +829,7 @@
 Destroys a saved search. The search, specified by C<id>, must be owned
 by the authenticating user.
 
-    path     => 'saved_searches/destroy/id',
+    path     => 'saved_searches/destroy/:id',
     method   => 'POST',
     params   => [qw/id/],
     required => [qw/id/],
@@ -957,7 +957,7 @@
 );
 
 twitter_api_method geo_id => (
-    path => 'geo/id/id',
+    path => 'geo/id/:id',
     method => 'GET',
     params => [qw/id/],
     required => [qw/id/],
@@ -998,6 +998,28 @@
 EOT
 );
 
+twitter_api_method retweeted_by => (
+    path => 'statuses/:id/retweeted_by',
+    method => 'GET',
+    params => [qw/id count page/],
+    required => [qw/id/],
+    returns  => 'ArrayRef[User]',
+    description => <<''
+Returns up to 100 users who retweeted the status identified by C<id>.
+
+);
+
+twitter_api_method retweeted_by_ids => (
+    path     => 'statuses/:id/retweeted_by/ids',
+    method   => 'GET',
+    params   => [qw/id count page/],
+    required => [qw/id/],
+    returns  => 'ArrayRef[User]',
+    description => <<''
+Returns the IDs of up to 100 users who retweeted the status identified by C<id>.
+
+);
+
 around lookup_users => sub {
     my $orig = shift;
     my $self = shift;

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm Thu Mar 25 22:35:53 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11012';
+our $VERSION = '3.12000';
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 
 extends 'Net::Twitter::Core';

Modified: branches/upstream/libnet-twitter-perl/current/t/20_generated.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/20_generated.t?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/20_generated.t (original)
+++ branches/upstream/libnet-twitter-perl/current/t/20_generated.t Thu Mar 25 22:35:53 2010
@@ -31,7 +31,7 @@
 
         $pos_params = $entry->params if @$pos_params == 0 && @{$entry->params} == 1;
 
-        my $has_id = $path =~ s|/id$|/$params[0]|;
+        my $has_id = $path =~ s/:id\b/$params[0]/;
         if ( $has_id && @$pos_params == 0 ) {
             @$pos_params = 'id';
         }
@@ -53,7 +53,7 @@
             my $args = $t->args;
             ok !$has_id || (
                     delete $expected{id} &&
-                    $t->path =~ /\/twitter_id\.json/
+                    $t->path =~ /\/twitter_id[\/.]/
                 ), "id test";
 
             is_deeply $args, \%expected,    "[$pass] $call args";

Modified: branches/upstream/libnet-twitter-perl/current/t/51_since.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/51_since.t?rev=54785&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/51_since.t (original)
+++ branches/upstream/libnet-twitter-perl/current/t/51_since.t Thu Mar 25 22:35:53 2010
@@ -1,9 +1,9 @@
 #!perl
 use warnings;
 use strict;
+use Try::Tiny;
 use Scalar::Util qw/blessed/;
-use Test::More;
-use Test::Exception;
+use Test::More tests => 8;
 use lib qw(t/lib);
 
 eval 'use TestUA';
@@ -49,9 +49,25 @@
             $dt - DateTime::Duration->new(days => 1)) });
 cmp_ok @$r, '==', 1,  'filtered with string in Twitter timestamp format';
 
-dies_ok { $r = $nt->friends_timeline({ since => 'not a date' }) } 'dies on invalid since';
+my $test = 'dies on invalid since';
+try {
+    $r = $nt->friends_timeline({ since => 'not a date' });
+    fail $test;
+}
+catch { pass $test };
 
 $nt = Net::Twitter->new(traits => [qw/API::Search/]);
-lives_ok { $r = $nt->search({ q => 'perl', since => '2009-10-05' }) } 'YYYY-MM-DD';
+$nt->ua->add_handler(request_send => sub {
+        my $res = HTTP::Response->new(200);
+        $res->content('{"test":"done"}');
+        return $res;
+});
 
-done_testing;
+$test = 'YYYY-MM-DD';
+try {
+    $r = $nt->search({ q => 'perl', since => '2009-10-05' });
+    pass $test;
+}
+catch {
+    fail "$test: $_";
+};




More information about the Pkg-perl-cvs-commits mailing list