summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-10-02 21:00:47 +0200
committerDaniel Friesel <derf@finalrewind.org>2022-10-02 21:00:47 +0200
commit5d35f32a3c6da3359ee33810fd08a077f63bb0ea (patch)
tree7e3f04881be254712e5f4476f4a174613669e8af /lib/Travel/Status
parenta02fc782b199b17a6a94f091cc80271289fef262 (diff)
mgate: use request config from service definition
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm27
1 files changed, 7 insertions, 20 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index c313a44..56a79b3 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -32,10 +32,7 @@ my %hafas_instance = (
# productbits => [qw[s u tram bus ferry ice regio ondemand]],
#},
DB => {
- url => 'https://reiseauskunft.bahn.de/bin/bhftafel.exe',
stopfinder => 'https://reiseauskunft.bahn.de/bin/ajax-getstop.exe',
- trainsearch => 'https://reiseauskunft.bahn.de/bin/trainsearch.exe',
- traininfo => 'https://reiseauskunft.bahn.de/bin/traininfo.exe',
mgate => 'https://reiseauskunft.bahn.de/bin/mgate.exe',
name => 'Deutsche Bahn',
productbits => [qw[ice ic_ec d regio s bus ferry u tram ondemand]],
@@ -51,7 +48,7 @@ my %hafas_instance = (
ver => '1.15',
auth => {
type => 'AID',
- aid => 'n91dB8Z77MLdoR0K'
+ aid => 'n91dB8Z77' . 'MLdoR0K'
},
},
},
@@ -207,18 +204,7 @@ sub new_mgate {
meth => 'StationBoard'
}
],
- client => {
- id => 'DB',
- v => '20100000',
- type => 'IPH',
- name => 'DB Navigator'
- },
- ext => 'DB.R21.12.a',
- ver => '1.15',
- auth => {
- type => 'AID',
- 'aid' => 'n91dB8Z77MLdoR0K'
- }
+ %{ $hafas_instance{$service}{request} }
};
$req = $json->encode($req);
@@ -403,7 +389,11 @@ sub check_input_error {
sub check_mgate {
my ($self) = @_;
- if ( $self->{raw_json}{cInfo}{code} ne 'OK' ) {
+ if ( $self->{raw_json}{err} ) {
+ $self->{errstr} = 'error code is ' . $self->{raw_json}{err};
+ $self->{errcode} = $self->{raw_json}{err};
+ }
+ elsif ( $self->{raw_json}{cInfo}{code} ne 'OK' ) {
$self->{errstr} = 'cInfo code is ' . $self->{raw_json}{cInfo}{code};
$self->{errcode} = $self->{raw_json}{cInfo}{code};
}
@@ -438,9 +428,6 @@ sub similar_stops {
if ( $service and exists $hafas_instance{$service}{stopfinder} ) {
- # we do not pass our constructor's language argument here,
- # because most stopfinder services do not return any results
- # for languages other than german ('d' aka the default)
my $sf = Travel::Status::DE::HAFAS::StopFinder->new(
url => $hafas_instance{$service}{stopfinder},
input => $self->{station},