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

antgel-guest at users.alioth.debian.org antgel-guest at users.alioth.debian.org
Wed May 12 11:13:42 UTC 2010


Author: antgel-guest
Date: Wed May 12 11:13:26 2010
New Revision: 57830

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

Added:
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/Trends.pm
Removed:
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/OAuth/
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/Makefile.PL
    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/Search.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/OAuth.pm
    branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Search.pm
    branches/upstream/libnet-twitter-perl/current/t/13_search.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=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/Changes (original)
+++ branches/upstream/libnet-twitter-perl/current/Changes Wed May 12 11:13:26 2010
@@ -1,3 +1,9 @@
+3.13001 2010-11
+    - use POST with Authorization header for XAuth (per Twitter documentation)
+    - replace homegrown XAuth support with Net::OAuth's native support
+    - accommodate 2 base URLs for API::Search (search and trends* methods use different base URLs)
+    - enable SSL support for API::Search
+
 3.13000 2010-05-09
     - added support and documentation for optional timeline parameter skip_user
     - fixed tests: plan was called twice when LWP was too old

Modified: branches/upstream/libnet-twitter-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/MANIFEST?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-twitter-perl/current/MANIFEST Wed May 12 11:13:26 2010
@@ -21,10 +21,10 @@
 lib/Net/Twitter/Core.pm
 lib/Net/Twitter/Error.pm
 lib/Net/Twitter/OAuth.pm
-lib/Net/Twitter/OAuth/XAuthRequest.pm
 lib/Net/Twitter/Role/API/Lists.pm
 lib/Net/Twitter/Role/API/REST.pm
 lib/Net/Twitter/Role/API/Search.pm
+lib/Net/Twitter/Role/API/Search/Trends.pm
 lib/Net/Twitter/Role/API/TwitterVision.pm
 lib/Net/Twitter/Role/InflateObjects.pm
 lib/Net/Twitter/Role/Legacy.pm

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=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/META.yml (original)
+++ branches/upstream/libnet-twitter-perl/current/META.yml Wed May 12 11:13:26 2010
@@ -38,7 +38,7 @@
   Moose::Role: 0
   MooseX::MultiInitArg: 0
   Net::Netrc: 0
-  Net::OAuth: 0.2
+  Net::OAuth: 0.25
   Scalar::Util: 0
   Try::Tiny: 0
   URI: 1.4
@@ -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.13000
+version: 3.13001

Modified: branches/upstream/libnet-twitter-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/Makefile.PL?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/Makefile.PL (original)
+++ branches/upstream/libnet-twitter-perl/current/Makefile.PL Wed May 12 11:13:26 2010
@@ -32,7 +32,7 @@
 requires    'Moose::Role';
 requires    'MooseX::MultiInitArg';
 requires    'namespace::autoclean'      => 0.09;
-requires    'Net::OAuth'                => 0.20;
+requires    'Net::OAuth'                => 0.25;
 requires    'URI'                       => 1.40;
 requires    'URI::Escape';
 requires    'Try::Tiny';

Modified: branches/upstream/libnet-twitter-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/README?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/README (original)
+++ branches/upstream/libnet-twitter-perl/current/README Wed May 12 11:13:26 2010
@@ -2,7 +2,7 @@
     Net::Twitter - A perl interface to the Twitter API
 
 VERSION
-    This document describes Net::Twitter version 3.13000
+    This document describes Net::Twitter version 3.13001
 
 SYNOPSIS
       use Net::Twitter;

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=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Identica.pm Wed May 12 11:13:26 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.13000';
+our $VERSION = '3.13001';
 $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=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pm Wed May 12 11:13:26 2010
@@ -11,7 +11,7 @@
 );
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.13000';
+our $VERSION = '3.13001';
 
 $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=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter.pod Wed May 12 11:13:26 2010
@@ -4,7 +4,7 @@
 
 =head1 VERSION
 
-This document describes Net::Twitter version 3.13000
+This document describes Net::Twitter version 3.13001
 
 =head1 SYNOPSIS
 

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=57830&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 Wed May 12 11:13:26 2010
@@ -17,7 +17,7 @@
 use namespace::autoclean;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.13000';
