Unverified Commit 321917e2 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

JourneyAtStop->via: return list (not listref); exclude request stop

parent 893ee14e
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ use parent 'Class::Accessor';
our $VERSION = '0.05';

Travel::Status::DE::DBRIS::JourneyAtStop->mk_ro_accessors(
	qw(type dep sched_dep rt_dep delay is_cancelled line stop_eva id platform rt_platform destination via via_last
	qw(type dep sched_dep rt_dep delay is_cancelled line stop_eva id platform rt_platform destination via_last
	  train_short train_mid train_long train maybe_train_no maybe_line_no
	)
);
@@ -36,6 +36,10 @@ sub new {
		via_last    => ( $json->{ueber} // [] )->[-1],
	};

	if ( $ref->{via} and @{ $ref->{via} } ) {
		shift( @{ $ref->{via} } );
	}

	$ref->{maybe_train_no} = $ref->{train}     =~ s{^.* ++}{}r;
	$ref->{maybe_line_no}  = $ref->{train_mid} =~ s{^.* ++}{}r;

@@ -70,6 +74,12 @@ sub messages {
	return @{ $self->{messages} // [] };
}

sub via {
	my ($self) = @_;

	return @{ $self->{via} // [] };
}

sub TO_JSON {
	my ($self) = @_;