File Coverage

blib/lib/Net/Twitter/Role/API/Search.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Net::Twitter::Role::API::Search;
2             $Net::Twitter::Role::API::Search::VERSION = '4.01010';
3 13     13   8805 use Moose::Role;
  13         3009  
  13         94  
4 13     13   49212 use Net::Twitter::API;
  13         24  
  13         85  
5 13     13   7511 use DateTime::Format::Strptime;
  13         21  
  13         2935  
6              
7             with 'Net::Twitter::Role::API::Search::Trends';
8             excludes 'Net::Twitter::Role::API::RESTv1_1';
9              
10             has searchapiurl => ( isa => 'Str', is => 'rw', default => 'http://search.twitter.com' );
11              
12             after BUILD => sub {
13             my $self = shift;
14              
15             $self->{searchapiurl} =~ s/^http:/https:/ if $self->ssl;
16             };
17              
18             base_url 'searchapiurl';
19             authenticate 0;
20              
21             our $DATETIME_PARSER = DateTime::Format::Strptime->new(pattern => '%a, %d %b %Y %T %z');
22             datetime_parser $DATETIME_PARSER;
23              
24             twitter_api_method search => (
25             description => <<'EOT',
26             Returns a HASH reference with some meta-data about the query including the
27             C<next_page>, C<refresh_url>, and C<max_id>. The statuses are returned in
28             C<results>. To iterate over the results, use something similar to:
29              
30             my $r = $nt->search($search_term);
31             my $r = $nt->search({ q => $search_term, count => 10 })
32              
33             for my $status ( @{$r->{results}} ) {
34             print "$status->{text}\n";
35             }
36             EOT
37              
38             path => 'search',
39             method => 'GET',
40             params => [qw/q geocode lang locale result_type count until since_id max_id include_entities callback/],
41             required => [qw/q/],
42             returns => 'HashRef',
43             );
44              
45             1;
46              
47             __END__
48              
49             =head1 NAME
50              
51             Net::Twitter::Role::API::Search - A definition of the Twitter Search API as a Moose role
52              
53             =head1 VERSION
54              
55             version 4.01010
56              
57             =head1 SYNOPSIS
58              
59             package My::Twitter;
60             use Moose;
61             with 'Net::Twitter::API::Search';
62              
63             =head1 DESCRIPTION
64              
65             B<Net::Twitter::Role::API::Search> provides definitions for all the Twitter Search API
66             methods. Applying this role to any class provides methods for all of the
67             Twitter Search API methods.
68              
69              
70             =head1 AUTHOR
71              
72             Marc Mims <marc@questright.com>
73              
74             =head1 LICENSE
75              
76             Copyright (c) 2009 Marc Mims
77              
78             The Twitter API itself, and the description text used in this module is:
79              
80             Copyright (c) 2009 Twitter
81              
82             This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
83              
84             =head1 DISCLAIMER OF WARRANTY
85              
86             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
87             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
88             OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
89             PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
90             EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
91             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
92             ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
93             YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
94             NECESSARY SERVICING, REPAIR, OR CORRECTION.
95              
96             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
97             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
98             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
99             LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
100             OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
101             THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
102             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
103             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
104             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
105             SUCH DAMAGES.