summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-01-26 10:48:41 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-01-26 10:50:21 +0100
commitd7c69acf417b5f26c031cb79f36783c86d172e91 (patch)
treea5a28f3f89f32857c310642b7d2b76510038df9a
parentba62df34ea8794f909407beb4b3c182994ae6031 (diff)
import API: route -> intermediateStops
-rwxr-xr-xlib/Travelynx/Controller/Api.pm14
-rw-r--r--templates/api_documentation.html.ep4
2 files changed, 11 insertions, 7 deletions
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))
diff --git a/templates/api_documentation.html.ep b/templates/api_documentation.html.ep
index c20d37c..4a3700a 100644
--- a/templates/api_documentation.html.ep
+++ b/templates/api_documentation.html.ep
@@ -189,10 +189,8 @@
"scheduledTime": 1556083980, (UNIX-Timestamp)<br/>
"realTime": 1556083980, (UNIX-Timestamp, optional, default == scheduledTime)<br/>
},<br/>
- "route" : [ (optionale Liste mit Unterwegshalten als Name oder DS100, darf keine Stationen vor Checkin oder nach Checkout beinhalten)<br/>
- "Essen Hbf",<br/>
+ "intermediateStops" : [ (optionale Liste mit Unterwegshalten als Name oder DS100, darf keine Stationen vor Checkin oder nach Checkout beinhalten)<br/>
"Essen Süd",<br/>
- "Essen Stadtwald"<br/>
],<br/>
"comment" : "Beliebiger Text" (optionaler Freitext-Kommentar)<br/>
}