summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog2
-rw-r--r--lib/Travel/Status/DE/URA.pm17
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<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