diff options
-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 { |