From dee4a30587aee04779cea8cab01b4c579a4e9c84 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 9 Apr 2016 17:29:18 +0200 Subject: Do not request stops by default --- Changelog | 2 +- lib/Travel/Status/DE/URA.pm | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Changelog b/Changelog index 0a982fe..dd5e436 100644 --- a/Changelog +++ b/Changelog @@ -1,7 +1,7 @@ git HEAD * URA->results: Add via_id, stop_id and line_id parameters - * URA->new: Add circle parameter + * URA->new: Add circle and with_stops parameters * URA: Add get_stops accessor Travel::Status::DE::URA 1.00 - Sat Oct 31 2015 diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index 0b35225..8157782 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -54,9 +54,6 @@ sub new { circle => $opt{circle}, post => { - # show all stops - StopAlso => 'True', - # for easier debugging ordered in the returned order ReturnList => 'stoppointname,stopid,latitude,longitude,lineid,' . 'linename,directionid,destinationtext,vehicleid,tripid,' @@ -64,6 +61,10 @@ sub new { }, }; + if ( $opt{with_stops} ) { + $self->{post}{StopAlso} = 'True'; + } + $self->{ura_instant_url} = $self->{ura_base} . '/instant_V' . $self->{ura_version}; @@ -202,7 +203,6 @@ sub results { my $via = $opt{via} // $self->{via}; my $via_id = $opt{via_id} // $self->{via_id}; - my $dt_now = $self->{datetime}; my $ts_now = $dt_now->epoch; @@ -413,6 +413,12 @@ Only request departures for stops which are located up to I meters away from the location specified by I and I. Example parameter: "50.78496,6.10897,100". +=item B => B<0>|B<1> + +When set to B<1> (or any other true value): Also request all stops satisfying +the specified parameters. They can be accessed with B. Defaults to +B<0>. + =back Additionally, all options supported by C<< $status->results >> may be specified @@ -438,6 +444,9 @@ Returns a hash reference describing all distinct stops returned by the request. Each key is the unique ID of a stop and contains a Travel::Status::DE::URA::Stop(3pm) object describing it. +Only works when $status was created with B set to a true value. +Otherwise, undef is returned. + =item $status->results(I<%opt>) Returns a list of Travel::Status::DE::URA::Result(3pm) objects, each describing -- cgit v1.2.3