summaryrefslogtreecommitdiff
path: root/lib/WebService/ForecastIo/Response.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/WebService/ForecastIo/Response.pm')
-rw-r--r--lib/WebService/ForecastIo/Response.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/WebService/ForecastIo/Response.pm b/lib/WebService/ForecastIo/Response.pm
new file mode 100644
index 0000000..e217c70
--- /dev/null
+++ b/lib/WebService/ForecastIo/Response.pm
@@ -0,0 +1,55 @@
+package WebService::ForecastIo::Response;
+use Moose;
+use WebService::ForecastIo::DataPoint;
+use WebService::ForecastIo::DataBlock;
+use WebService::ForecastIo::Alert;
+use JSON;
+
+has 'currently' => (
+ is => 'ro',
+ isa => 'WebService::ForecastIo::DataPoint',
+ coerce => 1,
+);
+
+has [qw(daily hourly minutely)] => (
+ is => 'ro',
+ isa => 'WebService::ForecastIo::DataBlock',
+ coerce => 1,
+);
+
+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 => 'WebService::ForecastIo::AlertArray',
+ coerce => 1,
+);
+
+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;