summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-10 08:22:02 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-10 08:22:02 +0100
commitef1ace49d1ac93f198172752e182d6e00a56910f (patch)
tree3ed37e2ddad3c4fb766e5481edf26c59b2910ad1 /lib/Travel/Status/DE/IRIS.pm
parente09d537040b29ae318d859d84d6ec7036439b0de (diff)
IRIS.pm: make iris_base URL configurable
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index e496f88..e20d758 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -28,6 +28,8 @@ sub new {
my $self = {
datetime => $opt{datetime}
// DateTime->now( time_zone => 'Europe/Berlin' ),
+ iris_base => $opt{iris_base}
+ // 'http://iris.noncd.db.de/iris-tts/timetable',
station => $opt{station},
user_agent => $ua,
};
@@ -36,8 +38,7 @@ sub new {
$ua->env_proxy;
- my $res_st = $ua->get(
- 'http://iris.noncd.db.de/iris-tts/timetable/station/' . $opt{station} );
+ my $res_st = $ua->get( $self->{iris_base} . '/station/' . $opt{station} );
if ( $res_st->is_error ) {
$self->{errstr} = $res_st->status_line;
@@ -123,9 +124,7 @@ sub get_timetable {
my $ua = $self->{user_agent};
my $res = $ua->get(
- $dt->strftime(
- "http://iris.noncd.db.de/iris-tts/timetable/plan/${eva}/%y%m%d/%H")
- );
+ $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) );
if ( $res->is_error ) {
$self->{errstr} = $res->status_line;
@@ -150,8 +149,7 @@ sub get_realtime {
my ($self) = @_;
my $eva = $self->{nodes}{station}->getAttribute('eva');
- my $res = $self->{user_agent}
- ->get("http://iris.noncd.db.de/iris-tts/timetable/fchg/${eva}");
+ my $res = $self->{user_agent}->get( $self->{iris_base} . "/fchg/${eva}" );
if ( $res->is_error ) {
$self->{errstr} = $res->status_line;
@@ -292,6 +290,10 @@ Arguments:
A DateTime(3pm) object specifying the point in time. Optional, defaults to the
current date and time.
+=item B<iris_base> => I<url>
+
+IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>.
+
=item B<station> => I<stationcode>
Mandatory: Which station to return departures for. Note that this is not a