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

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Mar 12 12:26:24 UTC 2010


Author: jawnsy-guest
Date: Fri Mar 12 12:26:16 2010
New Revision: 54170

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

Added:
    branches/upstream/libnet-twitter-perl/current/t/lookup_users.t
Modified:
    branches/upstream/libnet-twitter-perl/current/Changes
    branches/upstream/libnet-twitter-perl/current/MANIFEST
    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/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/src/build.pl
    branches/upstream/libnet-twitter-perl/current/t/02_fails.t
    branches/upstream/libnet-twitter-perl/current/t/15_subclass.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=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/Changes (original)
+++ branches/upstream/libnet-twitter-perl/current/Changes Fri Mar 12 12:26:16 2010
@@ -1,3 +1,9 @@
+3.11011 2010-03-11
+    - fixed documentation to include lookup_users
+
+3.11010 2010-03-11
+    - Added lookup_users API method
+
 3.11009 2010-03-10
     - Added RetryOnError trait (see perldoc Net::Twitter::Role::RetryOnError)
     - Import Sclar::Util::blessed in the POD Synopsis to make it clear callers need to do so (RT#55283)

Modified: branches/upstream/libnet-twitter-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/MANIFEST?rev=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-twitter-perl/current/MANIFEST Fri Mar 12 12:26:16 2010
@@ -64,5 +64,6 @@
 t/99-pod_syntax.t
 t/geo.t
 t/lib/TestUA.pm
+t/lookup_users.t
 t/retry.t
 t/unicode.t

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=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/META.yml (original)
+++ branches/upstream/libnet-twitter-perl/current/META.yml Fri Mar 12 12:26:16 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.11009
+version: 3.11011

Modified: branches/upstream/libnet-twitter-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/README?rev=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/README (original)
+++ branches/upstream/libnet-twitter-perl/current/README Fri Mar 12 12:26:16 2010
@@ -2,7 +2,7 @@
     Net::Twitter - A perl interface to the Twitter API
 
 VERSION
-    This document describes Net::Twitter version 3.11009
+    This document describes Net::Twitter version 3.11011
 
 SYNOPSIS
       use Net::Twitter;
@@ -808,6 +808,34 @@
 
         Returns: ArrayRef[Status]
 
+    lookup_users
+
+        Parameters: user_id, screen_name
+        Required: *none*
+
+        Return up to 20 users worth of extended information, specified by
+        either ID, screen name, or combination of the two. The author's most
+        recent status (if the authenticating user has permission) will be
+        returned inline. This method is rate limited to 1000 calls per hour.
+
+        This method will accept user IDs or screen names as either a comma
+        delimited string, or as an ARRAY ref. It will also accept arguments
+        in the normal HASHREF form or as a simple list of named arguments.
+        I.e., any of the following forms are acceptable:
+
+            $nt->lookup_users({ user_id => '1234,6543,3333' });
+            $nt->lookup_users(user_id => '1234,6543,3333');
+            $nt->lookup_users({ user_id => [ 1234, 6543, 3333 ] });
+            $nt->lookup_users({ screen_name => 'fred,barney,wilma' });
+            $nt->lookup_users(screen_name => ['fred', 'barney', 'wilma']);
+
+            $nt->lookup_users(
+                screen_name => ['fred', 'barney' ],
+                user_id     => '4321,6789',
+            );
+
+        Returns: ArrayRef[User]
+
     mentions
     alias: replies
 

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=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm Fri Mar 12 12:26:16 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11009';
+our $VERSION = '3.11011';
 $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=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm Fri Mar 12 12:26:16 2010
@@ -11,7 +11,7 @@
 );
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11009';
+our $VERSION = '3.11011';
 
 $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=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod Fri Mar 12 12:26:16 2010
@@ -4,7 +4,7 @@
 
 =head1 VERSION
 
-This document describes Net::Twitter version 3.11009
+This document describes Net::Twitter version 3.11011
 
 =head1 SYNOPSIS
 
@@ -1073,6 +1073,43 @@
 
 Returns: ArrayRef[Status]
 
