diff options
author | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2013-11-07 11:32:13 +0000 |
---|---|---|
committer | Gianni Ceccarelli <gianni.ceccarelli@net-a-porter.com> | 2013-11-07 12:06:25 +0000 |
commit | 022152630a9084fbc604f0d06b0005d97747b50d (patch) | |
tree | 8fa95f6ee8c70615a140519b93671a3e11376249 /lib/WebService/ForecastIo/Alert.pm | |
parent | exclude "sources" in forecast call (diff) | |
download | HomePanel-022152630a9084fbc604f0d06b0005d97747b50d.tar.gz HomePanel-022152630a9084fbc604f0d06b0005d97747b50d.tar.bz2 HomePanel-022152630a9084fbc604f0d06b0005d97747b50d.zip |
migrate to Moo: forecast client
Diffstat (limited to 'lib/WebService/ForecastIo/Alert.pm')
-rw-r--r-- | lib/WebService/ForecastIo/Alert.pm | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/lib/WebService/ForecastIo/Alert.pm b/lib/WebService/ForecastIo/Alert.pm index d402fa2..af826d8 100644 --- a/lib/WebService/ForecastIo/Alert.pm +++ b/lib/WebService/ForecastIo/Alert.pm @@ -1,38 +1,25 @@ package WebService::ForecastIo::Alert; -use Moose; -use Moose::Util::TypeConstraints; -use MooseX::Types::URI 'Uri'; -use MooseX::Types::DateTime; - -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 ] - }; +use Moo; +use namespace::autoclean; +use Types::Standard -all; +use Types::URI 'Uri'; +use Types::DateTime 'DateTimeT'; has title => ( is => 'ro', - isa => 'Str', + isa => Str, ); has expires => ( is => 'ro', - isa => 'DateTime', - coerce => 1, + isa => DateTimeT, + coerce => DateTimeT->coercion, ); has uri => ( is => 'ro', isa => Uri, + coerce => Uri->coercion, ); 1; |