summaryrefslogtreecommitdiff
path: root/lib/Travel/Routing/DE/EFA/Route
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Routing/DE/EFA/Route')
-rw-r--r--lib/Travel/Routing/DE/EFA/Route/Message.pm6
-rw-r--r--lib/Travel/Routing/DE/EFA/Route/Part.pm51
2 files changed, 44 insertions, 13 deletions
diff --git a/lib/Travel/Routing/DE/EFA/Route/Message.pm b/lib/Travel/Routing/DE/EFA/Route/Message.pm
index ffa707c..6ae2e19 100644
--- a/lib/Travel/Routing/DE/EFA/Route/Message.pm
+++ b/lib/Travel/Routing/DE/EFA/Route/Message.pm
@@ -6,7 +6,7 @@ use 5.010;
use parent 'Class::Accessor';
-our $VERSION = '2.19';
+our $VERSION = '2.24';
Travel::Routing::DE::EFA::Route::Message->mk_ro_accessors(
qw(is_detailed summary subject subtitle raw_content));
@@ -58,7 +58,7 @@ route or route part.
=head1 VERSION
-version 2.19
+version 2.24
=head1 DESCRIPTION
@@ -129,7 +129,7 @@ Travel::Routing::DE::EFA(3pm), Travel::Routing::DE::EFA::Route::Part(3pm).
=head1 AUTHOR
-Copyright (C) 2015 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>
+Copyright (C) 2015 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
=head1 LICENSE
diff --git a/lib/Travel/Routing/DE/EFA/Route/Part.pm b/lib/Travel/Routing/DE/EFA/Route/Part.pm
index 3a15fc3..7ed2722 100644
--- a/lib/Travel/Routing/DE/EFA/Route/Part.pm
+++ b/lib/Travel/Routing/DE/EFA/Route/Part.pm
@@ -6,17 +6,25 @@ use 5.010;
use parent 'Class::Accessor';
-our $VERSION = '2.19';
+our $VERSION = '2.24';
+
+my %occupancy = (
+ MANY_SEATS => 1,
+ FEW_SEATS => 2,
+ STANDING_ONLY => 3
+);
Travel::Routing::DE::EFA::Route::Part->mk_ro_accessors(
qw(arrival_platform arrival_stop
- arrival_date arrival_time arrival_sdate arrival_stime delay
- departure_platform
+ arrival_date arrival_time arrival_sdate arrival_stime arrival_delay
+ delay
+ departure_platform departure_delay
departure_stop departure_date departure_time departure_sdate
departure_stime
footpath_duration footpath_type
+ occupancy
train_destination train_line train_product
- )
+ )
);
sub new {
@@ -24,6 +32,15 @@ sub new {
my $ref = \%conf;
+ if ( $ref->{occupancy} and exists $occupancy{ $ref->{occupancy} } ) {
+ $ref->{occupancy} = $occupancy{ $ref->{occupancy} };
+ }
+ else {
+ delete $ref->{occupancy};
+ }
+
+ $ref->{delay} = $ref->{departure_delay};
+
return bless( $ref, $obj );
}
@@ -154,7 +171,7 @@ points, without interchanges
=head1 VERSION
-version 2.19
+version 2.24
=head1 DESCRIPTION
@@ -174,6 +191,10 @@ included in the calculation, "Scheduled" means it isn't.
=over
+=item $part->arrival_delay
+
+arrival delay in minutes, 0 if unknown
+
=item $part->arrival_stop
arrival stop (city name plus station name)
@@ -223,7 +244,11 @@ Returns a list of Travel::Routing::DE::EFA::Route::Message(3pm) objects.
=item $part->delay
-delay in minutes, 0 if unknown
+alias for departure_delay
+
+=item $part->departure_delay
+
+departure delay in minutes, 0 if unknown
=item $part->departure_stop
@@ -302,6 +327,11 @@ Returns true if this part of the route has been cancelled (i.e., the entire
route is probably useless), false otherwise. For unknown reasons, EFA may
sometimes return routes which contain cancelled departures.
+=item $part->occupancy
+
+Returns expected occupancy, if available. Values range from 1 (low occupancy)
+to 3 (very high occupancy).
+
=item $part->regular_notes
Remarks about the line serving this connaction part. Returns a list of
@@ -325,9 +355,10 @@ In those cases, B<train_destination> and B<train_line> are usually empty.
=item $part->via
-Returns a list of C<< [ "DD.MM.YYYY", "HH:MM", stop, platform ] >> arrayrefs
-encoding the stops passed between B<departure_stop> and B<arrival_stop>,
-if supported by the backend. Returns nothing / an empty list otherwise.
+Returns a list of C<< [ "DD.MM.YYYY", "HH:MM", stop, platform, delay ] >>
+arrayrefs encoding the stops passed between B<departure_stop> and
+B<arrival_stop>, if supported by the backend. Returns nothing / an empty list
+otherwise. Date and time refer to schedule data and do not account for delays.
=back
@@ -354,7 +385,7 @@ Class::Accessor(3pm).
=head1 AUTHOR
-Copyright (C) 2011-2017 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>
+Copyright (C) 2011-2021 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
=head1 LICENSE