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/DataPoint.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/DataPoint.pm')
-rw-r--r-- | lib/WebService/ForecastIo/DataPoint.pm | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/lib/WebService/ForecastIo/DataPoint.pm b/lib/WebService/ForecastIo/DataPoint.pm index ba06fa1..47ef659 100644 --- a/lib/WebService/ForecastIo/DataPoint.pm +++ b/lib/WebService/ForecastIo/DataPoint.pm @@ -1,35 +1,21 @@ package WebService::ForecastIo::DataPoint; -use Moose; -use Moose::Util::TypeConstraints; -use MooseX::Types::DateTime; - -class_type 'WebService::ForecastIo::DataPoint'; - -subtype 'WebService::ForecastIo::DataPointArray', - as 'ArrayRef[WebService::ForecastIo::DataPoint]'; - -coerce 'WebService::ForecastIo::DataPoint', from 'HashRef', - via { WebService::ForecastIo::DataPoint->new($_) }; - -coerce 'WebService::ForecastIo::DataPointArray', from 'ArrayRef[HashRef]', - via { - my $array = $_; - [ map { WebService::ForecastIo::DataPoint->new($_) } - @$array ] - }; +use Moo; +use namespace::autoclean; +use Types::DateTime 'DateTimeT'; +use Types::Standard -all; has [qw( time sunriseTime sunsetTime precipIntensityMaxTime temperatureMinTime temperatureMaxTime )] => ( is => 'ro', - isa => 'DateTime', - coerce => 1, + isa => DateTimeT, + coerce => DateTimeT->coercion, ); has [qw(summary icon precipType)] => ( is => 'ro', - isa => 'Str', + isa => Str, ); has [qw( precipIntensity precipIntensityMax @@ -40,7 +26,7 @@ has [qw( precipIntensity precipIntensityMax cloudCover pressure visibility ozone )] => ( is => 'ro', - isa => 'Num', + isa => Num, ); 1; |