+our $VERSION = '3.13001';
 
 $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=57830&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 Wed May 12 11:13:26 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.13000';
+our $VERSION = '3.13001';
 $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/Search.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search.pm?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search.pm Wed May 12 11:13:26 2010
@@ -4,7 +4,15 @@
 use Net::Twitter::API;
 use DateTime::Format::Strptime;
 
-has searchapiurl   => ( isa => 'Str', is => 'rw', default => 'http://api.twitter.com/1' );
+with 'Net::Twitter::Role::API::Search::Trends';
+
+has searchapiurl   => ( isa => 'Str', is => 'rw', default => 'http://search.twitter.com' );
+
+after BUILD => sub {
+    my $self = shift;
+
+    $self->{searchapiurl} =~ s/^http:/https:/ if $self->ssl;
+};
 
 base_url     'searchapiurl';
 authenticate 0;
@@ -28,54 +36,6 @@
     method   => 'GET',
     params   => [qw/q callback lang rpp page since_id geocode show_user/],
     required => [qw/q/],
-    returns  => 'HashRef',
-);
-
-twitter_api_method trends => (
-    description => <<'',
-Returns the top ten queries that are currently trending on Twitter.  The
-response includes the time of the request, the name of each trending topic, and
-the url to the Twitter Search results page for that topic.
-
-    path     => 'trends',
-    method   => 'GET',
-    params   => [qw//],
-    required => [qw//],
-    returns  => 'ArrayRef[Query]',
-);
-
-twitter_api_method trends_current => (
-    description => <<'',
-Returns the current top ten trending topics on Twitter.  The response includes
-the time of the request, the name of each trending topic, and query used on
-Twitter Search results page for that topic.
-
-    path     => 'trends/current',
-    method   => 'GET',
-    params   => [qw/exclude/],
-    required => [qw//],
-    returns  => 'HashRef',
-);
-
-twitter_api_method trends_daily => (
-    description => <<'',
-Returns the top 20 trending topics for each hour in a given day.
-
-    path     => 'trends/daily',
-    method   => 'GET',
-    params   => [qw/date exclude/],
-    required => [qw//],
-    returns  => 'HashRef',
-);
-
-twitter_api_method trends_weekly => (
-    description => <<'',
-Returns the top 30 trending topics for each day in a given week.
-
-    path     => 'trends/weekly',
-    method   => 'GET',
-    params   => [qw/date exclude/],
-    required => [qw//],
     returns  => 'HashRef',
 );
 

Added: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/Trends.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/Trends.pm?rev=57830&op=file
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/Trends.pm (added)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/API/Search/Trends.pm Wed May 12 11:13:26 2010
@@ -1,0 +1,122 @@
+package Net::Twitter::Role::API::Search::Trends;
+
+use Moose::Role;
+use Net::Twitter::API;
+
+has search_trends_api_url   => ( isa => 'Str', is => 'rw', default => 'http://api.twitter.com/1' );
+
+after BUILD => sub {
+    my $self = shift;
+
+    $self->{search_trends_api_url} =~ s/^http:/https:/ if $self->ssl;
+};
+
+base_url     'search_trends_api_url';
+authenticate 0;
+
+twitter_api_method trends => (
+    description => <<'',
+Returns the top ten queries that are currently trending on Twitter.  The
+response includes the time of the request, the name of each trending topic, and
+the url to the Twitter Search results page for that topic.
+
+    path     => 'trends',
+    method   => 'GET',
+    params   => [qw//],
+    required => [qw//],
+    returns  => 'ArrayRef[Query]',
+);
+
+twitter_api_method trends_current => (
+    description => <<'',
+Returns the current top ten trending topics on Twitter.  The response includes
+the time of the request, the name of each trending topic, and query used on
+Twitter Search results page for that topic.
+
+    path     => 'trends/current',
+    method   => 'GET',
+    params   => [qw/exclude/],
+    required => [qw//],
+    returns  => 'HashRef',
+);
+
+twitter_api_method trends_daily => (
+    description => <<'',
+Returns the top 20 trending topics for each hour in a given day.
+
+    path     => 'trends/daily',
+    method   => 'GET',
+    params   => [qw/date exclude/],
+    required => [qw//],
+    returns  => 'HashRef',
+);
+
+twitter_api_method trends_weekly => (
+    description => <<'',
+Returns the top 30 trending topics for each day in a given week.
+
+    path     => 'trends/weekly',
+    method   => 'GET',
+    params   => [qw/date exclude/],
+    required => [qw//],
+    returns  => 'HashRef',
+);
+
+1;
+
+__END__
+
+=head1 NAME
+
+Net::Twitter::Role::API::Search::Trends - A definition of the Twitter Search Trends API as a Moose role
+
+=head1 SYNOPSIS
+
+  package My::Twitter;
+  use Moose;
+  with 'Net::Twitter::API::Search';
+
+=head1 DESCRIPTION
+
+B<Net::Twitter::Role::API::Search::Trends> provides definitions for all the
+Twitter Search Trends API methods. You probably don't want to use it directly.
+It is included when you use C<Search::API>.  The trends methods were factored
+out into their own class when Twitter changed the base URL for trends so that
+it differs from search.
+
+=head1 AUTHOR
+
+Marc Mims <marc at questright.com>
+
+=head1 LICENSE
+
+Copyright (c) 2010 Marc Mims
+
+The Twitter API itself, and the description text used in this module is:
+
+Copyright (c) 2009 Twitter
+
+This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
+
+=head1 DISCLAIMER OF WARRANTY
+
+BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
+EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
+YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR, OR CORRECTION.
+
+IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
+LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.

Modified: branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/OAuth.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/OAuth.pm?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/OAuth.pm (original)
+++ branches/upstream/libnet-twitter-perl/current/lib/Net/Twitter/Role/OAuth.pm Wed May 12 11:13:26 2010
@@ -209,18 +209,23 @@
 sub xauth {
     my ( $self, $username, $password ) = @_;
 
-    require Net::Twitter::OAuth::XAuthRequest;
-    my $uri = $self->xauth_url;
-    my $request = $self->_make_oauth_request(
-        '+Net::Twitter::OAuth::XAuthRequest',
-        request_url     => $uri,
+    my @args = (
         x_auth_username => $username,
         x_auth_password => $password,
         x_auth_mode     => 'client_auth',
     );
 
-    my $res = $self->ua->get($request->to_url);
-    die "GET $uri failed: ".$res->status_line
+    my $uri = $self->xauth_url;
+    my $request = $self->_make_oauth_request(
+        'XauthAccessToken',
+        request_url    => $uri,
+        request_method => 'POST',
+        @args,
+    );
+
+    my $res = $self->ua->request(
+        POST $uri, \@args, Authorization => $request->to_authorization_header);
+    die "POST $uri failed: ".$res->status_line
         unless $res->is_success;
 
     # reuse $uri to extract parameters from content

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=57830&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 Wed May 12 11:13:26 2010
@@ -2,7 +2,7 @@
 use Moose;
 
 # use *all* digits for fBSD ports
-our $VERSION = '3.13000';
+our $VERSION = '3.13001';
 $VERSION = eval $VERSION; # numify for warning-free dev releases
 
 extends 'Net::Twitter::Core';

Modified: branches/upstream/libnet-twitter-perl/current/t/13_search.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libnet-twitter-perl/current/t/13_search.t?rev=57830&op=diff
==============================================================================
--- branches/upstream/libnet-twitter-perl/current/t/13_search.t (original)
+++ branches/upstream/libnet-twitter-perl/current/t/13_search.t Wed May 12 11:13:26 2010
@@ -7,7 +7,7 @@
 eval 'use TestUA';
 plan skip_all => 'LWP::UserAgent 5.819 required' if $@;
 
-plan tests => 3;
+plan tests => 5;
 
 use Net::Twitter;
 
@@ -35,3 +35,8 @@
 # additional args in a HASH ref
 $r = $nt->search($search_term, { page => 2 });
 is $args{page}, 2, "page parameter set";
+
+like $request->uri, qr(/search.twitter.com/), 'search endpoint';
+
+$nt->trends;
+like $request->uri, qr(/api.twitter.com/1/), 'trends endpoint';




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