diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-26 20:15:14 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-04-26 20:15:14 +0200 |
commit | 9b514055b03ef9db4be1b006195301dd8e289c1b (patch) | |
tree | eb34bcb8541a05cd15cc9eed6db9ae701d6fb8d1 /lib | |
parent | 37801cdef7df8dd246f8dc56b0c8aef2d68eeeae (diff) |
Add TO_JSON function
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Travel/Status/DE/DBWagenreihung.pm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/DBWagenreihung.pm b/lib/Travel/Status/DE/DBWagenreihung.pm index dc120af..5e612dd 100644 --- a/lib/Travel/Status/DE/DBWagenreihung.pm +++ b/lib/Travel/Status/DE/DBWagenreihung.pm @@ -183,6 +183,25 @@ sub errstr { return $self->{errstr}; } +sub TO_JSON { + my ($self) = @_; + + # ensure that all objects are available + $self->direction; + $self->origins; + $self->destinations; + $self->train_numbers; + $self->train_descriptions; + $self->wagons; + $self->{platform} = $self->platform; + + my %copy = %{$self}; + + delete $copy{from_json}; + + return {%copy}; +} + sub direction { my ($self) = @_; |