« OpenGbg/Service/Bridge/GetOpenedStatus.pm
↑ Summary
OpenGbg/Service/TrafficCamera/GetTrafficCameras.pm »
| 1 | 1 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package OpenGbg::Service::TrafficCamera::CameraDevice; | ||
| 6 | |||
| 7 | # ABSTRACT: Data about a traffic camera | ||
| 8 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | ||
| 9 | our $VERSION = '0.1401'; | ||
| 10 | |||
| 11 | 1 | ▶ | use XML::Rabbit; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 1 | ▶ | use syntax 'qs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | has_xpath_value id => './x:ID'; | ||
| 16 | |||
| 17 | has_xpath_value storage_duration_minutes => './x:StorageDurationMinutes'; | ||
| 18 | |||
| 19 | has_xpath_value capture_interval_seconds => './x:CaptureIntervalSeconds'; | ||
| 20 | |||
| 21 | has_xpath_value description => './x:Description'; | ||
| 22 | |||
| 23 | has_xpath_value model => './x:Model'; | ||
| 24 | |||
| 25 | sub to_text { | ||
| 26 | my $self = shift; | ||
| 27 | |||
| 28 | return sprintf qs{ | ||
| 29 | Id: %s | ||
| 30 | Description: %s | ||
| 31 | Storage duration (m): %s | ||
| 32 | Capture interval (s): %s | ||
| 33 | Model: %s | ||
| 34 | }, | ||
| 35 | $self->id, | ||
| 36 | $self->description, | ||
| 37 | $self->storage_duration_minutes, | ||
| 38 | $self->capture_interval_seconds, | ||
| 39 | $self->model; | ||
| 40 | |||
| 41 | } | ||
| 42 | |||
| 43 | finalize_class(); | ||
| 44 | |||
| 45 | 1; | ||
| 46 | |||
| 47 | __END__ | ||
| 48 | |||
| 49 | =pod | ||
| 50 | |||
| 51 | =encoding utf-8 | ||
| 52 | |||
| 53 | =head1 NAME | ||
| 54 | |||
| 55 | OpenGbg::Service::TrafficCamera::CameraDevice - Data about a traffic camera | ||
| 56 | |||
| 57 | =head1 VERSION | ||
| 58 | |||
| 59 | Version 0.1401, released 2016-05-05. | ||
| 60 | |||
| 61 | =head1 SYNOPSIS | ||
| 62 | |||
| 63 | my $traffic_camera_service = OpenGbg->new->traffic_camera; | ||
| 64 | my $get_traffic_cameras = $traffic_camera_service->get_traffic_cameras; | ||
| 65 | |||
| 66 | my $camera_devices = $get_traffic_cameras->camera_devices; | ||
| 67 | my $camera_device = $camera_devices->get_by_index(0) | ||
| 68 | print $camera_device->to_text; | ||
| 69 | |||
| 70 | =head1 ATTRIBUTES | ||
| 71 | |||
| 72 | =head2 id | ||
| 73 | |||
| 74 | Integer. The traffic camera id. | ||
| 75 | |||
| 76 | =head2 description | ||
| 77 | |||
| 78 | String. The description/location of the traffic camera. | ||
| 79 | |||
| 80 | =head2 storage_duration_minutes | ||
| 81 | |||
| 82 | Integer. How long is the image saved. There is however currently no service to get any image but the latest. | ||
| 83 | |||
| 84 | =head2 capture_interval_seconds | ||
| 85 | |||
| 86 | Integer. How long between captures. | ||
| 87 | |||
| 88 | =head2 model | ||
| 89 | |||
| 90 | String. The brand and/or model of the traffic camera. | ||
| 91 | |||
| 92 | =head1 METHODS | ||
| 93 | |||
| 94 | =head2 to_text() | ||
| 95 | |||
| 96 | Returns a string with the traffic camera data in a table. | ||
| 97 | |||
| 98 | =head1 SOURCE | ||
| 99 | |||
| 100 | L<https://github.com/Csson/p5-OpenGbg> | ||
| 101 | |||
| 102 | =head1 HOMEPAGE | ||
| 103 | |||
| 104 | L<https://metacpan.org/release/OpenGbg> | ||
| 105 | |||
| 106 | =head1 AUTHOR | ||
| 107 | |||
| 108 | Erik Carlsson <info@code301.com> | ||
| 109 | |||
| 110 | =head1 COPYRIGHT AND LICENSE | ||
| 111 | |||
| 112 | This software is copyright (c) 2016 by Erik Carlsson. | ||
| 113 | |||
| 114 | This is free software; you can redistribute it and/or modify it under | ||
| 115 | the same terms as the Perl 5 programming language system itself. | ||
| 116 | |||
| 117 | =cut | ||