File Coverage

blib/lib/WebService/Technorati.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1              
2             package WebService::Technorati;
3 1     1   31229 use strict;
  1         2  
  1         41  
4 1     1   1585 use utf8;
  1         13  
  1         7  
5              
6 1     1   692 use WebService::Technorati::SearchApiQuery;
  0            
  0            
7             use WebService::Technorati::CosmosApiQuery;
8             use WebService::Technorati::OutboundApiQuery;
9             use WebService::Technorati::AuthorinfoApiQuery;
10             use WebService::Technorati::BloginfoApiQuery;
11              
12             BEGIN {
13             use vars qw ($VERSION);
14             $VERSION = 0.04;
15             }
16              
17             # $Id: Technorati.pm,v 1.4 2004/12/30 23:10:47 ikallen Exp $
18              
19             ########################################### main pod documentation begin ##
20              
21             =head1 NAME
22              
23             WebService::Technorati - a Perl interface to the Technorati web services interface
24              
25             =head1 SYNOPSIS
26              
27             use WebService::Technorati;
28              
29             my $apiKey = 'myverylongstringofcharacters';
30             my $url = 'http://www.arachna.com/roller/page/spidaman';
31             my $t = WebService::Technorati->new(key => $apiKey);
32             my $q = $t->getCosmosApiQuery($url);
33             $q->execute;
34            
35             my $linkedUrl = $q->getLinkQuerySubject();
36             # do something with the linkedUrl
37            
38             my $links = $q->getInboundLinks();
39             for my $link (@$links) {
40             # do something with the link
41             }
42              
43             =head1 DESCRIPTION
44              
45             The Technorati web services interfaces use REST wire protocol with a format
46             described at http://developers.technorati.com/
47              
48             =head1 USAGE
49              
50             Please see the test files in t/ and samples in eg/ for examples on how to use
51             WebServices::Technorati
52              
53             =head1 BUGS
54              
55             No bugs currently open
56              
57             =head1 SUPPORT
58              
59             Join the Technorati developers mailing list at
60             http://mail.technorati.com/mailman/listinfo/developers
61              
62             =head1 AUTHOR
63              
64             Ian Kallen
65             ikallen _at_ technorati.com
66             http://developers.technorati.com
67              
68             =head1 COPYRIGHT
69              
70             This program is free software; you can redistribute
71             it and/or modify it under the terms of the following
72             Creative Commons License:
73             http://creativecommons.org/licenses/by/2.0
74             as well as the indemnification provisions of the
75             Apache 2.0 style license, the full text of which can be
76             found in the LICENSE file included with this module.
77              
78             =head1 SEE ALSO
79              
80             perl(1).
81              
82             =cut
83              
84             ############################################# main pod documentation end ##
85              
86              
87             ################################################ subroutine header begin ##
88              
89             =head2 getCosmosApiQuery
90              
91             Usage : getCosmosApiQuery('http://developers.technorati.com')
92             Purpose : Instantiates a CosmosApiQuery with the given url
93             Returns : WebService::Technorati::CosmosApiQuery
94             Argument : a URL
95             Throws : WebService::Technorati::InstantiationException when called
96             : without an api key
97             Comments : WebService::Technorati::CosmosApiQuery is a Perl interface to the Technorati
98             : web services 'cosmos' interface
99              
100             See Also : WebService::Technorati::CosmosApiQuery
101              
102             =cut
103              
104             sub getCosmosApiQuery {
105             my $self = shift;
106             my $url = shift;
107             my $q = WebService::Technorati::CosmosApiQuery->new(key => $self->{'key'}, url => $url);
108             return $q;
109             }
110              
111             =head2 getSearchApiQuery
112              
113             Usage : getSearchApiQuery('keyword')
114             Purpose : Instantiates a SearchApiQuery with the given keyword
115             Returns : a WebService::Technorati::SearchApiQuery that may be executed
116             Argument : a keyword search term
117             Throws : WebService::Technorati::InstantiationException when called
118             : without an api key
119             Comments : WebService::Technorati::SearchApiQuery is a Perl interface to the Technorati
120             : web services 'search' interface
121              
122             See Also : WebService::Technorati::SearchApiQuery
123              
124             =cut
125              
126             sub getSearchApiQuery {
127             my $self = shift;
128             my $keyword = shift;
129             my $q = WebService::Technorati::SearchApiQuery->new(key => $self->{'key'}, url => $keyword);
130             return $q;
131             }
132              
133              
134             =head2 getOutboundApiQuery
135              
136             Usage : getOutboundApiQuery('http://developers.technorati.com')
137             Purpose : Instantiates a OutboundApiQuery with the given url
138             Returns : WebService::Technorati::OutboundApiQuery
139             Argument : a url
140             Throws : WebService::Technorati::InstantiationException when called
141             : without an api key
142             Comments : WebService::Technorati::OutboundApiQuery is a Perl interface to the Technorati
143             : web services 'outbound' interface
144              
145             See Also : WebService::Technorati::OutboundApiQuery
146              
147             =cut
148              
149             sub getOutboundApiQuery {
150             my $self = shift;
151             my $url = shift;
152             my $q = WebService::Technorati::OutboundApiQuery->new(key => $self->{'key'}, url => $url);
153             return $q;
154             }
155              
156              
157             =head2 getAuthorinfoApiQuery
158              
159             Usage : getAuthorinfoApiQuery('username')
160             Purpose : Instantiates a AuthorinfoApiQuery with the given username
161             Returns : WebService::Technorati::AuthorinfoApiQuery
162             Argument : a url
163             Throws : WebService::Technorati::InstantiationException when called
164             : without an api key
165             Comments : WebService::Technorati::AuthorinfoApiQuery is a Perl interface to the Technorati
166             : web services 'getinfo' interface
167              
168             See Also : WebService::Technorati::AuthorinfoApiQuery
169              
170             =cut
171              
172             sub getAuthorinfoApiQuery {
173             my $self = shift;
174             my $url = shift;
175             my $q = WebService::Technorati::AuthorinfoApiQuery->new(key => $self->{'key'}, url => $url);
176             return $q;
177             }
178              
179              
180             =head2 getBloginfoApiQuery
181              
182             Usage : getBloginfoApiQuery('http://developers.technorati.com')
183             Purpose : Instantiates a BloginfoApiQuery with the given url
184             Returns : WebService::Technorati::BloginfoApiQuery
185             Argument : a url
186             Throws : WebService::Technorati::InstantiationException when called
187             : without an api key
188             Comments : WebService::Technorati::BloginfoApiQuery is a Perl interface to the Technorati
189             : web services 'bloginfo' interface
190              
191             See Also : WebService::Technorati::BloginfoApiQuery
192              
193             =cut
194              
195             sub getBloginfoApiQuery {
196             my $self = shift;
197             my $url = shift;
198             my $q = WebService::Technorati::BloginfoApiQuery->new(key => $self->{'key'}, url => $url);
199             return $q;
200             }
201              
202              
203              
204             ################################################## subroutine header end ##
205              
206              
207             sub new {
208             my ($class, %params) = @_;
209             if (! exists $params{'key'}) {
210             WebService::Technorati::InstantiationException->throw(
211             "WebService::Technorati must be instantiated with at " .
212             "least 'key => theverylongkeystring'");
213             }
214             my $self = bless (\%params, ref ($class) || $class);
215             return $self;
216             }
217              
218              
219             1; #this line is important and will help the module return a true value
220             __END__