diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-05 04:55:35 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-05 04:55:35 +0200 |
commit | 419910edcd32777bdea5ca9c2e9ba900bab70ffe (patch) | |
tree | 1bbb1a449b4fe2d3e3c456a5884b1d045c2708cb | |
parent | 09e73c73ca20c19af3461eff6c5ce27bd1ea9120 (diff) |
EFA: Replace ->stop_name, ->stop_id with ->stop
-rwxr-xr-x | bin/efa-m | 4 | ||||
-rw-r--r-- | lib/Travel/Status/DE/EFA.pm | 19 |
2 files changed, 15 insertions, 8 deletions
@@ -369,8 +369,8 @@ sub show_results { say $stop->full_name; } } - elsif ( $efa->stop_name ) { - say $efa->stop_name; + elsif ( $efa->stop->full_name ) { + say $efa->stop->full_name; } for my $d ( $efa->results ) { diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm index fd37756..90e26e8 100644 --- a/lib/Travel/Status/DE/EFA.pm +++ b/lib/Travel/Status/DE/EFA.pm @@ -388,16 +388,23 @@ sub check_for_ambiguous { return; } -sub stop_name { +sub stop { my ($self) = @_; + if ( $self->{stop} ) { + return $self->{stop}; + } - return $self->{response}{dm}{points}{point}{name}; -} + my $point = $self->{response}{dm}{points}{point}; + my $place = $point->{ref}{place}; -sub stop_id { - my ($self) = @_; + $self->{stop} = Travel::Status::DE::EFA::Stop->new( + place => $place, + full_name => $point->{name}, + name => $point->{name} =~ s{\Q$place\E,? ?}{}r, + id => $point->{stateless}, + ); - return $self->{response}{dm}{points}{point}{stateless}; + return $self->{stop}; } sub stops { |