summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 09:13:20 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-11 09:13:20 +0100
commit3502cc6fd19985fe75106dc24c16e988c3ae4c5f (patch)
treefc1ff9c6fdee9ae31f07171261e1f651cf1ad0c0
parent18aef465772d6a8e6220275412b97faff7076f65 (diff)
add_message: pass JSON to Message constructor
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm19
1 files changed, 5 insertions, 14 deletions
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm
index a0fcc51..12995c1 100644
--- a/lib/Travel/Routing/DE/HAFAS.pm
+++ b/lib/Travel/Routing/DE/HAFAS.pm
@@ -555,16 +555,12 @@ sub parse_trips {
sub add_message {
my ( $self, $json, $is_him ) = @_;
- my $short = $json->{txtS};
- my $text = $json->{txtN};
- my $type = $json->{type};
- my $code = $json->{code};
- my $prio = $json->{prio};
+ my $text = $json->{txtN};
+ my $code = $json->{code};
if ($is_him) {
- $short = $json->{head};
- $text = $json->{text};
- $code = $json->{hid};
+ $text = $json->{text};
+ $code = $json->{hid};
}
# Some backends use remL for operator information. We don't want that.
@@ -580,12 +576,7 @@ sub add_message {
}
my $message = Travel::Status::DE::HAFAS::Message->new(
- short => $short,
- text => $text,
- type => $type,
- code => $code,
- prio => $prio,
- is_him => $is_him,
+ json => $json,
ref_count => 1,
);
push( @{ $self->{messages} }, $message );