From 419910edcd32777bdea5ca9c2e9ba900bab70ffe Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 5 Oct 2024 04:55:35 +0200 Subject: EFA: Replace ->stop_name, ->stop_id with ->stop --- lib/Travel/Status/DE/EFA.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/Travel') 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 { -- cgit v1.2.3