diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-26 14:05:22 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-12-26 14:05:22 +0100 |
commit | d7e1912692d8af33dc19d9323aa83d9a2fce33b6 (patch) | |
tree | 0ab64784677490f2b7065a9b10151e04c3e4a72e /lib/Travel | |
parent | 7caeab689baf8390e12915264838c1a0da73e2ef (diff) |
Remove no-longer-used Stop module
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Stop.pm | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Stop.pm b/lib/Travel/Status/DE/DBRIS/Stop.pm deleted file mode 100644 index d717ec4..0000000 --- a/lib/Travel/Status/DE/DBRIS/Stop.pm +++ /dev/null @@ -1,87 +0,0 @@ -package Travel::Status::DE::DBRIS::Stop; - -use strict; -use warnings; -use 5.020; - -use parent 'Class::Accessor'; - -our $VERSION = '0.01'; - -Travel::Status::DE::DBRIS::Stop->mk_ro_accessors( - qw(type dep sched_dep rt_dep delay is_cancelled line stop_eva id platform rt_platform destination via via_last) -); - -sub new { - my ( $obj, %opt ) = @_; - - my $json = $opt{json}; - my $strptime = $opt{strptime_obj}; - - my $ref = { - type => $json->{verkehrmittel}{kurzText}, - line => $json->{verkehrmittel}{mittelText}, - id => $json->{journeyId}, - stop_eva => $json->{bahnhofsId}, - destination => $json->{terminus}, - platform => $json->{gleis}, - rt_platform => $json->{ezGleis}, - via => $json->{ueber}, - via_last => ( $json->{ueber} // [] )->[-1], - }; - - bless( $ref, $obj ); - - if ( $json->{zeit} ) { - $ref->{sched_dep} = $strptime->parse_datetime( $json->{zeit} ); - } - if ( $json->{ezZeit} ) { - $ref->{rt_dep} = $strptime->parse_datetime( $json->{ezZeit} ); - } - $ref->{dep} = $ref->{rt_dep} // $ref->{sched_dep}; - - if ( $ref->{sched_dep} and $ref->{rt_dep} ) { - $ref->{delay} = $ref->{rt_dep}->subtract_datetime( $ref->{sched_dep} ) - ->in_units('minutes'); - } - - for my $message ( @{ $json->{meldungen} // [] } ) { - if ( $message->{type} and $message->{type} eq 'HALT_AUSFALL' ) { - $ref->{is_cancelled} = 1; - } - push( @{ $ref->{messages} }, $message ); - } - - return $ref; -} - -sub route { - my ($self) = @_; - - if ( $self->{route} ) { - return @{ $self->{route} }; - } - - @{ $self->{route} } - = map { Travel::Status::DE::DBRIS::Location->new( json => $_ ) } - ( @{ $self->{raw_route} // [] }, - @{ $self->{raw_cancelled_route} // [] } ); - - return @{ $self->{route} }; -} - -sub messages { - my ($self) = @_; - - return @{ $self->{messages} // [] }; -} - -sub TO_JSON { - my ($self) = @_; - - my $ret = { %{$self} }; - - return $ret; -} - -1; |