summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-07-30 10:42:21 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-07-30 10:42:21 +0200
commitaa19f4b00ca1b88fb86ec116a717b6f7549ab359 (patch)
tree5d256a6d94fc52b741f4701ea67cf09c438f017b /lib
parent0e01485952736b91346cb1270126794f023f478e (diff)
Api: section headers for helpers / controllers; perltidy
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx/Controller/Api.pm20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm
index 974b9ca..3e9c5eb 100755
--- a/lib/Travelynx/Controller/Api.pm
+++ b/lib/Travelynx/Controller/Api.pm
@@ -10,6 +10,8 @@ use List::Util;
use Travel::Status::DE::IRIS::Stations;
use UUID::Tiny qw(:std);
+# Internal Helpers
+
sub make_token {
return create_uuid_as_string(UUID_V4);
}
@@ -28,6 +30,8 @@ sub sanitize {
return 0;
}
+# Contollers
+
sub documentation {
my ($self) = @_;
@@ -236,7 +240,7 @@ sub travel_v1 {
$self->render(
json => {
success => \0,
- error =>
+ error =>
'Error requesting departures from fromStation: '
. $status->{errstr},
status => $self->get_user_status_json_v1($uid)
@@ -457,13 +461,13 @@ sub import_v1 {
}
%opt = (
- uid => $uid,
- train_type => sanitize( q{}, $payload->{train}{type} ),
- train_no => sanitize( q{}, $payload->{train}{no} ),
- train_line => sanitize( q{}, $payload->{train}{line} ),
- cancelled => $payload->{cancelled} ? 1 : 0,
- dep_station => sanitize( q{}, $payload->{fromStation}{name} ),
- arr_station => sanitize( q{}, $payload->{toStation}{name} ),
+ uid => $uid,
+ train_type => sanitize( q{}, $payload->{train}{type} ),
+ train_no => sanitize( q{}, $payload->{train}{no} ),
+ train_line => sanitize( q{}, $payload->{train}{line} ),
+ cancelled => $payload->{cancelled} ? 1 : 0,
+ dep_station => sanitize( q{}, $payload->{fromStation}{name} ),
+ arr_station => sanitize( q{}, $payload->{toStation}{name} ),
sched_departure =>
sanitize( 0, $payload->{fromStation}{scheduledTime} ),
rt_departure => sanitize(