| 1 | #!/usr/bin/false | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Bugzilla Bug object and service | ||||||||||||||||||||||||||||
| 4 | # PODNAME: WebService::Bugzilla::Bug | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | package WebService::Bugzilla::Bug 0.001; | ||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use strictures 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | extends 'WebService::Bugzilla::Object'; | |||||||||||||||||||||||||||
| 12 | 1 | with 'WebService::Bugzilla::Role::Updatable'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub _unwrap_key { 'bugs' } | ||||||||||||||||||||||||||
|
Subroutine
_unwrap_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | has alias => (is => 'ro', lazy => 1, builder => '_build_alias'); | |||||||||||||||||||||||||||
| 17 | 1 | has assigned_to => (is => 'ro', lazy => 1, builder => '_build_assigned_to'); | |||||||||||||||||||||||||||
| 18 | 1 | has blocks => (is => 'ro', lazy => 1, builder => '_build_blocks'); | |||||||||||||||||||||||||||
| 19 | 1 | has cc => (is => 'ro', lazy => 1, builder => '_build_cc'); | |||||||||||||||||||||||||||
| 20 | 1 | has component => (is => 'ro', lazy => 1, builder => '_build_component'); | |||||||||||||||||||||||||||
| 21 | 1 | has creation_time => (is => 'ro', lazy => 1, builder => '_build_creation_time'); | |||||||||||||||||||||||||||
| 22 | 1 | has depends_on => (is => 'ro', lazy => 1, builder => '_build_depends_on'); | |||||||||||||||||||||||||||
| 23 | 1 | has is_open => (is => 'ro', lazy => 1, builder => '_build_is_open'); | |||||||||||||||||||||||||||
| 24 | 1 | has keywords => (is => 'ro', lazy => 1, builder => '_build_keywords'); | |||||||||||||||||||||||||||
| 25 | 1 | has last_change_time => (is => 'ro', lazy => 1, builder => '_build_last_change_time'); | |||||||||||||||||||||||||||
| 26 | 1 | has op_sys => (is => 'ro', lazy => 1, builder => '_build_op_sys'); | |||||||||||||||||||||||||||
| 27 | 1 | has platform => (is => 'ro', lazy => 1, builder => '_build_platform'); | |||||||||||||||||||||||||||
| 28 | 1 | has priority => (is => 'ro', lazy => 1, builder => '_build_priority'); | |||||||||||||||||||||||||||
| 29 | 1 | has product => (is => 'ro', lazy => 1, builder => '_build_product'); | |||||||||||||||||||||||||||
| 30 | 1 | has reporter => (is => 'ro', lazy => 1, builder => '_build_reporter'); | |||||||||||||||||||||||||||
| 31 | 1 | has resolution => (is => 'ro', lazy => 1, builder => '_build_resolution'); | |||||||||||||||||||||||||||
| 32 | 1 | has severity => (is => 'ro', lazy => 1, builder => '_build_severity'); | |||||||||||||||||||||||||||
| 33 | 1 | has status => (is => 'ro', lazy => 1, builder => '_build_status'); | |||||||||||||||||||||||||||
| 34 | 1 | has summary => (is => 'ro', lazy => 1, builder => '_build_summary'); | |||||||||||||||||||||||||||
| 35 | 1 | has target_milestone => (is => 'ro', lazy => 1, builder => '_build_target_milestone'); | |||||||||||||||||||||||||||
| 36 | 1 | has url => (is => 'ro', lazy => 1, builder => '_build_url'); | |||||||||||||||||||||||||||
| 37 | 1 | has version => (is => 'ro', lazy => 1, builder => '_build_version'); | |||||||||||||||||||||||||||
| 38 | 1 | has whiteboard => (is => 'ro', lazy => 1, builder => '_build_whiteboard'); | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 1 | my @attrs = qw( | |||||||||||||||||||||||||||
| 41 | alias | ||||||||||||||||||||||||||||
| 42 | assigned_to | ||||||||||||||||||||||||||||
| 43 | blocks | ||||||||||||||||||||||||||||
| 44 | cc | ||||||||||||||||||||||||||||
| 45 | component | ||||||||||||||||||||||||||||
| 46 | creation_time | ||||||||||||||||||||||||||||
| 47 | depends_on | ||||||||||||||||||||||||||||
| 48 | is_open | ||||||||||||||||||||||||||||
| 49 | keywords | ||||||||||||||||||||||||||||
| 50 | last_change_time | ||||||||||||||||||||||||||||
| 51 | op_sys | ||||||||||||||||||||||||||||
| 52 | platform | ||||||||||||||||||||||||||||
| 53 | priority | ||||||||||||||||||||||||||||
| 54 | product | ||||||||||||||||||||||||||||
| 55 | reporter | ||||||||||||||||||||||||||||
| 56 | resolution | ||||||||||||||||||||||||||||
| 57 | severity | ||||||||||||||||||||||||||||
| 58 | status | ||||||||||||||||||||||||||||
| 59 | summary | ||||||||||||||||||||||||||||
| 60 | target_milestone | ||||||||||||||||||||||||||||
| 61 | url | ||||||||||||||||||||||||||||
| 62 | version | ||||||||||||||||||||||||||||
| 63 | whiteboard | ||||||||||||||||||||||||||||
| 64 | ); | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | for my $attr (@attrs) { | |||||||||||||||||||||||||||
| 67 | 23 | my $build = "_build_$attr"; | |||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||
| 69 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | 23 | ▶ | *{ $build } = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=3.5
| |||||||||||||||||||||||||||||
| 71 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 72 | 0 | $self->_fetch_full($self->_mkuri('bug/' . $self->id)); | |||||||||||||||||||||||||||
| 73 | 0 | return $self->_api_data->{$attr}; | |||||||||||||||||||||||||||
| 74 | 23 | }; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 0 | ▶ | sub create { | ||||||||||||||||||||||||||
|
Subroutine
create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 79 | 0 | my ($self, %params) = @_; | |||||||||||||||||||||||||||
| 80 | 0 | my $res = $self->client->post($self->_mkuri('bug'), \%params); | |||||||||||||||||||||||||||
| 81 | return $self->new( | ||||||||||||||||||||||||||||
| 82 | client => $self->client, | ||||||||||||||||||||||||||||
| 83 | _data => { id => $res->{id} }, | ||||||||||||||||||||||||||||
| 84 | 0 | ); | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||
|
Subroutine
get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | 0 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 89 | 0 | my $res = $self->client->get($self->_mkuri("bug/$id")); | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | return unless $res->{bugs} && @{ $res->{bugs} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res->{"bugs"} and @{$res->{"bugs"};}
MC/DC0%0/2
$res->{"bugs"} and @{$res->{"bugs"};}
$res->{"bugs"}
@{$res->{"bugs"};}
Truth table0%0/3
A and B
A= $res->{"bugs"}B= @{$res->{"bugs"};}
| |||||||||||||||||||||||||||||
| 91 | return $self->new( | ||||||||||||||||||||||||||||
| 92 | client => $self->client, | ||||||||||||||||||||||||||||
| 93 | 0 | _data => $res->{bugs}[0], | |||||||||||||||||||||||||||
| 94 | ); | ||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub history { | ||||||||||||||||||||||||||
|
Subroutine
history: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | 0 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 99 | 0 | ▶ | $id //= $self->id; | ||||||||||||||||||||||||||
|
Condition0%0/3
$id //= $self->id
MC/DC0%0/2
$id //= $self->id
$id
$self->id
Truth table0%0/3
A //= B
A= $idB= $self->id
| |||||||||||||||||||||||||||||
| 100 | 0 | require WebService::Bugzilla::Bug::History; | |||||||||||||||||||||||||||
| 101 | 0 | require WebService::Bugzilla::Bug::History::Change; | |||||||||||||||||||||||||||
| 102 | 0 | my $res = $self->client->get($self->_mkuri("bug/$id/history")); | |||||||||||||||||||||||||||
| 103 | 0 | ▶ | my @raw = @{ ($res->{bugs} // [])->[0]{history} // [] }; | ||||||||||||||||||||||||||
|
Condition0%0/4
+($res->{"bugs"} // [])->[0]{"history"} // []
$res->{"bugs"} // []
MC/DC0%0/1
+($res->{"bugs"} // [])->[0]{"history"} // []
$res->{"bugs"}
Truth table0%0/2
A
A= $res->{"bugs"}
| |||||||||||||||||||||||||||||
| 104 | return [ | ||||||||||||||||||||||||||||
| 105 | map { | ||||||||||||||||||||||||||||
| 106 | 0 | my $entry = $_; | |||||||||||||||||||||||||||
| 107 | WebService::Bugzilla::Bug::History->new( | ||||||||||||||||||||||||||||
| 108 | when => $entry->{when}, | ||||||||||||||||||||||||||||
| 109 | who => $entry->{who}, | ||||||||||||||||||||||||||||
| 110 | changes => [ | ||||||||||||||||||||||||||||
| 111 | 0 | map { WebService::Bugzilla::Bug::History::Change->new(%{$_}) } | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | @{ $entry->{changes} // [] } | ||||||||||||||||||||||||||
|
Condition0%0/2
$entry->{"changes"} // []
MC/DC0%0/1
$entry->{"changes"} // []
$entry->{"changes"}
Truth table0%0/2
A
A= $entry->{"changes"}
| |||||||||||||||||||||||||||||
| 113 | ], | ||||||||||||||||||||||||||||
| 114 | ) | ||||||||||||||||||||||||||||
| 115 | } @raw | ||||||||||||||||||||||||||||
| 116 | ]; | ||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub possible_duplicates { | ||||||||||||||||||||||||||
|
Subroutine
possible_duplicates: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 120 | 0 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | $id //= $self->id; | ||||||||||||||||||||||||||
|
Condition0%0/3
$id //= $self->id
MC/DC0%0/2
$id //= $self->id
$id
$self->id
Truth table0%0/3
A //= B
A= $idB= $self->id
| |||||||||||||||||||||||||||||
| 122 | 0 | my $res = $self->client->get($self->_mkuri("bug/$id/duplicates")); | |||||||||||||||||||||||||||
| 123 | return [ | ||||||||||||||||||||||||||||
| 124 | map { | ||||||||||||||||||||||||||||
| 125 | 0 | $self->new( | |||||||||||||||||||||||||||
| 126 | client => $self->client, | ||||||||||||||||||||||||||||
| 127 | _data => $_ | ||||||||||||||||||||||||||||
| 128 | ) | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | 0 | ▶ | @{ $res->{bugs} // [] } | ||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"bugs"} // []
MC/DC0%0/1
$res->{"bugs"} // []
$res->{"bugs"}
Truth table0%0/2
A
A= $res->{"bugs"}
| |||||||||||||||||||||||||||||
| 131 | ]; | ||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub search { | ||||||||||||||||||||||||||
|
Subroutine
search: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 135 | 0 | my ($self, %params) = @_; | |||||||||||||||||||||||||||
| 136 | 0 | my $res = $self->client->get($self->_mkuri('bug'), \%params); | |||||||||||||||||||||||||||
| 137 | return [ | ||||||||||||||||||||||||||||
| 138 | map { | ||||||||||||||||||||||||||||
| 139 | 0 | $self->new( | |||||||||||||||||||||||||||
| 140 | client => $self->client, | ||||||||||||||||||||||||||||
| 141 | _data => $_ | ||||||||||||||||||||||||||||
| 142 | ) | ||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | 0 | ▶ | @{ $res->{bugs} // [] } | ||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"bugs"} // []
MC/DC0%0/1
$res->{"bugs"} // []
$res->{"bugs"}
Truth table0%0/2
A
A= $res->{"bugs"}
| |||||||||||||||||||||||||||||
| 145 | ]; | ||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | sub last_visit { | ||||||||||||||||||||||||||
|
Subroutine
last_visit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 150 | 0 | require WebService::Bugzilla::BugUserLastVisit; | |||||||||||||||||||||||||||
| 151 | 0 | return $self->client->bug_user_last_visit->get_bug($self->id); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub update_visit { | ||||||||||||||||||||||||||
|
Subroutine
update_visit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 155 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 156 | 0 | require WebService::Bugzilla::BugUserLastVisit; | |||||||||||||||||||||||||||
| 157 | 0 | return $self->client->bug_user_last_visit->update($self->id); | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 1 | 1; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | __END__ | ||||||||||||||||||||||||||||