diff options
Diffstat (limited to 'lib/WebService/TFL/TubeStatus')
-rw-r--r-- | lib/WebService/TFL/TubeStatus/Response.pm | 6 | ||||
-rw-r--r-- | lib/WebService/TFL/TubeStatus/Response/Line.pm | 10 | ||||
-rw-r--r-- | lib/WebService/TFL/TubeStatus/Response/LineStatus.pm | 7 | ||||
-rw-r--r-- | lib/WebService/TFL/TubeStatus/Types.pm | 11 |
4 files changed, 25 insertions, 9 deletions
diff --git a/lib/WebService/TFL/TubeStatus/Response.pm b/lib/WebService/TFL/TubeStatus/Response.pm index f8cd8bf..191abe7 100644 --- a/lib/WebService/TFL/TubeStatus/Response.pm +++ b/lib/WebService/TFL/TubeStatus/Response.pm @@ -1,11 +1,13 @@ package WebService::TFL::TubeStatus::Response; -use Moose; +use Moo; +use WebService::TFL::TubeStatus::Types -all; use WebService::TFL::TubeStatus::Response::Line; +use Types::Standard -all; use namespace::autoclean; has lines => ( is => 'ro', - isa => 'ArrayRef[WebService::TFL::TubeStatus::Response::Line]', + isa => ArrayRef[LineT], required => 1, ); diff --git a/lib/WebService/TFL/TubeStatus/Response/Line.pm b/lib/WebService/TFL/TubeStatus/Response/Line.pm index 11d3538..9779443 100644 --- a/lib/WebService/TFL/TubeStatus/Response/Line.pm +++ b/lib/WebService/TFL/TubeStatus/Response/Line.pm @@ -1,23 +1,25 @@ package WebService::TFL::TubeStatus::Response::Line; -use Moose; +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', + isa => Num, required => 1, ); has name => ( is => 'ro', - isa => 'Str', + isa => Str, required => 1, ); has status => ( is => 'ro', - isa => 'WebService::TFL::TubeStatus::Response::LineStatus', + isa => LineStatusT, required => 1, ); diff --git a/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm b/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm index e223bb6..6caa7d6 100644 --- a/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm +++ b/lib/WebService/TFL/TubeStatus/Response/LineStatus.pm @@ -1,16 +1,17 @@ package WebService::TFL::TubeStatus::Response::LineStatus; -use Moose; +use Moo; +use Types::Standard -all; use namespace::autoclean; has is_active => ( is => 'ro', - isa => 'Bool', + isa => Bool, required => 1, ); has [qw(code class description details)] => ( is => 'ro', - isa => 'Str', + isa => Str, required => 1, ); diff --git a/lib/WebService/TFL/TubeStatus/Types.pm b/lib/WebService/TFL/TubeStatus/Types.pm new file mode 100644 index 0000000..d1cb141 --- /dev/null +++ b/lib/WebService/TFL/TubeStatus/Types.pm @@ -0,0 +1,11 @@ +package WebService::TFL::TubeStatus::Types; +use strict; +use warnings; +use Type::Library -base, -declare => qw(LineT LineStatusT); +use Type::Utils -all; +use namespace::autoclean; + +class_type LineT, { class => 'WebService::TFL::TubeStatus::Response::Line' }; +class_type LineStatusT, { class => 'WebService::TFL::TubeStatus::Response::LineStatus' }; + +1; |