| 1 | #!/usr/bin/false | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Bugzilla Product object and service | ||||||||||||||||||||||||||||
| 3 | # PODNAME: WebService::Bugzilla::Product | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package WebService::Bugzilla::Product 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 { 'products' } | ||||||||||||||||||||||||||
|
Subroutine
_unwrap_key: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | has classification => (is => 'ro', lazy => 1, builder => '_build_classification'); | |||||||||||||||||||||||||||
| 16 | 1 | has components => (is => 'ro', lazy => 1, builder => '_build_components'); | |||||||||||||||||||||||||||
| 17 | 1 | has default_milestone => (is => 'ro', lazy => 1, builder => '_build_default_milestone'); | |||||||||||||||||||||||||||
| 18 | 1 | has description => (is => 'ro', lazy => 1, builder => '_build_description'); | |||||||||||||||||||||||||||
| 19 | 1 | has has_unconfirmed => (is => 'ro', lazy => 1, builder => '_build_has_unconfirmed'); | |||||||||||||||||||||||||||
| 20 | 1 | has is_active => (is => 'ro', lazy => 1, builder => '_build_is_active'); | |||||||||||||||||||||||||||
| 21 | 1 | has milestones => (is => 'ro', lazy => 1, builder => '_build_milestones'); | |||||||||||||||||||||||||||
| 22 | 1 | has name => (is => 'ro', lazy => 1, builder => '_build_name'); | |||||||||||||||||||||||||||
| 23 | 1 | has requires_component => (is => 'ro', lazy => 1, builder => '_build_requires_component'); | |||||||||||||||||||||||||||
| 24 | 1 | has versions => (is => 'ro', lazy => 1, builder => '_build_versions'); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 1 | my @attrs = qw( | |||||||||||||||||||||||||||
| 27 | classification | ||||||||||||||||||||||||||||
| 28 | components | ||||||||||||||||||||||||||||
| 29 | default_milestone | ||||||||||||||||||||||||||||
| 30 | description | ||||||||||||||||||||||||||||
| 31 | has_unconfirmed | ||||||||||||||||||||||||||||
| 32 | is_active | ||||||||||||||||||||||||||||
| 33 | milestones | ||||||||||||||||||||||||||||
| 34 | name | ||||||||||||||||||||||||||||
| 35 | requires_component | ||||||||||||||||||||||||||||
| 36 | versions | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | for my $attr (@attrs) { | |||||||||||||||||||||||||||
| 40 | 10 | my $build = "_build_$attr"; | |||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 43 | 10 | ▶ | *{ $build } = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=15.4
| |||||||||||||||||||||||||||||
| 44 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $id_or_name = $self->_api_data->{name} // $self->id; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->_api_data->{"name"} // $self->id
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
| |||||||||||||||||||||||||||||
| 46 | 0 | $self->_fetch_full($self->_mkuri("product/$id_or_name")); | |||||||||||||||||||||||||||
| 47 | 0 | return $self->_api_data->{$attr}; | |||||||||||||||||||||||||||
| 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('product'), \%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, $id_or_name) = @_; | |||||||||||||||||||||||||||
| 63 | 0 | my $res = $self->client->get($self->_mkuri("product/$id_or_name")); | |||||||||||||||||||||||||||
| 64 | 0 | ▶ | return unless $res->{products} && @{ $res->{products} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$res->{"products"} and @{$res->{"products"};}
MC/DC0%0/2
$res->{"products"} and @{$res->{"products"};}
$res->{"products"}
@{$res->{"products"};}
Truth table0%0/3
A and B
A= $res->{"products"}B= @{$res->{"products"};}
| |||||||||||||||||||||||||||||
| 65 | return $self->new( | ||||||||||||||||||||||||||||
| 66 | client => $self->client, | ||||||||||||||||||||||||||||
| 67 | 0 | _data => $res->{products}[0], | |||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub search { | ||||||||||||||||||||||||||
|
Subroutine
search: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 72 | 0 | my ($self, %params) = @_; | |||||||||||||||||||||||||||
| 73 | 0 | my $res = $self->client->get($self->_mkuri('product'), \%params); | |||||||||||||||||||||||||||
| 74 | return [ | ||||||||||||||||||||||||||||
| 75 | map { | ||||||||||||||||||||||||||||
| 76 | 0 | $self->new( | |||||||||||||||||||||||||||
| 77 | client => $self->client, | ||||||||||||||||||||||||||||
| 78 | _data => $_ | ||||||||||||||||||||||||||||
| 79 | ) | ||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | 0 | ▶ | @{ $res->{products} // [] } | ||||||||||||||||||||||||||
|
Condition0%0/2
$res->{"products"} // []
MC/DC0%0/1
$res->{"products"} // []
$res->{"products"}
Truth table0%0/2
A
A= $res->{"products"}
| |||||||||||||||||||||||||||||
| 82 | ]; | ||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 1 | 1; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||