Travel::Status::DE::DBWagenreihung - Interface to Deutsche Bahn carriage formation API.
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 0.18
This is beta software. The API may change without notice.
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.
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:
Scheduled departure at the station of interest. Must be a DateTime object. Mandatory.
EVA ID of the station of interest.
Train type, e.g. "S" or "ICE".
Train number.
In case of a fatal HTTP or backend error, returns a string describing it. Returns undef otherwise.
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.
Describes the individual carriages the train consists of. Returns a list of Travel::Status::DE::DBWagenreihung::carriage objects.
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).
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).
Returns the platform name.
Describes the sectors of the platform this train will depart from. Returns a list of Travel::Status::DE::DBWagenreihung::Sector objects.
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).
Returns a string describing the train type, e.g. "ICE" or "IC".
Many. This is beta software.
Copyright (C) 2018-2024 by Birte Kristina Friesel <derf@finalrewind.org>
This module is licensed under the same terms as Perl itself.