+=item B<lookup_users>
+
+
+
+=over 4
+
+=item Parameters: user_id, screen_name
+
+=item Required: I<none>
+
+=back
+
+Return up to 20 users worth of extended information, specified by either ID,
+screen name, or combination of the two. The author's most recent status (if the
+authenticating user has permission) will be returned inline.  This method is
+rate limited to 1000 calls per hour.
+
+This method will accept user IDs or screen names as either a comma delimited
+string, or as an ARRAY ref.  It will also accept arguments in the normal
+HASHREF form or as a simple list of named arguments.  I.e., any of the
+following forms are acceptable:
+
+    $nt->lookup_users({ user_id => '1234,6543,3333' });
+    $nt->lookup_users(user_id => '1234,6543,3333');
+    $nt->lookup_users({ user_id => [ 1234, 6543, 3333 ] });
+    $nt->lookup_users({ screen_name => 'fred,barney,wilma' });
+    $nt->lookup_users(screen_name => ['fred', 'barney', 'wilma']);
+
+    $nt->lookup_users(
+        screen_name => ['fred', 'barney' ],
+        user_id     => '4321,6789',
+    );
+
+
+
+Returns: ArrayRef[User]
+
 =item B<mentions>
 
 

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=54170&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 Fri Mar 12 12:26:16 2010
@@ -17,7 +17,7 @@
 use namespace::autoclean;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11009';
+our $VERSION = '3.11011';
 
 $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=54170&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 Fri Mar 12 12:26:16 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11009';
+our $VERSION = '3.11011';
 $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=54170&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 Fri Mar 12 12:26:16 2010
@@ -967,6 +967,51 @@
 EOT
 );
 
+twitter_api_method lookup_users => (
+    path => 'users/lookup',
+    method => 'GET',
+    params => [qw/user_id screen_name/],
+    required => [],
+    returns => 'ArrayRef[User]',
+    description => <<'EOT'
+Return up to 20 users worth of extended information, specified by either ID,
+screen name, or combination of the two. The author's most recent status (if the
+authenticating user has permission) will be returned inline.  This method is
+rate limited to 1000 calls per hour.
+
+This method will accept user IDs or screen names as either a comma delimited
+string, or as an ARRAY ref.  It will also accept arguments in the normal
+HASHREF form or as a simple list of named arguments.  I.e., any of the
+following forms are acceptable:
+
+    $nt->lookup_users({ user_id => '1234,6543,3333' });
+    $nt->lookup_users(user_id => '1234,6543,3333');
+    $nt->lookup_users({ user_id => [ 1234, 6543, 3333 ] });
+    $nt->lookup_users({ screen_name => 'fred,barney,wilma' });
+    $nt->lookup_users(screen_name => ['fred', 'barney', 'wilma']);
+
+    $nt->lookup_users(
+        screen_name => ['fred', 'barney' ],
+        user_id     => '4321,6789',
+    );
+
+EOT
+);
+
+around lookup_users => sub {
+    my $orig = shift;
+    my $self = shift;
+
+    my $args = ref $_[-1] eq 'HASH' ? pop @_ : {};
+    $args = { %$args, @_ };
+
+    for ( qw/screen_name user_id/ ) {
+        $args->{$_} = join(',' => @{ $args->{$_} }) if ref $args->{$_} eq 'ARRAY';
+    }
+
+    return $orig->($self, $args);
+};
+
 1;
 
 __END__

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=54170&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 Fri Mar 12 12:26:16 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.11009';
+our $VERSION = '3.11011';
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 
 extends 'Net::Twitter::Core';

Modified: branches/upstream/libnet-twitter-perl/current/src/build.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/src/build.pl?rev=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/src/build.pl (original)
+++ branches/upstream/libnet-twitter-perl/current/src/build.pl Fri Mar 12 12:26:16 2010
@@ -23,7 +23,10 @@
     return 
         sort { $a->name cmp $b->name }
         grep {
-            blessed $_  && $_->isa('Net::Twitter::Meta::Method')
+            $_->isa('Net::Twitter::Meta::Method')
+        }
+        map {
+            $_->isa('Class::MOP::Method::Wrapped') ? $_->get_original_method : $_
         } $nt->meta->get_all_methods;
 }
 

Modified: branches/upstream/libnet-twitter-perl/current/t/02_fails.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/02_fails.t?rev=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/02_fails.t (original)
+++ branches/upstream/libnet-twitter-perl/current/t/02_fails.t Fri Mar 12 12:26:16 2010
@@ -24,6 +24,5 @@
 throws_ok {
     Net::Twitter->new(useragent_class => 'NoSuchModule::Test7701')->verify_credentials
 } qr/Can't locate NoSuchModule/, 'bad useragent_class';
-        qr/must not be a reference/, 'extra args';
 
 exit 0;

Modified: branches/upstream/libnet-twitter-perl/current/t/15_subclass.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/15_subclass.t?rev=54170&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/15_subclass.t (original)
+++ branches/upstream/libnet-twitter-perl/current/t/15_subclass.t Fri Mar 12 12:26:16 2010
@@ -51,7 +51,7 @@
     has subclass_attribute => ( reader => 'subclass_method', default => 'attribute value' );
 }
 
-diag 'subclass with new';
+#diag 'subclass with new';
 my $nt1 = My::Subclass::WithNew->new(username => 'me', password => 'secret');
 isa_ok  $nt1, 'Net::Twitter';
 isa_ok  $nt1, 'Net::Twitter::Core';
