diff options
author | dakkar <dakkar@thenautilus.net> | 2013-05-16 22:06:09 +0100 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2013-05-16 22:06:09 +0100 |
commit | 9b724c2c7edc3c2805516fea7f584cdf0031d8ca (patch) | |
tree | 549dac74b5f47a0b7810b990007829e48252d925 /lib/WebService/ForecastIo/Alert.pm | |
parent | "time" support (diff) | |
download | HomePanel-9b724c2c7edc3c2805516fea7f584cdf0031d8ca.tar.gz HomePanel-9b724c2c7edc3c2805516fea7f584cdf0031d8ca.tar.bz2 HomePanel-9b724c2c7edc3c2805516fea7f584cdf0031d8ca.zip |
modules for all response blocks
Diffstat (limited to 'lib/WebService/ForecastIo/Alert.pm')
-rw-r--r-- | lib/WebService/ForecastIo/Alert.pm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/WebService/ForecastIo/Alert.pm b/lib/WebService/ForecastIo/Alert.pm new file mode 100644 index 0000000..37ff4ac --- /dev/null +++ b/lib/WebService/ForecastIo/Alert.pm @@ -0,0 +1,36 @@ +package WebService::ForecastIo::Alert; +use Moose; +use Moose::Util::TypeConstraints; +use MooseX::Types::URI 'Uri'; + +class_type 'WebService::ForecastIo::Alert'; + +subtype 'WebService::ForecastIo::AlertArray', + as 'ArrayRef[WebService::ForecastIo::Alert]'; + +coerce 'WebService::ForecastIo::Alert', from 'HashRef', + via { WebService::ForecastIo::Alert->new($_) }; + +coerce 'WebService::ForecastIo::AlertArray', from 'ArrayRef[HashRef]', + via { + my $array = $_; + [ map { WebService::ForecastIo::Alert->new($_) } + @$array ] + }; + +has title => ( + is => 'ro', + isa => 'Str', +); + +has expires => ( + is => 'ro', + isa => 'Int', # time! +); + +has uri => ( + is => 'ro', + isa => Uri, +); + +1; |