summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Helper/HAFAS.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-11-09 18:14:07 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-11-09 18:14:07 +0100
commitc26c8820f296de41ce7093416b584cfdb6b657fa (patch)
treee00798de3b1966840cc6d82736fe8d13abe2b0bb /lib/Travelynx/Helper/HAFAS.pm
parentfc05987b14924e51c37092876e7c156b748b457b (diff)
Switch to internal HAFAS client for connection details
Diffstat (limited to 'lib/Travelynx/Helper/HAFAS.pm')
-rw-r--r--lib/Travelynx/Helper/HAFAS.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Travelynx/Helper/HAFAS.pm b/lib/Travelynx/Helper/HAFAS.pm
index 7b42384..a8fbbfb 100644
--- a/lib/Travelynx/Helper/HAFAS.pm
+++ b/lib/Travelynx/Helper/HAFAS.pm
@@ -83,6 +83,22 @@ sub get_json_p {
return $promise;
}
+sub get_departures_p {
+ my ( $self, %opt ) = @_;
+
+ my $when = DateTime->now( time_zone => 'Europe/Berlin' )
+ ->subtract( minutes => $opt{lookbehind} );
+ return Travel::Status::DE::HAFAS->new_p(
+ station => $opt{eva},
+ datetime => $when,
+ duration => $opt{lookahead},
+ results => 120,
+ cache => $self->{realtime_cache},
+ promise => 'Mojo::Promise',
+ user_agent => $self->{user_agent}->request_timeout(5),
+ );
+}
+
sub get_route_timestamps_p {
my ( $self, %opt ) = @_;