From 263f9611d0d3090c4b5a48cdb8c3d98ef90c209c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 24 May 2011 09:27:04 +0200 Subject: VRR.pm: Change new() key names --- lib/Net/Travel/DE/VRR.pm | 72 +++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 34 deletions(-) (limited to 'lib/Net/Travel/DE/VRR.pm') diff --git a/lib/Net/Travel/DE/VRR.pm b/lib/Net/Travel/DE/VRR.pm index 652bf15..cb4b5ec 100644 --- a/lib/Net/Travel/DE/VRR.pm +++ b/lib/Net/Travel/DE/VRR.pm @@ -16,13 +16,13 @@ sub post_time { my $time; - if ( $conf->{depart} ) { + if ( $conf->{departure_time} ) { $post->{itdTripDateTimeDepArr} = 'dep'; - $time = $conf->{depart} || $conf->{time}; + $time = $conf->{departure_time} || $conf->{time}; } else { $post->{itdTripDateTimeDepArr} = 'arr'; - $time = $conf->{arrive}; + $time = $conf->{arrival_time}; } if ( $time !~ / ^ [0-2]? \d : [0-5]? \d $ /x ) { @@ -85,11 +85,13 @@ sub post_prefer { my ( $post, $prefer ) = @_; given ($prefer) { - when ('speed') { $post->{routeType} = 'LEASTTIME' } - when ('nowait') { $post->{routeType} = 'LEASTINTERCHANGE' } - when ('nowalk') { $post->{routeType} = 'LEASTWALKING' } + when ('speed') { $post->{routeType} = 'LEASTTIME' } + when ('waittime') { $post->{routeType} = 'LEASTINTERCHANGE' } + when ('distance') { $post->{routeType} = 'LEASTWALKING' } default { - confess("prefer: Must be speed/nowait/nowalk: '${prefer}'"); + confess( +"select_interchange_by: Must be speed/waittime/distance: '${prefer}'" + ); } } @@ -104,7 +106,7 @@ sub post_include { when ('ic') { $post->{lineRestriction} = 401 } when ('ice') { $post->{lineRestriction} = 400 } default { - confess("include: Must be local/ic/ice: '${include}'"); + confess("train_type: Must be local/ic/ice: '${include}'"); } } @@ -233,13 +235,13 @@ sub create_post { useRealtime => 1 }; - post_place( $post, 'origin', @{ $conf->{from} } ); - post_place( $post, 'destination', @{ $conf->{to} } ); + post_place( $post, 'origin', @{ $conf->{origin} } ); + post_place( $post, 'destination', @{ $conf->{destination} } ); if ( $conf->{via} ) { post_place( $post, 'via', @{ $conf->{via} } ); } - if ( $conf->{arrive} || $conf->{depart} ) { + if ( $conf->{arrival_time} || $conf->{departure_time} ) { post_time( $post, $conf ); } if ( $conf->{date} ) { @@ -251,19 +253,19 @@ sub create_post { if ( $conf->{max_interchanges} ) { $post->{maxChanges} = $conf->{max_interchanges}; } - if ( $conf->{prefer} ) { - post_prefer( $post, $conf->{prefer} ); + if ( $conf->{select_interchange_by} ) { + post_prefer( $post, $conf->{select_interchange_by} ); } - if ( $conf->{proximity} ) { + if ( $conf->{use_near_stops} ) { $post->{useProxFootSearch} = 1; } - if ( $conf->{include} ) { - post_include( $post, $conf->{include} ); + if ( $conf->{train_type} ) { + post_include( $post, $conf->{train_type} ); } if ( $conf->{walk_speed} ) { post_walk_speed( $post, $conf->{walk_speed} ); } - if ( $conf->{bike} ) { + if ( $conf->{with_bike} ) { $post->{bikeTakeAlong} = 1; } @@ -535,28 +537,28 @@ Valid hash keys and their values are: =over -=item B => B<[> IB<,> I [ B<,> I ] B<]> +=item B => B<[> IB<,> I [ B<,> I ] B<]> -Mandatory. Sets the origin, which is the start of the journey. +Mandatory. Sets the start of the journey. I is optional and may be one of B (default), B
(street and house number) or B ("point of interest"). -=item B => B<[> IB<,> I [ B<,> I ] B<]> +=item B => B<[> IB<,> I [ B<,> I ] B<]> -Mandatory. Sets the destination, see B. +Mandatory. Sets the end of the journey, see B. =item B => B<[> IB<,> I [ B<,> I ] B<]> -Optional. Specifies a intermediate stop which the resulting itinerary must -contain. See B for arguments. +Optional. Specifies an intermediate stop which the resulting itinerary must +contain. See B for arguments. -=item B => I +=item B => I Sets the journey end time -=item B => I +=item B => I -Sets the journey start time +Sets the journey start time. Can not be used together with B =item B => I[I] @@ -564,7 +566,7 @@ Set journey date, in case it is not today =item B => \@exclude -Do not use certain transport types for itinerary. Acceptep arguments: +Do not use certain transport types for itinerary. Accepted arguments: zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus, schnellbus, seilbahn, schiff, ast, sonstige @@ -572,26 +574,28 @@ seilbahn, schiff, ast, sonstige Set maximum number of interchanges -=item B => B|B|B +=item B => B|B|B Prefer either fast connections (default), connections with low wait time or connections with little distance to walk -=item B => I +=item B => B<0>|B<1> + +If true: Try using near stops instead of the specified origin/destination ones -Try using near stops instead of the given start/stop one if I is true. +=item B => B|B|B -=item B => B|B|B +Include only local trains into itinarery (default), all but ICEs, or all. -Include only local trains into itinarery (default), or all but ICEs, or all. +The latter two are usually way more expensive for short routes. =item B => B|B|B Set walk speed. Default: B -=item B => I +=item B => B<0>|B<1> -If true: Prefer connections allowing to take a bike along +If true: Prefer connections allowing passengers with bikes =back -- cgit v1.2.3