NAME

OpenGbg::Service::TrafficCamera::GetCameraImage - A traffic camera image

SYNOPSIS

use Path::Tiny;

my $camera_id = 30;
my $traffic_camera_service = OpenGbg->new->traffic_camera;
my $get_camera_image = $traffic_camera_service->get_camera_image($camera_id);

say sprintf '%s bytes', $get_camera_image->size;
path(sprintf 'image-%s-%s.jpg', time, $camera_id)->spew($get_camera_image->image);

ATTRIBUTES

image_size

Integer. The image size in bytes. Sometimes cameras are out-of-order, and returns a dummy image. These are at the time of writing less than 10kb, and is therefore useful to filter on (if these images are unwanted).

timestamp

A DateTime object, rounded down to the closest minute. The timestamp of the image is not given in the response from the web service. This DateTime object is created as a convenience.

AUTHOR

Erik Carlsson <info@code301.com>

COPYRIGHT

Copyright 2014 - Erik Carlsson

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.