From 89e709d8d593939ab528b81d125fd37d303c4fa9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Wed, 30 Sep 2020 19:12:29 +0200 Subject: Allow linking a Träwelling account, auto-sync Träwelling→travelynx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit travelynx→Träwelling is still work-in-progress Squashed commit of the following: commit 97faa6e2e6c8d20fba30f2d0f6e78187ceeb72e6 Author: Daniel Friesel Date: Wed Sep 30 18:50:05 2020 +0200 improve traewelling log and tx handling commit 487d7dd728b9d45b731bdc7098cf3358ea2e206e Author: Daniel Friesel Date: Wed Sep 30 18:02:41 2020 +0200 add missing traewelling template commit 0148da2f48d9a52dcddc0ab81f83d8f8ac3062ab Author: Daniel Friesel Date: Wed Sep 30 18:02:35 2020 +0200 improve traewelling pull sync commit 4861a9750f9f2d7621043361d0af6b0a8869a0df Author: Daniel Friesel Date: Tue Sep 29 22:14:24 2020 +0200 wip checkin from traewelling commit f6aeb6f06998a2a7a80f63a7b1b688b1a26b66bd Author: Daniel Friesel Date: Tue Sep 29 18:37:53 2020 +0200 refactor traewelling integration. login and logout are less of a hack now. checkin and checkout are not supported at the moment. --- lib/Travelynx/Controller/Api.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'lib/Travelynx/Controller/Api.pm') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index c7e58a9..8d2d2a7 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -258,14 +258,21 @@ sub travel_v1 { $train_id = $train->train_id; } - my ( $train, $error ) - = $self->checkin( $from_station, $train_id, $uid ); + my ( $train, $error ) = $self->checkin( + station => $from_station, + train_id => $train_id, + uid => $uid + ); if ( $payload->{comment} and not $error ) { $self->update_in_transit_comment( sanitize( q{}, $payload->{comment} ), $uid ); } if ( $to_station and not $error ) { - ( $train, $error ) = $self->checkout( $to_station, 0, $uid ); + ( $train, $error ) = $self->checkout( + station => $to_station, + force => 0, + uid => $uid + ); } if ($error) { $self->render( @@ -307,8 +314,11 @@ sub travel_v1 { sanitize( q{}, $payload->{comment} ), $uid ); } - my ( $train, $error ) - = $self->checkout( $to_station, $payload->{force} ? 1 : 0, $uid ); + my ( $train, $error ) = $self->checkout( + station => $to_station, + force => $payload->{force} ? 1 : 0, + uid => $uid + ); if ($error) { $self->render( json => { -- cgit v1.2.3