NAME
Travel::Status::DE::URA - unofficial departure monitor for "Unified Realtime API" data providers (e.g. ASEAG)
SYNOPSIS
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
version 1.00
DESCRIPTION
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.
METHODS
- my $status = Travel::Status::DE::URA->new(%opt)
-
Requests the departures as specified by opts and returns a new Travel::Status::DE::URA object.
The following two parameters are mandatory:
The request URL is ura_base/instant_Vversion, so for
http://ivu.aseag.de/interfaces/ura
,1
this module will send requests tohttp://ivu.aseag.de/interfaces/ura/instant_V1
.The following parameter is optional:
- lwp_options => \%hashref
-
Passed on to
LWP::UserAgent->new
. Defaults to{ timeout => 10 }
, you can use an empty hashref to override it.
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. - $status->errstr
-
In case of an HTTP request error, returns a string describing it. If none occured, returns undef.
- $status->get_stop_by_name($stopname)
-
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".
- $status->results(%opt)
-
Returns a list of Travel::Status::DE::URA::Result(3pm) objects, each describing one departure.
Accepted parameters (all are optional):
- calculate_routes => bool (default 0)
-
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).
- hide_past => bool (default 1)
-
Do not include past departures in the result list and the computed timetables.
- stop => name
-
Only return departures at stop name.
- via => vianame
-
Only return departures containing vianame in their route after their corresponding stop. Implies calculate_routes=1.
DIAGNOSTICS
None.
DEPENDENCIES
Class::Accessor(3pm)
DateTime(3pm)
List::MoreUtils(3pm)
LWP::UserAgent(3pm)
Text::CSV(3pm)
BUGS AND LIMITATIONS
Many.
SEE ALSO
Travel::Status::DE::URA::Result(3pm).
AUTHOR
Copyright (C) 2013-2015 by Daniel Friesel <derf@finalrewind.org>
LICENSE
This module is licensed under the same terms as Perl itself.