diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-02-21 19:21:58 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-02-21 19:21:58 +0100 |
commit | 1df3b6f96e93ebd520deccaed41dd9418e50d11f (patch) | |
tree | 4ecc6fe5e063a530e2b83ecbf93a24a8b652b617 /lib/Travel/Status | |
parent | dee03a03ddb80efeb500f1cc38c5b27ccb676ef3 (diff) |
new_p: Add formation, locationSearch, journey support
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS.pm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm index 6bbce05..57560ef 100644 --- a/lib/Travel/Status/DE/DBRIS.pm +++ b/lib/Travel/Status/DE/DBRIS.pm @@ -107,7 +107,7 @@ sub new { } else { confess( - 'station / geoSearch / locationSearch / journey must be specified' +'station / formation / geoSearch / locationSearch / journey must be specified' ); } @@ -172,10 +172,15 @@ sub new_p { if ( not( $conf{station} - or $conf{geoSearch} ) + or $conf{formation} + or $conf{geoSearch} + or $conf{locationSearch} + or $conf{journey} ) ) { - return $promise->reject('station / geoSearch flag must be passed'); + return $promise->reject( + 'station / geoSearch / locationSearch / journey flag must be passed' + ); } my $self = $obj->new( %conf, async => 1 ); @@ -185,14 +190,21 @@ sub new_p { sub { my ($content) = @_; $self->{raw_json} = $self->{json}->decode($content); + if ( $conf{station} ) { $self->parse_stationboard; } + elsif ( $conf{journey} ) { + $self->parse_journey; + } elsif ( $conf{geoSearch} or $conf{locationSearch} ) { $self->parse_search; } + elsif ( $conf{formation} ) { + $self->parse_formation( $conf{formation} ); + } else { - $promise->resolve($self); + $promise->reject( 'dead code path reached in new_p', $self ); } return; } |