summaryrefslogtreecommitdiff
path: root/lib/WebService/ForecastIo/DataPoint.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebService/ForecastIo/DataPoint.pm')
-rw-r--r--lib/WebService/ForecastIo/DataPoint.pm30
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;