Travel::Status::DE::URA - unofficial departure monitor for "Unified Realtime API" data providers (e.g. ASEAG)
use Travel::Status::DE::URA; my $status = Travel::Status::DE::URA->new( ura_base => 'http://ivu.aseag.de/interfaces/ura', ura_version => '1', stop => 'Aachen Bushof' ); for my $d ($status->results) { printf( "%s %-5s %25s (in %d min)\n", $d->time, $d->line, $d->destination, $d->countdown ); }
version 2.01
Travel::Status::DE::URA is an unofficial interface to URA-based realtime departure monitors (as used e.g. by the ASEAG). It reports all upcoming departures at a given place in real-time. Schedule information is not included.
Requests the departures as specified by opts and returns a new Travel::Status::DE::URA object.
The following two parameters are mandatory:
The URA base url.
The version, may be any string.
The request URL is ura_base/instant_Vversion, so for
http://ivu.aseag.de/interfaces/ura
, 1
this module will send
requests to http://ivu.aseag.de/interfaces/ura/instant_V1
.
All remaining parameters are optional.
Passed on to LWP::UserAgent->new
. Defaults to { timeout => 10 }
,
you can use an empty hashref to override it.
Only request departures for stops which are located up to dist meters away from the location specified by lon and lat. Example parameter: "50.78496,6.10897,100".
When set to 1 (or any other true value): Also requests stop messages from
the URA service. Thene can include texts such as "Expect delays due to snow and
ice" or "stop closed, use replacement stop X instead". Use
$status->messages
to access them.
When set to 1 (or any other true value): Also request all stops satisfying the specified parameters. They can be accessed with get_stops. Defaults to 0.
Additionally, all options supported by $status->results
may be specified
here, causing them to be used as defaults. Note that while they can be
overridden later, they may limit the set of departures requested from the
server.
In case of an HTTP request error, returns a string describing it. If none occured, returns undef.
Returns a list of stops matching $stopname. For instance, if the stops "Aachen Bushof", "Eupen Bushof", "Brand" and "Brandweiher" exist, the parameter "bushof" will return "Aachen Bushof" and "Eupen Bushof", while "brand" will only return "Brand".
Returns a hash reference describing all distinct stops returned by the request. Each key is the unique ID of a stop and contains a Travel::Status::DE::URA::Stop(3pm) object describing it.
Only works when $status was created with with_stops set to a true value. Otherwise, undef is returned.
Returns a list of messages for the stop with the ID $stop_id. At the moment, each message is a simple string. This may change in the future.
Returns a list of messages for the stop with the name $stop_name. At the moment, each message is a simple string. This may change in the future.
Returns a list of Travel::Status::DE::URA::Result(3pm) objects, each describing one departure.
Accepted parameters (all are optional):
When set to a true value: Compute routes for all results, enabling use of their route_ accessors. Otherwise, those will just return nothing (undef / empty list, depending on context).
Do not include past departures in the result list and the computed timetables.
Only return departures of line ID.
Only return departures at stop name.
Only return departures at stop ID.
Only return departures containing vianame in their route after their corresponding stop. Implies calculate_routes=1.
Only return departures containing ID in their route after their corresponding stop. Implies calculate_routes=1.
None.
Many.
Travel::Status::DE::URA::Result(3pm).
Copyright (C) 2013-2016 by Birte Kristina Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.