Commit d44cca58 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

add api_version field

parent 75ac18c0
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -64,6 +64,11 @@ sub handle_request {
	my $backend        = $self->param('backend')      // 'ris';
	my $callback       = $self->param('callback');

	my $api_version
	  = $backend eq 'iris'
	  ? $Travel::Status::DE::IRIS::VERSION
	  : $Travel::Status::DE::DeutscheBahn::VERSION;

	$self->stash( departures => [] );
	$self->stash( title      => 'db-fakedisplay' );
	$self->stash( version    => $VERSION );
@@ -87,6 +92,7 @@ sub handle_request {
			  Travel::Status::DE::IRIS::Stations::get_station($station);
			$json = $self->render_to_string(
				json => {
					api_version => $api_version,
					version     => $VERSION,
					error       => 'ambiguous station code/name',
					candidates  => \@candidates,
@@ -96,6 +102,7 @@ sub handle_request {
		else {
			$json = $self->render_to_string(
				json => {
					api_version => $api_version,
					version     => $VERSION,
					error       => 'unknown station code/name',
				}
@@ -235,6 +242,7 @@ sub handle_request {
	if ( $template eq 'json' ) {
		my $json = $self->render_to_string(
			json => {
				api_version  => $api_version,
				preformatted => \@departures,
				version      => $VERSION,
				raw          => \@results,