diff options
author | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2013-05-30 08:00:41 +0100 |
---|---|---|
committer | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2013-05-30 08:00:41 +0100 |
commit | c099b757579129a454739f6e13fc4c5fea4e062e (patch) | |
tree | a9481943b4a6305e931eceb5746467c6546f549e /lib/WebService/TFL/TubeStatus/Response/Line.pm | |
parent | return json response (diff) | |
download | HomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.tar.gz HomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.tar.bz2 HomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.zip |
tube status
Diffstat (limited to 'lib/WebService/TFL/TubeStatus/Response/Line.pm')
-rw-r--r-- | lib/WebService/TFL/TubeStatus/Response/Line.pm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/WebService/TFL/TubeStatus/Response/Line.pm b/lib/WebService/TFL/TubeStatus/Response/Line.pm new file mode 100644 index 0000000..11d3538 --- /dev/null +++ b/lib/WebService/TFL/TubeStatus/Response/Line.pm @@ -0,0 +1,36 @@ +package WebService::TFL::TubeStatus::Response::Line; +use Moose; +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 => 'WebService::TFL::TubeStatus::Response::LineStatus', + 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; |