NAME
Travel::Status::DE::DBWagenreihung - Interface to Deutsche Bahn carriage formation API.
SYNOPSIS
use Travel::Status::DE::DBWagenreihung;
my $wr = Travel::Status::DE::DBWagenreihung->new(
eva => 8000080,
departure => $datetime,
train_type => 'IC',
train_number => 2045,
);
for my $carriage ( $wr->carriages ) {
printf("Wagen %s: Abschnitt %s\n", $carriage->number // '?', $carriage->sector);
}
VERSION
version 0.17
This is beta software. The API may change without notice.
DESCRIPTION
Travel:Status:DE::DBWagenreihung is an unofficial interface to the Deutsche Bahn carriage formation API. It returns station-specific carriage formations (also kwnown as coach sequences) for a variety of trains in the rail network associated with Deutsche Bahn. Data includes carriage positions on the platform, train type (e.g. ICE series), carriage-specific attributes such as first/second class, and the internal type and number of each carriage.
Positions on the platform are given both in meters and percent (relative to platform length).
Note that carriage formation data reported by the API is known to be bogus from time to time. This module does not perform thorough sanity checking.
METHODS
- my $wr = Travel::Status::DE::DBWagenreihung->new(%opts)
-
Requests carriage formation for a specific train at a specific scheduled departure time and date, which implicitly encodes the requested station. Use Travel::Status::DE::IRIS or similar to map station name and train number to scheduled departure.
Arguments:
- departure => datetime-obj
-
Scheduled departure at the station of interest. Must be a DateTime object. Mandatory.
- eva => number
-
EVA ID of the station of interest.
- train_type => string
-
Train type, e.g. "S" or "ICE".
- train_number => number
-
Train number.
- $wr->errstr
-
In case of a fatal HTTP or backend error, returns a string describing it. Returns undef otherwise.
- $wr->groups
-
Returns a list of Travel::Status::DE::DBWagenreihung::Group(3pm) objects which describe the groups making up the carriage formation. Individual groups may have distinct destinations or train numbers. Each group contains a set of carriages.
- $wr->carriages
-
Describes the individual carriages the train consists of. Returns a list of Travel::Status::DE::DBWagenreihung::carriage objects.
- $wr->direction
-
Gives the train's direction of travel. Returns 0 if the train will depart towards position 0 and 100 if the train will depart towards the other platform end (mnemonic: towards the 100% position).
- $wr->destinations
-
Returns a list describing the unique destinations of this train's carriage groups. Each destination is a hashref that contains its name, a groups arrayref to the corresponding Travel::Status::DE::DBWagenreihung::Group(3pm) objects, and a sections arrayref to section identifiers (subject to change).
- $wr->platform
-
Returns the platform name.
- $wr->sectors
-
Describes the sectors of the platform this train will depart from. Returns a list of Travel::Status::DE::DBWagenreihung::Sector objects.
- $wr->train_numbers
-
Returns a list describing the unique train numbers associated with this train's carriage groups. Each train number is a hashref that contains its name (i.e., number), a groups arrayref to the corresponding Travel::Status::DE::DBWagenreihung::Group(3pm) objects, and a sections arrayref to section identifiers (subject to change).
- $wr->train_type
-
Returns a string describing the train type, e.g. "ICE" or "IC".
DEPENDENCIES
BUGS AND LIMITATIONS
Many. This is beta software.
REPOSITORY
https://github.com/derf/Travel-Status-DE-DBWagenreihung
AUTHOR
Copyright (C) 2018-2024 by Birte Kristina Friesel <derf@finalrewind.org>
LICENSE
This module is licensed under the same terms as Perl itself.