WallyHome.pm

filter: Statementstmt 71.4% 25 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 100% 2 / 2 totaltotal 69.5% 32 / 46 CC 2 SCAR 4.7
CC
2
Cov
71%
_build_places
2.0
getPlaceById
2.0
__ANON__
2.0
CRAP 1.6
« WallyHome/Role/Validator.pm ↑ Summary WallyHome/Sensor.pm »
1 package Device::WallyHome;
2 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use MooseX::AttributeShortcuts;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.21.3';
9  
10 2 with 'Device::WallyHome::Role::Creator';
11 2 with 'Device::WallyHome::Role::REST';
12 2 with 'Device::WallyHome::Role::Validator';
13  
14  
15 #== ATTRIBUTES =================================================================
16  
17 2 has 'places' => (
18 is => 'lazy',
19 );
20  
21  
22 #== ATTRIBUTE BUILDERS =========================================================
23  
24 1 ▶sub _build_places {
Subroutine _build_places: called CC=2 SCAR=6.9
25 1 my ($self) = @_;
26  
27 1 my $placeList = $self->request({
28 uri => 'places',
29 });
30  
31 1 my $placeObjectList = [];
32  
33 1 foreach my $placeData (@$placeList) {
34 1 push @$placeObjectList, $self->loadPlaceFromApiResponseData($placeData);
35 }
36  
37 1 return $placeObjectList;
38 }
39  
40  
41 #== PUBLIC METHODS =============================================================
42  
43 0 ▶sub getPlaceById {
Subroutine getPlaceById: not called CC=1 SCAR=6.9
Pod documented
44 0 my ($self, $placeId) = @_;
45  
46 0 $self->_checkRequiredScalarParam($placeId, 'placeId');
47  
48 0 ▶ return first { $_->id() eq $placeId } @{ $self->places() };
Subroutine __ANON__: not called CC=1 SCAR=6.9
49 }
50  
51 0 ▶sub getPlaceByLabel {
Subroutine getPlaceByLabel: not called CC=1 SCAR=6.9
Pod documented
52 0 my ($self, $label) = @_;
53  
54 0 $self->_checkRequiredScalarParam($label, 'label');
55  
56 0 ▶ return first { $_->label() eq $label } @{ $self->places() };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 }
58  
59  
60 2 __PACKAGE__->meta->make_immutable;
61  
62 2 1;
63  
64 __END__
« WallyHome/Role/Validator.pm ↑ Summary WallyHome/Sensor.pm »