summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/TubeStatus/Response/Line.pm
blob: f962418850a0c4206b2ea0e46e3108064f99c705 (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
package WebService::TFL::TubeStatus::Response::Line; 
use Moo;
use Types::Standard -all;
use WebService::TFL::TubeStatus::Response::LineStatus;
use namespace::clean;
 
has id => (
    is => 'ro',
    isa => Str,
    required => 1,
);
 
has name => (
    is => 'ro',
    isa => Str,
    required => 1,
);
 
has status => (
    is => 'ro',
    isa => InstanceOf['WebService::TFL::TubeStatus::Response::LineStatus'],
    required => 1,
);
 
sub new_from_response {
    my ($class,$response_data) = @_;
 
    return $class->new({
        id => $response_data->{id},
        name => $response_data->{name},
        status => WebService::TFL::TubeStatus::Response::LineStatus->new_from_response(
            $response_data->{lineStatuses}[0],
        ),
    });
}
 
1;