- COPYRIGHT AND LICENSE
OpenGbg - An interface to the Open Data API of Gothenburg
Version 0.1404, released 2018-05-19.
use OpenGbg; my $opengbg = OpenGbg->new(key => 'secret-api-key'); $stations = $opengbg->styr_och_stall->get_bike_stations; print $stations->get_by_index(0)->to_text;
OpenGbg is a way to connect to and use the open data published by the city of Gothenburg.
To use the API you need to sign up for a free api key.
Once you have your api key you can use it to authenticate in two different ways:
1. You can give it in the constructor:
my $opengbg = OpenGbg->new(key => 'secret-api-key');
2. You can save it in a file named
.opengbg.ini in your homedir (recommended):
[API] key = secret-api-key
Takes an optional key-value pair, the key is
key and the value your api key, see authenticate.
my $gbg = OpenGbg->new(key => 'secret-api-key'); # or, if the api key is set in C<.opengbg.ini>: my $gbg = OpenGbg->new;
The following services are currently implemented in this distribution:
$gbg->air_quality - Data on air quality
$gbg->bridge - Data on the openness of Göta Älvbron
$gbg->styr_och_stall - Data on rent-a-bike stations (deprecated)
$gbg->traffic_camera - Data on traffic cameras, and their images
Most names related to the services are de-camelized, while others are lower-cased (no underscores). For example, the service 'GetBikeStations' is called like this:
my $gbg = OpenGbg->new; my $stations = $gbg->styr_och_stall->get_bike_stations;
All calls to services are prefixed with 'get' even if the service isn't named that way. On the other hand, the 'service' suffix on some services are removed.
Date/time intervals are always called
end (in the web services they are sometimes called 'start' and 'stop').
This is not an official distribution.
Erik Carlsson <firstname.lastname@example.org>
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.