summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 19:34:48 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 19:34:48 +0200
commit8aa394bf04ebc6cd29d1c0cceafa76c7e43e794f (patch)
tree3b936f3dc623c0fc61ec2644f4565f0b8a1ae6b5 /lib
parentc8d2e1297dcd160dae4451e53889d920e8fb9804 (diff)
oh look! stopseq support!
(parser is still missing)
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/EFA.pm45
1 files changed, 29 insertions, 16 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index e2d7e18..d0f8504 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -145,7 +145,7 @@ sub new {
delete $opt{timeout};
}
- if ( not( $opt{name} or $opt{from_json} ) ) {
+ if ( not( $opt{name} or $opt{stopseq} or $opt{from_json} ) ) {
confess('You must specify a name');
}
if ( $opt{type}
@@ -156,7 +156,7 @@ sub new {
if ( $opt{service} and exists $efa_instance{ $opt{service} } ) {
$opt{efa_url} = $efa_instance{ $opt{service} }{url};
- if ( $opt{journey} ) {
+ if ( $opt{stopseq} ) {
$opt{efa_url} .= '/XML_STOPSEQCOORD_REQUEST';
}
else {
@@ -211,20 +211,6 @@ sub new {
}
my $self = {
- post => {
- language => 'de',
- mode => 'direct',
- outputFormat => 'JSON',
- type_dm => $opt{type} // 'stop',
- useProxFootSearch => $opt{proximity_search} ? '1' : '0',
- useRealtime => '1',
- itdDateDay => $dt->day,
- itdDateMonth => $dt->month,
- itdDateYear => $dt->year,
- itdTimeHour => $dt->hour,
- itdTimeMinute => $dt->minute,
- name_dm => encode( 'UTF-8', $opt{name} ),
- },
response => $opt{from_json},
developer_mode => $opt{developer_mode},
efa_url => $opt{efa_url},
@@ -241,6 +227,33 @@ sub new {
json => JSON->new->utf8,
};
+ if ( $opt{stopseq} ) {
+ $self->{post} = {
+ line => $opt{stopseq}{stateless},
+ stop => $opt{stopseq}{stop_id},
+ tripCode => $opt{stopseq}{key},
+ date => $opt{stopseq}{date},
+ coordOutputFormat => 'WGS84[DD.DDDDD]',
+ outputFormat => 'rapidJson',
+ };
+ }
+ else {
+ $self->{post} = {
+ language => 'de',
+ mode => 'direct',
+ outputFormat => 'JSON',
+ type_dm => $opt{type} // 'stop',
+ useProxFootSearch => $opt{proximity_search} ? '1' : '0',
+ useRealtime => '1',
+ itdDateDay => $dt->day,
+ itdDateMonth => $dt->month,
+ itdDateYear => $dt->year,
+ itdTimeHour => $dt->hour,
+ itdTimeMinute => $dt->minute,
+ name_dm => encode( 'UTF-8', $opt{name} ),
+ };
+ }
+
if ( $opt{place} ) {
$self->{post}{placeInfo_dm} = 'invalid';
$self->{post}{placeState_dm} = 'empty';