NAME
Travel::Status::DE::DBWagenreihung - Interface to Deutsche Bahn Wagon Order API.
SYNOPSIS
use Travel::Status::DE::DBWagenreihung;
my $wr = Travel::Status::DE::DBWagenreihung->new(
departure => 'DateTime or YYYYMMDDhhmm',
train_number => 1234,
);
for my $wagon ( $wr->wagons ) {
printf("Wagen %s: Abschnitt %s\n", $wagon->number // '?', $wagon->section);
}
VERSION
version 0.12
This is beta software. The API may change without notice.
DESCRIPTION
Travel:Status:DE::DBWagenreihung is an unofficial interface to the Deutsche Bahn Wagon Order API at https://www.apps-bahn.de/wr/wagenreihung/1.0. It returns station-specific wagon orders for long-distance trains operated by Deutsche Bahn. Data includes wagon positions on the platform, the ICE series, wagon-specific attributes such as first/second class or family coaches, and the internal type and number of each wagon.
Positions on the platform are given both in meters and per cent (relative to platform length).
At the time of this writing, only ICE trains are officially supported by the backend, and even then glitches may occur. IC/EC trains are not officially supported; reported wagon orders may be correct, may lack unscheduled changes, or may be completely bogus.
METHODS
- my $wr = Travel::Status::DE::DBWagenreihung->new(%opts)
-
Requests wagon order 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 | YYYYMMDDhhmm
-
Scheduled departure at the station of interested. Must be either a DateTime object or a string in YYYYMMDDhhmm format. Mandatory.
- train_number => number
-
Train number. Do not include the train type: Use "8" for "EC 8" or "100" for "ICE 100".
- $wr->destinations
-
Returns a list describing all final destinations of this train. In most cases, it contains one element, however, for trains consisting of multiple wings, it contains one element for each wing.
Each destination is a hash ref containing the destination name and the corresponding platform sections (at the moment, this is a list of section identifiers).
This function is subject to change.
- $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->errstr
-
In case of a fatal HTTP or backend error, returns a string describing it. Returns undef otherwise.
- $wr->origins
-
Returns a list of stations this train originates from. In most cases, this is just one element; however, for trains consisting of multiple wings, it gives the origin of each wing unless they are identical.
Each origin is a station name.
This function is subject to change.
- $wr->platform
-
Returns the platform name.
- $wr->sections
-
Describes the sections of the platform this train will depart from. Returns a list of Travel::Status::DE::DBWagenreihung::Section objects.
- $wr->station_ds100
-
Returns the DS100 identifier of the requested station.
- $wr->station_name
-
Returns the name of the requested station.
- $wr->station_uic
-
Returns the international id (UIC ID / IBNR) of the requested station.
- $wr->train_descriptions
-
Returns a list of hashes describing the rolling stock used for this train based on model and locomotive (if present). Each hash contains the keys text (textual representation, see
$wr->train_desc
) and sections (arrayref of corresponding sections). - $wr->wagongroup_description
-
Returns two strings describing the rolling stock used for this train based on model and locomotive (if present). The first one tries to be conscise (e.g. "ICE 4"). The second is more detailed, e.g. "ICE 4 Hochgeschwindigkeitszug", "IC 2 Twindexx mit elektrischer Lokomotive", or "Diesel-Triebzug".
- $wr->wagongroup_model
-
Returns a string describing the rolling stock used for this train, e.g. "ICE 4" or "IC2 KISS".
- $wr->train_numbers
-
Returns the list of train numbers for this departure. In most cases, this is just one element. For trains consisting of multiple wings (which typically have different numbers), it contains one element for each wing.
- $wr->train_type
-
Returns a string describing the train type, e.g. "ICE" or "IC".
- $wr->wagongroup_subtype
-
Returns a string describing the rolling stock model used for this train, e.g. "412" (model 412 aka ICE 4) or "411.S2" (model 411 aka ICE T, series 2).
- $wr->wagons
-
Describes the individual wagons the train consists of. Returns a list of Travel::Status::DE::DBWagenreihung::Wagon objects.
DEPENDENCIES
BUGS AND LIMITATIONS
Many. This is beta software.
REPOSITORY
https://github.com/derf/Travel-Status-DE-DBWagenreihung
AUTHOR
Copyright (C) 2018-2019 by Birte Kristina Friesel <derf@finalrewind.org>
LICENSE
This module is licensed under the same terms as Perl itself.