summaryrefslogtreecommitdiff
path: root/lib/WebService/ForecastIo/DataPoint.pm
blob: ba06fa19fb4490e5698ba1c58c2a94a7c6691ec5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 ]
    };
 
has [qw( time
         sunriseTime sunsetTime
         precipIntensityMaxTime
         temperatureMinTime temperatureMaxTime )] => (
    is => 'ro',
    isa => 'DateTime',
    coerce => 1,
);
 
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;