OpenGbg/Service/StyrOchStall.pm

filter: Statementstmt 66.6% 30 / 45 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 8 / 10 Podpod 100% 2 / 2 totaltotal 62.5% 40 / 64 CC 3 SCAR 13.4
CC
3
Cov
60%
get_bike_stations
12.0
get_bike_station
2.0
BEGIN
1.0
CRAP 3.8
« OpenGbg/Service/AirQuality/Measurement.pm ↑ Summary OpenGbg/Service/StyrOchStall/Station.pm »
1 6 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package OpenGbg::Service::StyrOchStall;
6  
7 # ABSTRACT: Entry point to the StyrOchStall bike rental service
8 6 our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
9 6 our $VERSION = '0.1404';
10  
11 6 ▶use OpenGbg::Elk;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 with 'OpenGbg::Service::Getter';
13  
14 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 6 ▶use Types::Standard qw/Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 6 ▶use OpenGbg::Service::StyrOchStall::GetBikeStation;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 6 ▶use OpenGbg::Service::StyrOchStall::GetBikeStations;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 6 has handler => (
21 is => 'ro',
22 required => 1,
23 );
24 6 has service_base => (
25 is => 'rw',
26 isa => Str,
27 default => 'StyrOchStall/v0.1/',
28 );
29  
30 0 ▶sub get_bike_station {
Subroutine get_bike_station: not called CC=1 SCAR=6.9
Pod documented
31 0 my $self = shift;
32 0 my $id = shift;
33  
34 0 my $url = "GetBikeStation/$id/%s?";
35 0 my $response = $self->getter($url, 'get_bike_station');
36  
37 0 return OpenGbg::Service::StyrOchStall::GetBikeStation->new(xml => $response);
38 }
39  
40 0 ▶sub get_bike_stations {
Subroutine get_bike_stations: not called CC=3 SCAR=24.8
Pod documented
41 0 my $self = shift;
42 0 my %args = @_;
43  
44 0 my $geo = '';
45 0 ▶ if(exists $args{'lat'} && exists $args{'long'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"lat"} and exists $args{"long"}) 0 0 0
Condition0%0/3
exists $args{"lat"} and exists $args{"long"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args{"lat"} and exists $args{"long"}
exists $args{"lat"} exists $args{"long"}
Truth table0%0/3
A and B
A= exists $args{"lat"}B= exists $args{"long"}
ABresult
0X0
100
111
46 0 my %hash = ( latitude => $args{'lat'}, longitude => $args{'long'}, radius => $args{'radius'} );
47 0 $geo = join '&' => map { "$_=$hash{ $_ }" } keys %hash;
48 }
49  
50 0 my $url = "GetBikeStations/%s?$geo&";
51 0 my $response = $self->getter($url, 'get_bike_stations');
52  
53 0 return OpenGbg::Service::StyrOchStall::GetBikeStations->new(xml => $response);
54 }
55  
56 6 __PACKAGE__->meta->make_immutable;
57  
58 6 1;
59  
60 __END__
« OpenGbg/Service/AirQuality/Measurement.pm ↑ Summary OpenGbg/Service/StyrOchStall/Station.pm »