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

Add AVV Augsburg

Short code may change, as AVV also means Aachener Verkehrsverbund
parent 4b7e3b81
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ use Carp qw(confess cluck);
use DateTime;
use DateTime::Format::Strptime;
use Encode qw(encode);
use IO::Socket::SSL;
use JSON;
use Travel::Status::DE::EFA::Departure;
use Travel::Status::DE::EFA::Info;
@@ -66,6 +67,7 @@ sub new_p {
sub new {
	my ( $class, %opt ) = @_;

	my $tls_insecure = 0;
	$opt{timeout} //= 10;
	if ( $opt{timeout} <= 0 ) {
		delete $opt{timeout};
@@ -105,6 +107,9 @@ sub new {
				$opt{efa_url} .= '/XML_DM_REQUEST';
			}
			$opt{time_zone} //= $service->{time_zone};
			if ( not $service->{tls_verify} ) {
				$tls_insecure = 1;
			}
		}
	}

@@ -248,6 +253,12 @@ sub new {
	}
	else {
		my %lwp_options = %{ $opt{lwp_options} // { timeout => 10 } };
		if ($tls_insecure) {
			$lwp_options{ssl_opts}{SSL_verify_mode}
			  = IO::Socket::SSL::SSL_VERIFY_NONE;
			$lwp_options{ssl_opts}{verify_hostname} = 0;
		}

		$self->{ua} = LWP::UserAgent->new(%lwp_options);
		$self->{ua}->env_proxy;
	}
+12 −6
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ sub load_instance {
		url        => $opt{url} // $data->{options}{endpoint} =~ s{ / $ }{}rx,
		time_zone  => $data->{timezone},
		languages  => $data->{supportedLanguages},
		tls_verify => $opt{tls_verify} // 1,
		coverage   => {
			area    => $data->{coverage}{realtimeCoverage}{area},
			regions => $data->{coverage}{realtimeCoverage}{region} // []
@@ -35,6 +36,11 @@ sub load_instance {
# VRT: Encoding issues
# VVSt: NXDOMAIN
my %efa_instance = (
	AVV => {
		url        => 'https://fahrtauskunft.avv-augsburg.de/efa',
		name       => 'Augsburger Verkehrs- & Tarifverbund',
		tls_verify => 0,
	},
	BEG => {
		url  => 'https://bahnland-bayern.de/efa',
		name => 'Bayerische Eisenbahngesellschaft',