summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm
blob: 6caa7d654a163cb532ed07f0da46898b520d8415 (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
package WebService::TFL::TubeStatus::Response::LineStatus; 
use Moo;
use Types::Standard -all;
use namespace::autoclean;
 
has is_active => (
    is => 'ro',
    isa => Bool,
    required => 1,
);
 
has [qw(code class description details)] => (
    is => 'ro',
    isa => Str,
    required => 1,
);
 
sub new_from_xml {
    my ($class,$ls,$xpath) = @_;
 
    my %init_arg;
 
    my ($status) = $xpath->findnodes(q{ws:Status},$ls);
    $init_arg{code} = $status->findvalue(q{@ID});
    $init_arg{is_active} = $status->findvalue(q{@IsActive}eq 'true';
    $init_arg{class} = $status->findvalue(q{@CssClass});
    $init_arg{description} = $status->findvalue(q{@Description});
    $init_arg{details} = $ls->findvalue(q{@StatusDetails});
 
    return $class->new(\%init_arg);
}
 
1;