summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model/InTransit.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-06-15 22:03:36 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-06-15 22:03:36 +0200
commitd7fd521899f8e5ddd932d1ee9046f069b3187572 (patch)
tree10d81e8f3a65bbd0270ecb85d0b7b04bd546e657 /lib/Travelynx/Model/InTransit.pm
parent7466d252fb2a1ff6b0ecdce79f875579ad647516 (diff)
InTransit: allow setting data in add call
Diffstat (limited to 'lib/Travelynx/Model/InTransit.pm')
-rw-r--r--lib/Travelynx/Model/InTransit.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm
index 09f682f..6bafd93 100644
--- a/lib/Travelynx/Model/InTransit.pm
+++ b/lib/Travelynx/Model/InTransit.pm
@@ -98,6 +98,7 @@ sub add {
my $stop = $opt{stop};
my $checkin_station_id = $opt{departure_eva};
my $route = $opt{route};
+ my $data = $opt{data};
my $json = JSON->new;
@@ -126,7 +127,8 @@ sub add {
data => JSON->new->encode(
{
rt => $train->departure_has_realtime ? 1
- : 0
+ : 0,
+ %{ $data // {} }
}
),
backend_id => $backend_id,
@@ -183,7 +185,12 @@ sub add {
sched_departure => $stop->{sched_dep},
real_departure => $stop->{rt_dep} // $stop->{sched_dep},
route => $json->encode( \@route ),
- data => JSON->new->encode( { rt => $stop->{rt_dep} ? 1 : 0 } ),
+ data => JSON->new->encode(
+ {
+ rt => $stop->{rt_dep} ? 1 : 0,
+ %{ $data // {} }
+ }
+ ),
backend_id => $backend_id,
}
);