blib/lib/WWW/Ohloh/API/Analysis.pm

filter: Statementstmt 100% 51 / 51 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 98.3% 60 / 61 CC 3 SCAR 3.7
CC
3
Cov
98%
_init
2.0
as_xml
2.0
BEGIN
1.0
CRAP 1.4
« blib/lib/WWW/Ohloh/API/SizeFact.pm ↑ Summary blib/lib/WWW/Ohloh/API/Message/Tag.pm »
1 package WWW::Ohloh::API::Analysis;
2  
3 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 15 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use Object::InsideOut;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 15 our $VERSION = '0.3.2';
10  
11 15 my @request_url_of : Field : Arg(request_url) : Get( request_url );
12 15 my @xml_of : Field : Arg(xml);
13  
14 15 my @id_of : Field : Get(id) : Set(_set_id);
15 15 my @project_id_of : Field : Get(project_id) : Set(_set_project_id);
16 15 my @updated_at_of : Field : Get(updated_at) : Set(_set_updated_at);
17 15 my @logged_at_of : Field : Get(logged_at) : Set(_set_logged_at);
18 15 my @min_month_of : Field : Get(min_month) : Set(_set_min_month);
19 15 my @max_month_of : Field : Get(max_month) : Set(_set_max_month);
20 15 my @twelve_month_contributor_count_of : Field :
21 Get(twelve_month_contributor_count) :
22 Set(_set_twelve_month_contributor_count);
23 15 my @total_code_lines_of : Field : Get(total_code_lines) :
24 Set(_set_total_code_lines);
25 15 my @main_language_id_of : Field : Get(main_language_id) :
26 Set(_set_main_language_id);
27 15 my @main_language_name_of : Field : Get(main_language_name) :
28 Set(_set_main_language_name);
29  
30 sub _init : Init {
31 2 ▶ my $self = shift;
Subroutine _init: called CC=2 SCAR=6.9
32  
33 2 ▶ my $dom = $xml_of[$$self] or return;
Branch: 1 branch
BranchTrueFalseTotal
my $dom = $xml_of[$$self] or return 0 2 2
34  
35 2 $self->_set_id( $dom->findvalue('id/text()') );
36 2 $self->_set_project_id( $dom->findvalue('project_id/text()') );
37 2 $self->_set_updated_at( $dom->findvalue('updated_at/text()') );
38 2 $self->_set_logged_at( $dom->findvalue('logged_at/text()') );
39 2 $self->_set_min_month( $dom->findvalue('min_month/text()') );
40 2 $self->_set_max_month( $dom->findvalue('max_month/text()') );
41 2 $self->_set_twelve_month_contributor_count(
42 $dom->findvalue('twelve_month_contributor_count/text()') );
43 2 $self->_set_total_code_lines(
44 $dom->findvalue('total_code_lines/text()') );
45 2 $self->_set_main_language_id(
46 $dom->findvalue('main_language_id/text()') );
47 2 $self->_set_main_language_name(
48 $dom->findvalue('main_language_name/text()') );
49  
50 2 return;
51 15 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
52  
53 sub as_xml {
54 1 ▶ my $self = shift;
Subroutine as_xml: called CC=2 SCAR=6.9
Pod documented
55 1 my $xml;
56 1 my $w = XML::Writer->new( OUTPUT => \$xml );
57  
58 1 $w->startTag('analysis');
59 1 for my $attr (
60 qw/ id project_id
61 updated_at logged_at min_month
62 max_month twelve_month_contributor_count
63 total_code_lines
64 main_language_name
65 main_language_id
66 /
67 ) {
68 10 $w->dataElement( $attr, $self->$attr );
69 }
70  
71 1 $w->endTag;
72  
73 1 return $xml;
74 }
75  
76 15 *language = *main_language = *main_language_name;
77  
78 15 'end of WWW::Ohloh::API::Analysis';
79 __END__
80  
81 =head1 NAME
82  
83 WWW::Ohloh::API::Account - an Ohloh account
84  
85 =head1 SYNOPSIS
86  
87 use WWW::Ohloh::API;
88  
89 my $ohloh = WWW::Ohloh::API->new( api_key => $my_api_key );
90 my $account $ohloh->get_account( id => 12933 );
91  
92 print $account->name;
93  
94 =head1 DESCRIPTION
95  
96 W::O::A::Account contains the information associated with an Ohloh
97 account as defined at http://www.ohloh.net/api/reference/account.
98 To be properly populated, it must be created via
99 the C<get_account> method of a L<WWW::Ohloh::API> object.
100  
101 =head1 METHODS
102  
103 =head2 API Data Accessors
104  
105 =head3 id
106  
107 Return the account's id.
108  
109 =head3 name
110  
111 Return the public name of the account.
112  
113 =head3 created_at
114  
115 Return the time at which the account was created.
116  
117 =head3 updated_at
118  
119 Return the last time at which the account was modified.
120  
121 =head3 homepage_url
122  
123 Return the URL to a member's home page, such as a blog, or I<undef> if not
124 configured.
125  
126 =head3 avatar_url
127  
128 Return the URL to the profile image displayed on Ohloh pages, or I<undef> if
129 not configured.
130  
131 =head3 posts_count
132  
133 Return the number of posts made to the Ohloh forums by this account.
134  
135 =head3 location
136  
137 Return a text description of this account holder's claimed location, or
138 I<undef> if not
139 available.
140  
141 =head3 country_code
142  
143 Return a string representing the account holder's country, or I<undef> is
144 unavailable.
145  
146 =head3 latitude, longitude
147  
148 Return floating-point values representing the account's latitude and longitude,
149 suitable for use with the Google Maps API, or I<undef> is they are not
150 available.
151  
152 =head3 kudoScore, kudo_score, kudo
153  
154 Return a L<WWW::Ohloh::API::KudoScore> object holding the account's
155 kudo information, or I<undef> if the account doesn't have a kudo score
156 yet. All three methods are equivalent.
157  
158 =head2 Other Methods
159  
160 =head3 as_xml
161  
162 Return the account information (including the kudo score if it applies)
163 as an XML string. Note that this is not the exact xml document as returned
164 by the Ohloh server: due to the current XML parsing module used
165 by W::O::A (to wit: L<XML::Simple>), the ordering of the nodes can differ.
166  
167 =head1 SEE ALSO
168  
169 =over
170  
171 =item *
172  
173 L<WWW::Ohloh::API>, L<WWW::Ohloh::API::KudoScore>.
174  
175 =item *
176  
177 Ohloh API reference: http://www.ohloh.net/api/getting_started
178  
179 =item *
180  
181 Ohloh Account API reference: http://www.ohloh.net/api/reference/account
182  
183 =back
184  
185 =head1 VERSION
186  
187 This document describes WWW::Ohloh::API version 0.3.2
188  
189 =head1 BUGS AND LIMITATIONS
190  
191 WWW::Ohloh::API is very extremely alpha quality. It'll improve,
192 but till then: I<Caveat emptor>.
193  
194 The C<as_xml()> method returns a re-encoding of the account data, which
195 can differ of the original xml document sent by the Ohloh server.
196  
197 Please report any bugs or feature requests to
198 C<bug-www-ohloh-api@rt.cpan.org>, or through the web interface at
199 L<http://rt.cpan.org>.
200  
201  
202 =head1 AUTHOR
203  
204 Yanick Champoux C<< <yanick@cpan.org> >>
205  
206 =head1 LICENCE AND COPYRIGHT
207  
208 Copyright (c) 2008, Yanick Champoux C<< <yanick@cpan.org> >>. All rights reserved.
209  
210 This module is free software; you can redistribute it and/or
211 modify it under the same terms as Perl itself. See L<perlartistic>.
212  
213  
214  
215  
216  
« blib/lib/WWW/Ohloh/API/SizeFact.pm ↑ Summary blib/lib/WWW/Ohloh/API/Message/Tag.pm »