Unverified Commit f55b3d48 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

HAFAS: cleanup

parent a6bbc9f5
Loading
Loading
Loading
Loading
+47 −65
Original line number Diff line number Diff line
@@ -216,9 +216,6 @@ sub new {

	my $req;

	if (0) {
	}
	else {
	my $date = ( $conf{datetime} // $now )->strftime('%Y%m%d');
	my $time = ( $conf{datetime} // $now )->strftime('%H%M%S');

@@ -266,7 +263,6 @@ sub new {
		],
		%{ $hafas_instance{$service}{request} }
	};
	}

	if ( $conf{language} ) {
		$req->{lang} = $conf{language};
@@ -338,14 +334,9 @@ sub new_p {
	my ( $obj, %conf ) = @_;
	my $promise = $conf{promise}->new;

	if (
		not(   $conf{station}
			or $conf{journey}
			or $conf{geoSearch}
			or $conf{locationSearch} )
	  )
	{
		return $promise->reject('station or journey flag must be passed');
	if ( not( $conf{from_stop} and $conf{to_stop} ) ) {
		confess('from_stop and to_stop must be specified');
		return $promise->reject('from_stop and to_stop must be specified');
	}

	my $self = $obj->new( %conf, async => 1 );
@@ -356,15 +347,7 @@ sub new_p {
			my ($content) = @_;
			$self->{raw_json} = $self->{json}->decode($content);
			$self->check_mgate;
			if ( $conf{journey} ) {
				$self->parse_journey;
			}
			elsif ( $conf{geoSearch} or $conf{locationSearch} ) {
				$self->parse_search;
			}
			else {
				$self->parse_board;
			}
			$self->parse_trips;
			if ( $self->errstr ) {
				$promise->reject( $self->errstr, $self );
			}
@@ -448,7 +431,6 @@ sub post_with_cache {
	my $content = $reply->content;

	if ($cache) {
		say "freeeez";
		$cache->freeze( $self->{post}, \$content );
	}