blib/lib/WebService/Bugzilla/Component.pm

filter: Statementstmt 65.2% 30 / 46 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 44.4% 4 / 9 Podpod 100% 3 / 3 totaltotal 47.4% 37 / 78 CC 7 SCAR 24.4
CC
7
Cov
49%
__ANON__
25.3
get
12.0
_unwrap_key
2.0
CRAP 11.5
« blib/lib/WebService/Bugzilla/FlagActivity.pm ↑ Summary blib/lib/WebService/Bugzilla/Bug.pm »
1 #!/usr/bin/false
2 # ABSTRACT: Bugzilla Component object and service
3 # PODNAME: WebService::Bugzilla::Component
4  
5 package WebService::Bugzilla::Component 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  
12 0 ▶sub _unwrap_key { 'components' }
Subroutine _unwrap_key: not called CC=1 SCAR=6.9
13  
14 1 has default_assignee => (is => 'ro', lazy => 1, builder => '_build_default_assignee');
15 1 has default_cc => (is => 'ro', lazy => 1, builder => '_build_default_cc');
16 1 has default_qa_contact => (is => 'ro', lazy => 1, builder => '_build_default_qa_contact');
17 1 has description => (is => 'ro', lazy => 1, builder => '_build_description');
18 1 has flag_types => (is => 'ro', lazy => 1, builder => '_build_flag_types');
19 1 has is_active => (is => 'ro', lazy => 1, builder => '_build_is_active');
20 1 has name => (is => 'ro', lazy => 1, builder => '_build_name');
21 1 has product_id => (is => 'ro', lazy => 1, builder => '_build_product_id');
22 1 has sort_key => (is => 'ro', lazy => 1, builder => '_build_sort_key');
23 1 has triage_owner => (is => 'ro', lazy => 1, builder => '_build_triage_owner');
24  
25 1 my @attrs = qw(
26 default_assignee
27 default_cc
28 default_qa_contact
29 description
30 flag_types
31 is_active
32 name
33 product_id
34 sort_key
35 triage_owner
36 );
37  
38 1 for my $attr (@attrs) {
39 10 my $build = "_build_$attr";
40 {
41 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 10 ▶ *{ $build } = sub {
Subroutine __ANON__: not called CC=5 SCAR=32.3
43 0 my ($self) = @_;
44 0 ▶ if ($self->_api_data && $self->_api_data->{product} && $self->_api_data->{name}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_api_data and $self->_api_data->{"product"} and $self->_api_data->{"name"}) 0 0 0
Condition0%0/6
$self->_api_data and $self->_api_data->{"product"} and $self->_api_data->{"name"}
!ll&&!rl&&r
000
$self->_api_data and $self->_api_data->{"product"}
!ll&&!rl&&r
000
MC/DC0%0/3
$self->_api_data and $self->_api_data->{"product"} and $self->_api_data->{"name"}
$self->_api_data $self->_api_data->{"product"} $self->_api_data->{"name"}
Truth table0%0/4
A and B and C
A= $self->_api_dataB= $self->_api_data->{"product"}C= $self->_api_data->{"name"}
ABCresult
0XX0
10X0
1100
1111
45 0 $self->_fetch_full($self->_mkuri('component/' . $self->_api_data->{product} . '/' . $self->_api_data->{name}));
46 }
47 0 ▶ return $self->_api_data ? $self->_api_data->{$attr} : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_api_data ? : 0 0 0
48 10 };
49 }
50 }
51  
52 0 ▶sub create {
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
53 0 my ($self, %params) = @_;
54 0 my $res = $self->client->post($self->_mkuri('component'), \%params);
55 return $self->new(
56 client => $self->client,
57 _data => { %params, id => $res->{id} },
58 0 );
59 }
60  
61 0 ▶sub get {
Subroutine get: not called CC=3 SCAR=24.8
Pod documented
62 0 my ($self, $product, $name) = @_;
63 0 my $res = $self->client->get($self->_mkuri("component/$product/$name"));
64 0 ▶ return unless $res->{components} && @{ $res->{components} };
Branch: 1 branch
BranchTrueFalseTotal
unless $res->{"components"} and @{$res->{"components"};} 0 0 0
Condition0%0/3
$res->{"components"} and @{$res->{"components"};}
!ll&&!rl&&r
000
MC/DC0%0/2
$res->{"components"} and @{$res->{"components"};}
$res->{"components"} @{$res->{"components"};}
Truth table0%0/3
A and B
A= $res->{"components"}B= @{$res->{"components"};}
ABresult
0X0
100
111
65 return $self->new(
66 client => $self->client,
67 0 _data => $res->{components}[0],
68 );
69 }
70  
71 0 ▶sub update {
Subroutine update: not called CC=1 SCAR=6.9
Pod documented
72 0 my ($self, $product, $name, %params) = @_;
73 0 my $res = $self->client->put($self->_mkuri("component/$product/$name"), \%params);
74 return $self->new(
75 client => $self->client,
76 0 _data => $res->{components}[0],
77 );
78 }
79  
80 1 1;
81  
82 __END__
« blib/lib/WebService/Bugzilla/FlagActivity.pm ↑ Summary blib/lib/WebService/Bugzilla/Bug.pm »