File Coverage

blib/lib/Net/Plazes/User.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             #########
2             # Author: rmp
3             # Maintainer: $Author: rmp $
4             # Created: 2008-08-13
5             # Last Modified: $Date$
6             # Id: $Id$
7             # $HeadURL$
8             #
9             package Net::Plazes::User;
10 1     1   901 use strict;
  1         2  
  1         82  
11 1     1   5 use warnings;
  1         1  
  1         33  
12 1     1   4 use base qw(Net::Plazes::Base);
  1         2  
  1         542  
13             use Net::Plazes::Activity;
14              
15             our $VERSION = '0.03';
16              
17             __PACKAGE__->mk_accessors(fields());
18             __PACKAGE__->has_many();
19              
20             sub service {
21             return q[http://plazes.com/users];
22             }
23              
24             sub fields {
25             return qw(id created_at full_name name updated_at avatar_url);
26             }
27              
28             sub activities {
29             my $self = shift;
30              
31             if(!$self->id()) {
32             return [];
33             }
34              
35             if(!$self->{activities}) {
36             my $obj_uri = sprintf '%s/%d/activities', $self->service(), $self->id();
37             my $root_activity = Net::Plazes::Activity->new({
38             useragent => $self->useragent(),
39             });
40             $root_activity->list($obj_uri);
41             $self->{activities} = $root_activity->activities();
42             }
43              
44             return $self->{activities};
45             }
46              
47             1;
48             __END__