« 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__ | ||