From d7c69acf417b5f26c031cb79f36783c86d172e91 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 26 Jan 2020 10:48:41 +0100 Subject: import API: route -> intermediateStops --- lib/Travelynx/Controller/Api.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'lib/Travelynx/Controller') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index e55b2b2..20817d9 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -18,7 +18,10 @@ sub sanitize { if ( $type eq '' ) { return '' . $value; } - return 0 + $value; + if ( $value =~ m{ ^ [0-9.e]+ $ }x ) { + return 0 + $value; + } + return 0; } sub documentation { @@ -457,9 +460,12 @@ sub import_v1 { lax => $payload->{lax} ? 1 : 0, ); - if ( $payload->{route} and ref( $payload->{route} ) eq 'ARRAY' ) { - $opt{route} - = [ map { sanitize( q{}, $_ ) } @{ $payload->{route} } ]; + if ( $payload->{intermediateStops} + and ref( $payload->{intermediateStops} ) eq 'ARRAY' ) + { + $opt{intermediateStops} + = [ map { sanitize( q{}, $_ ) } + @{ $payload->{intermediateStops} } ]; } for my $key (qw(sched_departure rt_departure sched_arrival rt_arrival)) -- cgit v1.2.3