diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-04-19 15:13:49 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-04-19 15:13:49 +0200 |
commit | c6a434891f6ac7f87b35d2d98ffee0fdeeedd518 (patch) | |
tree | 6ec5553e10e678d9a188c674f3921a90741a3032 /lib/Travel | |
parent | 40218881cd5c83d661093b5e80c86ffc47993bf9 (diff) |
Journey: Add train_no accessor
Closes #2
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Journey.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index 71eb1e7..66ace1b 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -11,7 +11,7 @@ use Travel::Status::DE::DBRIS::Location; our $VERSION = '0.09'; Travel::Status::DE::DBRIS::Journey->mk_ro_accessors( - qw(day id train type number is_cancelled)); + qw(day id train train_no type number is_cancelled)); sub new { my ( $obj, %opt ) = @_; @@ -30,6 +30,10 @@ sub new { strptime_obj => $strptime, }; + if ( $json->{halte} and @{ $json->{halte} } ) { + $ref->{train_no} = $json->{halte}[0]{nummer}; + } + # Number is either train no (ICE, RE) or line no (S, U, Bus, ...) # with no way of distinguishing between those if ( $ref->{train} ) { |