package WebService::ForecastIo::Response;
use Moo;
use Types::Standard -all;
use WebService::ForecastIo::Types -all;
use JSON;
use namespace::clean;
has 'currently' => (
is => 'ro',
isa => DataPoint,
coerce => DataPoint->coercion,
);
has [qw(daily hourly minutely)] => (
is => 'ro',
isa => DataBlock,
coerce => DataBlock->coercion,
);
has [qw(latitude longitude)] => (
is => 'ro',
isa => Num,
);
has timezone => (
is => 'ro',
isa => Str,
);
has offset => (
is => 'ro',
isa => Num,
);
has alerts => (
is => 'ro',
isa => AlertArray,
coerce => AlertArray->coercion,
);
has flags => (
is => 'ro',
isa => HashRef,
);
around BUILDARGS => sub {
my ($orig,$class,@args) = @_;
if (@args==1 and !ref($args[0])) {
@args = decode_json($args[0]);
}
return $class->$orig(@args);
};
1;