From d4f528767cc904320c26b30abf8bb5d83548514b Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 21 Mar 2021 05:10:16 +0100 Subject: Remove no longer used JSON API versions 1 and 2 --- lib/DBInfoscreen/Controller/Stationboard.pm | 95 +++-------------------------- 1 file changed, 8 insertions(+), 87 deletions(-) (limited to 'lib/DBInfoscreen/Controller') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 28ab239..1abe998 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1053,94 +1053,15 @@ sub handle_result { my @json_route = $self->json_route_diff( [ $result->route ], [ $result->sched_route ] ); - if ( $apiver eq '1' ) { - push( - @departures, - { - delay => $delay, - destination => $result->destination, - isCancelled => $result->can('is_cancelled') - ? $result->is_cancelled - : undef, - messages => { - delay => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->delay_messages - ], - qos => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->qos_messages - ], - }, - platform => $result->platform, - route => \@json_route, - scheduledPlatform => $result->sched_platform, - time => $time, - train => $result->train, - via => [ $result->route_interesting(3) ], - } - ); - } - elsif ( $apiver eq '2' ) { - my ( $delay_arr, $delay_dep, $sched_arr, $sched_dep ); - if ( $result->arrival ) { - $delay_arr = $result->arrival->subtract_datetime( - $result->sched_arrival )->in_units('minutes'); - } - if ( $result->departure ) { - $delay_dep = $result->departure->subtract_datetime( - $result->sched_departure )->in_units('minutes'); - } - if ( $result->sched_arrival ) { - $sched_arr = $result->sched_arrival->strftime('%H:%M'); - } - if ( $result->sched_departure ) { - $sched_dep = $result->sched_departure->strftime('%H:%M'); - } - push( - @departures, - { - delayArrival => $delay_arr, - delayDeparture => $delay_dep, - destination => $result->destination, - isCancelled => $result->can('is_cancelled') - ? $result->is_cancelled - : undef, - messages => { - delay => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->delay_messages - ], - qos => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->qos_messages - ], - }, - platform => $result->platform, - route => \@json_route, - scheduledPlatform => $result->sched_platform, - scheduledArrival => $sched_arr, - scheduledDeparture => $sched_dep, - train => $result->train, - via => [ $result->route_interesting(3) ], - } + if ( $apiver eq '1' or $apiver eq '2' ) { + + # no longer supported + $self->handle_no_results_json( + $backend, undef, + "JSON API version=${apiver} is no longer supported", + $Travel::Status::DE::IRIS::VERSION ); + return; } else { # apiver == 3 my ( $delay_arr, $delay_dep, $sched_arr, $sched_dep ); -- cgit v1.2.3