NAME

VisualCrossing::API - Provides Perl API to VisualCrossing

SYNOPSIS

use VisualCrossing::API;
use JSON::XS;
use feature 'say';

my $location = "AU419";
my $date = "2023-05-25"; # example  time (optional)
my $key = "ABCDEFGABCDEFGABCDEFGABCD"; # example VisualCrossing API key

## Current Data (limit to current, saves on API cost)
my $weatherApi = VisualCrossing::API->new(
    key       => $key,
    location => $location,
    include  => "current",
);
my $current = $weatherApi->getWeather;

say "current temperature: " . $current->{currentConditions}->{temp};
say "current conditions: " . $current->{currentConditions}->{conditions};

## Historical Data (limit to single day, saves on API cost)
my $weatherApi = VisualCrossing::API->new(
    key       => $key,
    location => $location,
    date      => $date
    date2      => $date
    include  => "days",
);
my $history = $weatherApi->getWeather;

say "$date temperature: " . $history->{days}[0]->{temp};
say "$date conditions: " . $history->{days}[0]->{conditions};

DESCRIPTION

This module is a wrapper around the VisualCrossing API.

REFERENCES

Git repository: https://github.com/duanemay/VisualCrossing-API

VisualCrossing API docs: https://www.visualcrossing.com/resources/documentation/weather-api/timeline-weather-api/

Based on DarkSky-API: https://github.com/mlbright/DarkSky-API

COPYRIGHT

Copyright (c) 2023 "Duane May"

LICENSE

This library is free software and may be distributed under the APACHE LICENSE, VERSION 2.0 https://www.apache.org/licenses/LICENSE-2.0.