summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/DBRIS/Location.pm
blob: f053f2b6aef97a810c92b6c8ba95dfa65917cd00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Travel::Status::DE::DBRIS::Location;

use strict;
use warnings;
use 5.020;

use parent 'Class::Accessor';

our $VERSION = '0.01';

Travel::Status::DE::DBRIS::Location->mk_ro_accessors(
	qw(eva id lat lon name products type is_cancelled is_additional is_separation display_priority)
);

sub new {
	my ( $obj, %opt ) = @_;

	my $json = $opt{json};

	my $ref = {
		eva           => $json->{extId} // $json->{evaNumber},
		id            => $json->{id},
		lat           => $json->{lat},
		lon           => $json->{lon},
		name          => $json->{name},
		products      => $json->{products},
		type          => $json->{type},
		is_cancelled  => $json->{canceled},
		is_additional => $json->{additional},

	};

	bless( $ref, $obj );

	return $ref;
}

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

	my $ret = { %{$self} };

	return $ret;
}

1;