blob: 1b5dd30c0002da58f6e2733f913f15f8f12e4ff6 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
package Travel::Status::MOTIS::Stop;
use strict;
use warnings;
use 5.020;
use parent 'Class::Accessor';
our $VERSION = '0.03';
Travel::Status::MOTIS::Stop->mk_ro_accessors(
qw(
id
name
type
lat
lon
)
);
sub from_match {
my ( $obj, %opt ) = @_;
my $json = $opt{json};
my $ref = {
id => $json->{id},
name => $json->{name},
lat => $json->{lat},
lon => $json->{lon},
};
bless( $ref, $obj );
return $ref;
}
sub from_stopover {
my ( $obj, %opt ) = @_;
my $json = $opt{json};
my $ref = {
id => $json->{stopId},
name => $json->{name},
lat => $json->{lat},
lon => $json->{lon},
};
bless( $ref, $obj );
return $ref;
}
sub TO_JSON {
my ($self) = @_;
return { %{$self} };
}
1;
|