summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm
blob: 69ddf2080013b0551dc00e331633fb64b23ab055 (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
package WebService::TFL::TubeStatus::Response::LineStatus; 
use Moo;
use Types::Standard -all;
use namespace::clean;
 
has [qw(statusSeverity statusSeverityDescription)] => (
    is => 'ro',
    isa => Str,
    required => 1,
);
 
has reason => (
    is => 'ro',
    isa => Str,
);
 
sub new_from_response {
    my ($class,$response_data) = @_;
 
    $response_data->{reason} =~ s{\A .+? : \s*}{}x
        if $response_data->{reason};
 
    return $class->new($response_data);
}
 
1;