diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-04-09 17:29:18 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-04-09 17:29:18 +0200 |
commit | dee4a30587aee04779cea8cab01b4c579a4e9c84 (patch) | |
tree | 60463bd6970a2e9cfe33ad7dd8c5f4a4a793ef56 /lib | |
parent | c0b528dd45c5baaa7c797c0fe263b6f0164f8510 (diff) |
Do not request stops by default
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/URA.pm | 17 |
1 files changed, 13 insertions, 4 deletions
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<dist> meters away from the location specified by I<lon> and I<lat>. Example parameter: "50.78496,6.10897,100". +=item B<with_stops> => 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<get_stops>. 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<with_stops> 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 |