diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-11-10 16:56:04 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-11-10 16:56:04 +0100 |
commit | 0e1bb3d63c4eb448f4cc458f53096135e376bd51 (patch) | |
tree | 3b191459c9942d2d00ee9617f25df553c02725a2 /lib/Travel/Status/DE/IRIS.pm | |
parent | bc441c22c339c2b120c531aef344544cef76fb7d (diff) |
add accessors for whole (related) station data set
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r-- | lib/Travel/Status/DE/IRIS.pm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 6b73939..fd0978c 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -35,7 +35,6 @@ sub new { // 'http://iris.noncd.db.de/iris-tts/timetable', lookahead => $opt{lookahead} // ( 4 * 60 ), serializable => $opt{serializable}, - station => $opt{station}, user_agent => $ua, with_related => $opt{with_related}, }; @@ -50,8 +49,8 @@ sub new { recursive => $opt{with_related}, ); - $self->{station_code} = $station->{uic}; - $self->{station_name} = $station->{name}; + $self->{station} = $station; + $self->{related_stations} = \@related_stations; for my $ref (@related_stations) { my $ref_status = Travel::Status::DE::IRIS->new( @@ -72,7 +71,7 @@ sub new { my $dt_req = $self->{datetime}->clone; for ( 1 .. 3 ) { - $self->get_timetable( $self->{station_code}, $dt_req ); + $self->get_timetable( $self->{station}{uic}, $dt_req ); $dt_req->add( hours => 1 ); } @@ -283,7 +282,7 @@ sub get_timetable { sub get_realtime { my ($self) = @_; - my $eva = $self->{station_code}; + my $eva = $self->{station}{uic}; my $res = $self->{user_agent}->get( $self->{iris_base} . "/fchg/${eva}" ); if ( $self->{developer_mode} ) { @@ -438,10 +437,16 @@ sub create_replacement_refs { } } -sub station_code { +sub station { my ($self) = @_; - return $self->{station_code}; + return $self->{station}; +} + +sub related_stations { + my ($self) = @_; + + return @{ $self->{related_stations} }; } sub errstr { |