summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-02-02 21:42:03 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-02-02 21:42:03 +0100
commitd5f28814ba5401d964a361b9c071f5319ff76f7b (patch)
tree23d36f9889c25d97280ec2d140bb1ebf938e8dac /lib/Travel/Status
parent6026830d29131c8d563da66e73aca37a240b4a00 (diff)
HAFAS: Add similar_stops_p function
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 3fa8e39..4339da8 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -659,6 +659,25 @@ sub similar_stops {
return;
}
+sub similar_stops_p {
+ my ( $self, %opt ) = @_;
+
+ my $service = $self->{active_service};
+
+ if ( $service and exists $hafas_instance{$service}{stopfinder} ) {
+ $opt{user_agent} //= $self->{ua};
+ return Travel::Status::DE::HAFAS::StopFinder->new_p(
+ url => $hafas_instance{$service}{stopfinder},
+ input => $self->{station},
+ ua => $opt{user_agent},
+ developer_mode => $self->{developer_mode},
+ promise => $opt{promise},
+ );
+ }
+ return $opt{promise}
+ ->reject("stopfinder not available for backend '$service'");
+}
+
sub station {
my ($self) = @_;
@@ -877,7 +896,7 @@ Only relevant in journey mode.
=back
-=item my $status = Travel::Status::DE::HAFAS->new_p(I<%opt>)
+=item my $status_p = Travel::Status::DE::HAFAS->new_p(I<%opt>)
Return a promise that resolves into a Travel::Status::DE::HAFAS instance
($status) on success and rejects with an error message ($status->errstr) on