summaryrefslogtreecommitdiff
path: root/lib/WebService/TFL/TubeStatus/Response.pm
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2013-05-30 08:00:41 +0100
committerGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2013-05-30 08:00:41 +0100
commitc099b757579129a454739f6e13fc4c5fea4e062e (patch)
treea9481943b4a6305e931eceb5746467c6546f549e /lib/WebService/TFL/TubeStatus/Response.pm
parentreturn json response (diff)
downloadHomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.tar.gz
HomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.tar.bz2
HomePanel-c099b757579129a454739f6e13fc4c5fea4e062e.zip
tube status
Diffstat (limited to 'lib/WebService/TFL/TubeStatus/Response.pm')
-rw-r--r--lib/WebService/TFL/TubeStatus/Response.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/WebService/TFL/TubeStatus/Response.pm b/lib/WebService/TFL/TubeStatus/Response.pm
new file mode 100644
index 0000000..f8cd8bf
--- /dev/null
+++ b/lib/WebService/TFL/TubeStatus/Response.pm
@@ -0,0 +1,28 @@
+package WebService::TFL::TubeStatus::Response;
+use Moose;
+use WebService::TFL::TubeStatus::Response::Line;
+use namespace::autoclean;
+
+has lines => (
+ is => 'ro',
+ isa => 'ArrayRef[WebService::TFL::TubeStatus::Response::Line]',
+ required => 1,
+);
+
+sub new_from_xml {
+ my ($class,$doc,$xpath) = @_;
+
+ my @lines;
+
+ for my $ls ($xpath->findnodes(q{/ws:ArrayOfLineStatus/ws:LineStatus},$doc)) {
+ my ($line)=$xpath->findnodes(q{ws:Line},$ls);
+
+ my $line_object = WebService::TFL::TubeStatus::Response::Line->new_from_xml($line,$ls,$xpath);
+
+ push @lines,$line_object;
+ }
+
+ return $class->new({lines=>\@lines});
+}
+
+1;