summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 09:24:00 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 09:24:00 +0100
commit11654b75cd48a0a96a7cecd24b0c10fe324bc687 (patch)
treeda275d48b2979695124c9a269b6d193afb50e637
parent95e64e06ac15bfd623663e16684f1529991b09c6 (diff)
HAFAS: Add service getters and setters
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm
index 12995c1..70914bb 100644
--- a/lib/Travel/Routing/DE/HAFAS.pm
+++ b/lib/Travel/Routing/DE/HAFAS.pm
@@ -608,4 +608,34 @@ sub connections {
return @{ $self->{results} };
}
+# static
+sub get_services {
+ my @services;
+ for my $service ( sort keys %hafas_instance ) {
+ my %desc = %{ $hafas_instance{$service} };
+ $desc{shortname} = $service;
+ push( @services, \%desc );
+ }
+ return @services;
+}
+
+# static
+sub get_service {
+ my ($service) = @_;
+
+ if ( defined $service and exists $hafas_instance{$service} ) {
+ return $hafas_instance{$service};
+ }
+ return;
+}
+
+sub get_active_service {
+ my ($self) = @_;
+
+ if ( defined $self->{active_service} ) {
+ return $hafas_instance{ $self->{active_service} };
+ }
+ return;
+}
+
# }}}