Contacts/Group.pm

filter: Statementstmt 60.8% 28 / 46 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 41.6% 5 / 12 Podpod 0.0% 0 / 1 totaltotal 52.3% 33 / 63 CC 4 SCAR 18.7
CC
4
Cov
56%
_set_link
20.0
create_url
2.0
__ANON__
2.0
CRAP 6.5
« Contacts/Contact.pm ↑ Summary Contacts/Server.pm »
1 package WWW::Google::Contacts::Group;
2 {
3 17 $WWW::Google::Contacts::Group::VERSION = '0.39';
4 }
5  
6 17 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 17 ▶use MooseX::Types::Moose qw( Str );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 17 ▶use WWW::Google::Contacts::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
9 Category
10 17 );
11  
12 17 ▶use WWW::Google::Contacts::Meta::Attribute::Trait::XmlField;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 0 ▶sub create_url {
Subroutine create_url: not called CC=1 SCAR=6.9
Pod undocumented
15 0 my $self = shift;
16 0 return sprintf( "%s://www.google.com/m8/feeds/groups/default/full",
17 $self->server->protocol );
18 }
19  
20 17 extends 'WWW::Google::Contacts::Base';
21  
22 17 with 'WWW::Google::Contacts::Roles::CRUD';
23  
24 17 has id => (
25 isa => Str,
26 is => 'ro',
27 writer => '_set_id',
28 predicate => 'has_id',
29 traits => ['XmlField'],
30 xml_key => 'id',
31 );
32  
33 has etag => (
34 isa => Str,
35 is => 'ro',
36 writer => '_set_etag',
37 predicate => 'has_etag',
38 traits => ['XmlField'],
39 xml_key => 'gd:etag',
40 0 ▶ include_in_xml => sub { 0 }, # This is set in HTTP headers
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 17 );
42  
43 has category => (
44 isa => Category,
45 is => 'rw',
46 predicate => 'has_category',
47 traits => ['XmlField'],
48 xml_key => 'category',
49 0 ▶ default => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
50 17 coerce => 1,
51 );
52  
53 17 has title => (
54 isa => Str,
55 is => 'rw',
56 predicate => 'has_title',
57 traits => ['XmlField'],
58 xml_key => 'title',
59 is_element => 1,
60 );
61  
62 17 has member => (
63 is => 'ro',
64 lazy_build => 1,
65 );
66  
67 has link => (
68 is => 'rw',
69 trigger => \&_set_link,
70 traits => ['XmlField'],
71 xml_key => 'link',
72 0 ▶ include_in_xml => sub { 0 },
Subroutine __ANON__: not called CC=1 SCAR=6.9
73 17 );
74  
75 # What to do with different link types
76 my $link_map =
77 0 ▶ { 'self' => sub { my ( $self, $link ) = @_; $self->_set_id( $link->{href} ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
78 17 };
79  
80 0 ▶sub _set_link {
Subroutine _set_link: not called CC=4 SCAR=30.0
81 0 my ( $self, $links ) = @_;
82 0 ▶ $links = ref($links) eq 'ARRAY' ? $links : [$links];
Branch: 1 branch
BranchTrueFalseTotal
ref $links eq 'ARRAY' ? : 0 0 0
83 0 foreach my $link ( @{$links} ) {
84 0 ▶ next unless ( defined $link_map->{ $link->{rel} } );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$link_map{$link->{"rel"}} 0 0 0
85 0 my $code = $link_map->{ $link->{rel} };
86 0 $link->{href} =~ s{/full/}{/base/};
87 0 $self->$code($link);
88 }
89 }
90  
91 0 ▶sub _build_member {
Subroutine _build_member: not called CC=1 SCAR=6.9
92 0 my $self = shift;
93 0 my $list =
94 WWW::Google::Contacts::ContactList->new( server => $self->server );
95 0 return $list->search( { group_membership => $self->id } );
96 }
97  
98 17 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
99 17 __PACKAGE__->meta->make_immutable;
100 17 1;
101 __END__
« Contacts/Contact.pm ↑ Summary Contacts/Server.pm »