summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/TubeStatus/Response/Line.pm
blob: 977944371b0f9a4ef62b621b177d354280624163 (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
package WebService::TFL::TubeStatus::Response::Line; 
use Moo;
use Types::Standard -all;
use WebService::TFL::TubeStatus::Types -all;
use WebService::TFL::TubeStatus::Response::LineStatus;
use namespace::autoclean;
 
has id => (
    is => 'ro',
    isa => Num,
    required => 1,
);
 
has name => (
    is => 'ro',
    isa => Str,
    required => 1,
);
 
has status => (
    is => 'ro',
    isa => LineStatusT,
    required => 1,
);
 
sub new_from_xml {
    my ($class,$line,$status,$xpath) = @_;
 
    my %init_arg;
 
    $init_arg{id} = $line->findvalue(q{@ID});
    $init_arg{name} = $line->findvalue(q{@Name});
    $init_arg{status} = WebService::TFL::TubeStatus::Response::LineStatus->new_from_xml($status,$xpath);
 
    return $class->new(\%init_arg);
}
 
1;