blib/lib/WebService/Bugzilla/Group.pm

filter: Statementstmt 60.8% 28 / 46 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 44.4% 4 / 9 Podpod 100% 3 / 3 totaltotal 47.9% 35 / 73 CC 5 SCAR 16.1
CC
5
Cov
50%
get
12.0
search
6.0
__ANON__
4.7
CRAP 5.0
« blib/lib/WebService/Bugzilla/Exception.pm ↑ Summary blib/lib/WebService/Bugzilla/Product.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Bugzilla Group object and service
3 # PODNAME: WebService::Bugzilla::Group
4  
5 package WebService::Bugzilla::Group 0.001;
6 1 ▶use strictures 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 extends 'WebService::Bugzilla::Object';
11 1 with 'WebService::Bugzilla::Role::Updatable';
12  
13 0 ▶sub _unwrap_key { 'groups' }
Subroutine _unwrap_key: not called CC=1 SCAR=6.9
14  
15 1 has description => (is => 'ro', lazy => 1, builder => '_build_description');
16 1 has icon_url => (is => 'ro', lazy => 1, builder => '_build_icon_url');
17 1 has is_active => (is => 'ro', lazy => 1, builder => '_build_is_active');
18 1 has is_bug_group => (is => 'ro', lazy => 1, builder => '_build_is_bug_group');
19 1 has membership => (is => 'ro', lazy => 1, builder => '_build_membership');
20 1 has name => (is => 'ro', lazy => 1, builder => '_build_name');
21 1 has user_regexp => (is => 'ro', lazy => 1, builder => '_build_user_regexp');
22  
23 1 my @attrs = qw(
24 description
25 icon_url
26 is_active
27 is_bug_group
28 membership
29 name
30 user_regexp
31 );
32  
33 1 for my $attr (@attrs) {
34 7 my $build = "_build_$attr";
35 {
36 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
37 7 ▶ *{ $build } = sub {
Subroutine __ANON__: not called CC=2 SCAR=15.4
38 0 my ($self) = @_;
39 0 ▶ my $id_or_name = $self->_api_data->{name} // $self->id;
Condition0%0/3
$self->_api_data->{"name"} // $self->id
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->_api_data->{"name"} // $self->id
$self->_api_data->{"name"} $self->id
Truth table0%0/3
A // B
A= $self->_api_data->{"name"}B= $self->id
ABresult
1X1
011
000
40 0 $self->_fetch_full($self->_mkuri("group/$id_or_name"));
41 0 return $self->_api_data->{$attr};
42 7 };
43 }
44 }
45  
46 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
47 0 my ($self, %params) = @_;
48 0 my $res = $self->client->post($self->_mkuri('group'), \%params);
49 return $self->new(
50 client => $self->client,
51 _data => { %params, id => $res->{id} },
52 0 );
53 }
54  
55 0 ▶sub get {
Subroutine get: not called CC=3 SCAR=24.8
Pod documented
56 0 my ($self, $id_or_name) = @_;
57 0 my $res = $self->client->get($self->_mkuri("group/$id_or_name"));
58 0 ▶ return unless $res->{groups} && @{ $res->{groups} };
Branch: 1 branch
BranchTrueFalseTotal
unless $res->{"groups"} and @{$res->{"groups"};} 0 0 0
Condition0%0/3
$res->{"groups"} and @{$res->{"groups"};}
!ll&&!rl&&r
000
MC/DC0%0/2
$res->{"groups"} and @{$res->{"groups"};}
$res->{"groups"} @{$res->{"groups"};}
Truth table0%0/3
A and B
A= $res->{"groups"}B= @{$res->{"groups"};}
ABresult
0X0
100
111
59 return $self->new(
60 client => $self->client,
61 0 _data => $res->{groups}[0],
62 );
63 }
64  
65 0 ▶sub search {
Subroutine search: not called CC=2 SCAR=17.9
Pod documented
66 0 my ($self, %params) = @_;
67 0 my $res = $self->client->get($self->_mkuri('group'), \%params);
68 return [
69 map {
70 0 $self->new(
71 client => $self->client,
72 _data => $_
73 )
74 }
75 0 ▶ @{ $res->{groups} // [] }
Condition0%0/2
$res->{"groups"} // []
l!l
00
MC/DC0%0/1
$res->{"groups"} // []
$res->{"groups"}
Truth table0%0/2
A
A= $res->{"groups"}
Aresult
11
00
76 ];
77 }
78  
79 1 1;
80  
81 __END__
« blib/lib/WebService/Bugzilla/Exception.pm ↑ Summary blib/lib/WebService/Bugzilla/Product.pm »