OpenGbg/Service/AirQuality.pm

filter: Statementstmt 71.4% 30 / 42 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 100% 2 / 2 totaltotal 74.0% 40 / 54 CC 1 SCAR 1.8
CC
1
Cov
71%
get_latest_measurement
2.0
get_measurements
2.0
BEGIN
1.0
CRAP 1.2
« OpenGbg/Service/StyrOchStall/GetBikeStations.pm ↑ Summary OpenGbg/Service/TrafficCamera/GetCameraImage.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::AirQuality;
6  
7 # ABSTRACT: Entry point to the Air Quality 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 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use Types::Standard qw/Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶use OpenGbg::Service::AirQuality::GetLatestMeasurement;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 6 ▶use OpenGbg::Service::AirQuality::GetMeasurements;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 6 with 'OpenGbg::Service::Getter';
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 => 'AirQualityService/v1.0/',
28 );
29  
30 0 ▶sub get_latest_measurement {
Subroutine get_latest_measurement: not called CC=1 SCAR=6.9
Pod documented
31 0 my $self = shift;
32  
33 0 my $url = 'LatestMeasurement/%s?';
34 0 my $response = $self->getter($url, 'latest_measurement');
35  
36 0 return OpenGbg::Service::AirQuality::GetLatestMeasurement->new(xml => $response);
37 }
38 0 ▶sub get_measurements {
Subroutine get_measurements: not called CC=1 SCAR=6.9
Pod documented
39 0 my $self = shift;
40 0 my %args = @_;
41  
42 0 my %dates = (startdate => $args{'start'}, enddate => $args{'end'});
43 0 my $dates = join '&' => map { "$_=$dates{ $_ }"} keys %dates;
44  
45 0 my $url = "Measurements/%s?$dates&";
46 0 my $response = $self->getter($url, 'measurements');
47  
48 0 return OpenGbg::Service::AirQuality::GetMeasurements->new(xml => $response);
49 }
50  
51 6 __PACKAGE__->meta->make_immutable;
52  
53 6 1;
54  
55 __END__
« OpenGbg/Service/StyrOchStall/GetBikeStations.pm ↑ Summary OpenGbg/Service/TrafficCamera/GetCameraImage.pm »