summaryrefslogtreecommitdiff
path: root/lib/Travel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel')
-rw-r--r--lib/Travel/Status/DE/EFA.pm28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 8b7b506..7e2f651 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -192,7 +192,7 @@ sub new {
$self->{post} = {
locationServerActive => 1,
type_sf => 'any',
- name => $opt{stopfinder}{name},
+ name_sf => $opt{stopfinder}{name},
anyObjFilter_sf => 2,
coordOutputFormat => 'WGS84[DD.DDDDD]',
outputFormat => 'JSON',
@@ -536,6 +536,9 @@ sub results {
if ( $self->{post}{coord} ) {
return $self->results_coord;
}
+ elsif ( $self->{post}{name_sf} ) {
+ return $self->results_stopfinder;
+ }
else {
return $self->results_dm;
}
@@ -564,6 +567,29 @@ sub results_coord {
return @results;
}
+sub results_stopfinder {
+ my ($self) = @_;
+ my $json = $self->{response};
+
+ my @results;
+ for my $stop ( @{ $json->{stopFinder}{points} // [] } ) {
+ push(
+ @results,
+ Travel::Status::DE::EFA::Stop->new(
+ place => $stop->{ref}{place},
+ full_name => $stop->{name},
+ name => $stop->{object},
+ id => $stop->{stateless},
+ stop_id => $stop->{ref}{gid},
+ )
+ );
+ }
+
+ $self->{results} = \@results;
+
+ return @results;
+}
+
sub results_dm {
my ($self) = @_;
my $json = $self->{response};