Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

"trends" api method deprecated; warn and call trends_location(1)

  • Loading branch information...
commit ce75772290aa0c638b3316108117a3662964f6a0 1 parent 67c38cd
@semifor authored
Showing with 22 additions and 0 deletions.
  1. +2 −0  Changes
  2. +20 −0 lib/Net/Twitter/Role/API/REST.pm
View
2  Changes
@@ -1,3 +1,5 @@
+ - added deprecation warning for 'trends'; calls trends_location(1), instead
+
3.18001 2011-09-29
- fixed: AutoCursor:
- no behavior change when user passes "cursor" arg
View
20 lib/Net/Twitter/Role/API/REST.pm
@@ -1,5 +1,6 @@
package Net::Twitter::Role::API::REST;
use Moose::Role;
+use Carp;
use Net::Twitter::API;
use DateTime::Format::Strptime;
use URI;
@@ -999,8 +1000,27 @@ the url to the Twitter Search results page for that topic.
required => [qw//],
authenticate => 0,
returns => 'ArrayRef[Query]',
+ deprecated => 1,
);
+my $trends_deprecation_warned = 0;
+around trends => sub {
+ my $orig = shift;
+ my $self = shift;
+
+ my $args = ref $_[-1] eq ref {} ? pop : {};
+
+ $trends_deprecation_warned ||= do {
+ local $Carp::CarpLevel = 3;
+ carp "The 'trends' API method has been deprecated; instead, use trends_location({ woeid => 1 })";
+ 1;
+ };
+
+ $args->{woeid} = 1;
+
+ return $self->trends_location(@_, $args);
+};
+
twitter_api_method trends_current => (
description => <<'',
Returns the current top ten trending topics on Twitter. The response includes
Please sign in to comment.
Something went wrong with that request. Please try again.