summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-21 17:07:04 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-21 17:07:04 +0200
commitf181e2ecb0c7df5dc5cb98d7310e79aa603a9ee7 (patch)
tree03bfc55cd3db0a710cd69bccfd76d7ab3afea246 /lib
parent2f6ab37acefe264eaf95c30764ce3ca9a882122d (diff)
restore -L / lines
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/EFA.pm12
-rw-r--r--lib/Travel/Status/DE/EFA/Line.pm2
2 files changed, 6 insertions, 8 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index c936dbc..4d591d7 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -372,9 +372,11 @@ sub lines {
return @{ $self->{lines} };
}
- for my $line ( @{ $self->{response}{servingLines} // [] } ) {
+ for my $line ( @{ $self->{response}{servingLines}{lines} // [] } ) {
push( @{ $self->{lines} }, $self->parse_line($line) );
}
+
+ return @{ $self->{lines} // [] };
}
sub parse_line {
@@ -383,7 +385,9 @@ sub parse_line {
my $mode = $line->{mode} // {};
return Travel::Status::DE::EFA::Line->new(
+ type => $mode->{product},
name => $mode->{name},
+ number => $mode->{number},
direction => $mode->{destination},
valid => $mode->{timetablePeriod},
mot => $mode->{product},
@@ -515,12 +519,6 @@ sub results {
my $json = $self->{response};
- if ( not @{ $self->{lines} // [] } ) {
- for my $line ( @{ $json->{servingLines}{lines} // [] } ) {
- push( @{ $self->{lines} }, $self->parse_line($line) );
- }
- }
-
for my $departure ( @{ $json->{departureList} // [] } ) {
push( @results, $self->parse_departure($departure) );
}
diff --git a/lib/Travel/Status/DE/EFA/Line.pm b/lib/Travel/Status/DE/EFA/Line.pm
index 69526fd..4f44c7b 100644
--- a/lib/Travel/Status/DE/EFA/Line.pm
+++ b/lib/Travel/Status/DE/EFA/Line.pm
@@ -9,7 +9,7 @@ use parent 'Class::Accessor';
our $VERSION = '2.02';
Travel::Status::DE::EFA::Line->mk_ro_accessors(
- qw(direction mot name operator route type valid));
+ qw(direction mot name number operator route type valid));
my @mot_mapping = qw{
zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus