summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/HAFAS/Journey.pm18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm
index 978268e..696841e 100644
--- a/lib/Travel/Status/DE/HAFAS/Journey.pm
+++ b/lib/Travel/Status/DE/HAFAS/Journey.pm
@@ -17,7 +17,7 @@ Travel::Status::DE::HAFAS::Journey->mk_ro_accessors(
qw(datetime sched_datetime rt_datetime tz_offset
is_additional is_cancelled is_partially_cancelled
station station_eva platform sched_platform rt_platform operator
- product
+ product product_at
id name type type_long class number line line_no load delay
route_end route_start origin destination direction)
);
@@ -368,6 +368,16 @@ sub route_interesting {
}
+sub product_at {
+ my ( $self, $req_stop ) = @_;
+ for my $stop ( $self->route ) {
+ if ( $stop->loc->name eq $req_stop or $stop->loc->eva eq $req_stop ) {
+ return $stop->prod_dep // $stop->prod_arr;
+ }
+ }
+ return;
+}
+
sub TO_JSON {
my ($self) = @_;
@@ -530,6 +540,12 @@ of transport, line number / ID, operator, ...) associated with this journey.
Note that journeys may be associated with multiple products -- see also
C<< $journey->route >> and C<< $stop->product >>.
+=item $journey->product_at(I<stop>)
+
+Travel::Status::DE::HAFAS::Product(3pm) instance describing the product
+associated with I<stop> (name or EVA ID). Returns undef if product or I<stop>
+are unknown.
+
=item $journey->rt_platform (station only)
Actual arrival/departure platform.