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/DataPoint.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/DataPoint.pm')
-rw-r--r-- | lib/WebService/ForecastIo/DataPoint.pm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/WebService/ForecastIo/DataPoint.pm b/lib/WebService/ForecastIo/DataPoint.pm new file mode 100644 index 0000000..c05e981 --- /dev/null +++ b/lib/WebService/ForecastIo/DataPoint.pm @@ -0,0 +1,44 @@ +package WebService::ForecastIo::DataPoint; +use Moose; +use Moose::Util::TypeConstraints; + +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 ] + }; + +has [qw( time + sunriseTime sunsetTime + precipIntensityMaxTime + temperatureMinTime temperatureMaxTime )] => ( + is => 'ro', + isa => 'Int', # time! +); + +has [qw(summary icon precipType)] => ( + is => 'ro', + isa => 'Str', +); + +has [qw( precipIntensity precipIntensityMax + precipProbability precipAccumulation + temperature temperatureMin temperatureMax + dewPoint humidity + windSpeed windBearing + cloudCover + pressure visibility ozone )] => ( + is => 'ro', + isa => 'Num', +); + +1; |