@@ -60,7 +60,7 @@
 is      $nt1->subclass_method, 'attribute value', 'has subclass attribute value';
 is      $nt1->password, 'secret', 'has base class attribute value';
 
-diag 'subclass without new';
+#diag 'subclass without new';
 my $nt2 = My::Subclass::WithoutNew->new(username => 'me', password => 'secret');
 isa_ok  $nt2, 'Net::Twitter';
 isa_ok  $nt2, 'Net::Twitter::Core';
@@ -71,7 +71,7 @@
 
 TODO: {
 local $TODO = 'Moose classes should subclass Core, not Net::Twitter';
-diag 'Moose subclass';
+#diag 'Moose subclass';
 my $nt3 = My::Subclass::WithMoose->new(username => 'me', password => 'secret');
 isa_ok  $nt3, 'Net::Twitter';
 isa_ok  $nt3, 'Net::Twitter::Core';
@@ -81,7 +81,7 @@
 is      $nt3->password, 'secret', 'has base class attribute value';
 }
 
-diag 'valid Moose subclass';
+#diag 'valid Moose subclass';
 my $nt4 = My::Subclass::ValidMoose->new(username => 'me', password => 'secret');
 ok      !$nt4->isa('Net::Twitter'), 'not created by Net::Twitter';
 isa_ok  $nt4, 'Net::Twitter::Core';
@@ -90,7 +90,7 @@
 is      $nt4->subclass_method, 'attribute value', 'has subclass attribute value';
 is      $nt4->password, 'secret', 'has base class attribute value';
 
-diag 'class reuse';
+#diag 'class reuse';
 is      ref $nt1, ref My::Subclass::WithNew->new, 'reused anon class';
 ok      ref $nt1 ne ref $nt2, 'different subclasses have different anon classes';
 ok      ref $nt1 ne ref My::Subclass::WithNew->new(legacy => 0), 'different roles have different classes';

Added: branches/upstream/libnet-twitter-perl/current/t/lookup_users.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/lookup_users.t?rev=54170&op=file
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/lookup_users.t (added)
+++ branches/upstream/libnet-twitter-perl/current/t/lookup_users.t Fri Mar 12 12:26:16 2010
@@ -1,0 +1,69 @@
+#!perl
+use warnings;
+use strict;
+use Test::More;
+use Net::Twitter;
+
+eval "use LWP::UserAgent 5.819";
+plan skip_all => 'LWP::UserAgent >= 5.819 required' if $@;
+
+eval "use Test::Deep";
+plan skip_all => 'Test::Deep required' if $@;
+
+my @tests = (
+    {
+        args   => [ { user_id => '1234,6543,3333' } ],
+        expect => { user_id => [ 1234, 6543, 3333 ] },
+        name   => 'hash: comma delimited',
+    },
+    {
+        args   => [ user_id => '1234,6543,3333' ],
+        expect => { user_id => [ 1234, 6543, 3333 ] },
+        name   => 'list: comma delimited',
+    },
+    {
+        args   => [ { user_id => [ 1234, 6543, 3333 ] } ],
+        expect => { user_id => [ 1234, 6543, 3333 ] },
+        name   => 'hash: arrayref',
+    },
+    {
+        args   => [ { screen_name => 'fred,barney,wilma' } ],
+        expect => { screen_name => [qw/fred barney wilma/] },
+        name   => 'hash: comma delimited',
+    },
+    {
+        args   => [ screen_name => ['fred', 'barney', 'wilma'] ],
+        expect => { screen_name => [qw/fred barney wilma/] },
+        name   => 'list: arrayref',
+    },
+    {
+        args   => [ screen_name => ['fred', 'barney' ], user_id => '4321,6789' ],
+        expect => { screen_name => [qw/fred barney/], user_id => [ 4321, 6789 ] },
+        name   => 'list: arrayref screen_name and comma delimited user_id',
+    },
+);
+
+my $test_count = 0;
+$test_count += keys %$_ for map { $_->{expect} } @tests;
+
+plan tests => $test_count;
+
+my $nt = Net::Twitter->new(legacy => 0);
+
+my $req;
+$nt->ua->add_handler(request_send => sub {
+    $req = shift;
+    my $res = HTTP::Response->new(200);
+    $res->content('{"test":"ok"}');
+    return $res;
+});
+
+for my $test ( @tests ) {
+    my $r = $nt->lookup_users(@{ $test->{args} });
+
+    my %query = $req->uri->query_form;
+    for my $arg ( keys %{ $test->{expect} } ) {
+        cmp_bag([ split /,/, $query{$arg} ], $test->{expect}{$arg}, "$test->{name} [$arg]");
+    }
+}
+




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