| 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::TrafficCamera; | ||
| 6 | |||
| 7 | # ABSTRACT: Entry point to the Traffic Camera service | ||
| 8 | 6 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | 6 | our $VERSION = '0.1401'; | |
| 10 | |||
| 11 | 6 | ▶ | use OpenGbg::Elk; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 6 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 6 | ▶ | use Types::Standard qw/Str/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | 6 | ▶ | use OpenGbg::Service::TrafficCamera::GetCameraImage; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 6 | ▶ | use OpenGbg::Service::TrafficCamera::GetTrafficCameras; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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 => 'TrafficCamera/v0.1/', | ||
| 28 | ); | ||
| 29 | |||
| 30 | sub get_camera_image { | ||
| 31 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_camera_image: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | 0 | my $id = shift; | |
| 33 | |||
| 34 | 0 | my $url = "CameraImage/%s/$id?"; | |
| 35 | 0 | my $response = $self->getter($url, 'get_camera_image'); | |
| 36 | |||
| 37 | 0 | return OpenGbg::Service::TrafficCamera::GetCameraImage->new(image => $response); | |
| 38 | } | ||
| 39 | |||
| 40 | sub get_traffic_cameras { | ||
| 41 | 0 | ▶ | my $self = shift; |
|
Subroutine
get_traffic_cameras: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | |||
| 43 | 0 | my $url = 'TrafficCameras/%s?'; | |
| 44 | 0 | my $response = $self->getter($url, 'get_traffic_cameras'); | |
| 45 | |||
| 46 | 0 | return OpenGbg::Service::TrafficCamera::GetTrafficCameras->new(xml => $response); | |
| 47 | } | ||
| 48 | |||
| 49 | 6 | __PACKAGE__->meta->make_immutable; | |
| 50 | |||
| 51 | 6 | 1; | |
| 52 | |||
| 53 | __END__ | ||
| 54 | |||
| 55 | =pod | ||
| 56 | |||
| 57 | =encoding utf-8 | ||
| 58 | |||
| 59 | =head1 NAME | ||
| 60 | |||
| 61 | OpenGbg::Service::TrafficCamera - Entry point to the Traffic Camera service | ||
| 62 | |||
| 63 | =head1 VERSION | ||
| 64 | |||
| 65 | Version 0.1401, released 2016-05-05. | ||
| 66 | |||
| 67 | =head1 SYNOPSIS | ||
| 68 | |||
| 69 | my $traffic_camera_service = OpenGbg->new->traffic_camera; | ||
| 70 | my $response = $traffic_camera_service->get_traffic_cameras; | ||
| 71 | |||
| 72 | print $response->camera_devices->get_by_index(0)->to_text; | ||
| 73 | |||
| 74 | =head1 DESCRIPTION | ||
| 75 | |||
| 76 | Traffic cameras all around Gothenburg captures a lot of images (usually once per minute). This service gives information about the | ||
| 77 | cameras themselves, as well as a way to get the latest captured image from all cameras. | ||
| 78 | |||
| 79 | L<Official documentation|http://data.goteborg.se/Pages/Webservice.aspx?ID=15> | ||
| 80 | |||
| 81 | See L<OpenGbg> for general information. | ||
| 82 | |||
| 83 | =head1 METHODS | ||
| 84 | |||
| 85 | =head2 get_traffic_cameras | ||
| 86 | |||
| 87 | Get information on the traffic cameras. | ||
| 88 | |||
| 89 | Returns a L<GetTrafficCameras|OpenGbg::Service::TrafficCamera::GetTrafficCameras> object. | ||
| 90 | |||
| 91 | =head2 get_camera_image($camera_id) | ||
| 92 | |||
| 93 | Get the latest image from the camera with id C<$id>. | ||
| 94 | |||
| 95 | Returns a L<GetCameraImage|OpenGbg::Service::TrafficCamera::GetCameraImage> object. | ||
| 96 | |||
| 97 | =head1 SOURCE | ||
| 98 | |||
| 99 | L<https://github.com/Csson/p5-OpenGbg> | ||
| 100 | |||
| 101 | =head1 HOMEPAGE | ||
| 102 | |||
| 103 | L<https://metacpan.org/release/OpenGbg> | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | Erik Carlsson <info@code301.com> | ||
| 108 | |||
| 109 | =head1 COPYRIGHT AND LICENSE | ||
| 110 | |||
| 111 | This software is copyright (c) 2016 by Erik Carlsson. | ||
| 112 | |||
| 113 | This is free software; you can redistribute it and/or modify it under | ||
| 114 | the same terms as the Perl 5 programming language system itself. | ||
| 115 | |||
| 116 | =cut | ||