NAME
Yahoo::Weather::Api - The great new 2018 Yahoo::Weather::Api
VERSION
Version 1.00
SYNOPSIS
Yahoo::Weather::Api fetches the Weather information as provided by the Yahoo's weather API.
Access is limited to 2,000 signed calls per day
Refer more here https://developer.yahoo.com/weather/
use Yahoo::Weather::Api;
my $api = Yahoo::Weather::Api->new();
print $api->_get_data({ 'search' => 'Palo Alto, CA, US' });
or
use Yahoo::Weather::Api;
my $api = Yahoo::Weather::Api->new({ 'unit' => 'F', 'format' => 'xml'});
print $api->get_weather_data_by_geo({'long' => '74.932999', 'lat' => '31.7276', 'only'=>1});
SUBROUTINES/METHODS
new()
get_weather_data()
get_weather_data_by_geo()
get_woeid()
get_woeid_alternate()
new
constructor for the class Yahoo::Weather::Api
hash ref of options supported (OPTIONAL).
my $api = Yahoo::Weather::Api->new({ 'unit' => 'F', 'format' => 'xml'});
unit can be either celcius c or farenheit f Default is c
my $api = Yahoo::Weather::Api->new({ 'unit' => 'F'});
my $api = Yahoo::Weather::Api->new({ 'unit' => 'C'});
Format return data type from api JSON json or XML xml Default is json
my $api = Yahoo::Weather::Api->new({ 'format' => 'xml' , 'unit' => 'F'});
get_weather_data
Fetch data for a place using (zip, city name)
Need search parameter eg. { search => '<STRING>' }
Mandatory param hashref search => '<SEARCH_STRING>'
Needless to say, enclose within single quotes
Optional Param only {'only' => 1 } will return only best matching result as per the Yahoo api
Default is 0 i.e {'only' = 0}> sub will return all the results fetched.
will return all the results from API
$api->get_weather_data({ 'search' => 'Palo Alto, CA, US' });
or
will return all the results from API
$api->get_weather_data({ 'search' => '555512' });
or
will return only best matching single result from API
$api->get_weather_data({ 'search' => '555512' ,'only' => 1 ,});
get_weather_data_by_geo
Fetch data for a place using (geolocation by latitude and longitude)
Need search parameter eg. { lat => '<latitude>', long => 'longitude' }
Mandatory param hashref lat => '<latitude>' and long => '<longitude>'
Optional Param only {'only' => 1 } will return only best matching result as per the Yahoo api
Default is 0 i.e {'only' = 0>} sub will return all the results fetched.
will return all the results from API
$api->get_weather_data_by_geo({'long' => '74.932999','lat' => '31.7276',});
or
will return only best matching single result from API
$api->get_weather_data_by_geo({'long' => '74.932999','lat' => '31.7276','only' => 1 ,});
NOTE method do not support 'search' parameter
get_woeid
Fetch woeid for a place using (geolocation by latitude-longitude, zip, city/location name)
Yahoo has given a unique id for all the places present in their Database
this method will help to fetch the woeid related data via API
Need search parameter eg. { lat => '<latitude>', long => 'longitude' }
Mandatory param hashref lat => '<latitude>' and long => '<longitude>'
Optional Param only {'only' => 1 } will return only best matching result as per the Yahoo api
Default is 0 i.e {'only' = 0>} sub will return all the results fetched.
will return all the results from API
$api->get_woeid({ 'search' => 'Palo Alto, CA, US' });
or
will return all the results from API
$api->get_woeid({'long' => '74.932999','lat' => '31.7276',});
or
will return only best matching single result from API
$api->get_woeid({'long' => '74.932999','lat' => '31.7276','only' => 1 ,});
get_woeid_alternate
Fetch woeid for a place using alternate method (zip,city/location name) Stricty JSON return type data
get_woeid_alternate uses unexposed Yahoo's api so no API call caping
this method will help to fetch the woied related data via API
This implementation is purely experimental.
Only Mandatory 'search' parameter
lati,longi,unit,only.format not supported
$api->get_woeid_alternate({'search '=> '<STRING>'});
NOTE
the unit test will not run if no internet connection is detected.
AUTHOR
Sushrut Pajai, <spajai at cpan.org>
BUGS
Please report any bugs or feature requests to bug-yahoo-weather-api at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Yahoo-Weather-Api. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Yahoo::Weather::Api
You can also look for information at:
ACK
Module internally uses following module
Thanks to the creator of these modules
URL::Builder http://search.cpan.org/~tokuhirom/URL-Builder-0.06/lib/URL/Builder.pm
LWP::UserAgent http://search.cpan.org/~oalders/libwww-perl-6.33/lib/LWP/UserAgent.pm
Git Hub repo
RT: CPAN's request tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
YAHOO's API USAGE Agreement
Rate Limits Use of the Yahoo Weather API should not exceed reasonable request volume. Access is limited to 2,000 signed calls per day.
Terms of Use The above feeds are provided free of charge for use by individuals and non-profit organizations for personal, non-commercial uses. We reserve all rights in and to the Yahoo logo, and your right to use the Yahoo logo is limited to providing attribution in connection with these RSS feeds. Yahoo also reserves the right to require you to cease distributing these feeds at any time for any reason. Usage of these feeds is subject to YDN terms of use. Your use of weather feeds is subject to the Yahoo APIs Terms of Use.
LICENSE AND COPYRIGHT
Copyright 2018 Sushrut Pajai.
This program is distributed under the MIT (X11) License: http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 340:
You forgot a '=back' before '=head1'
- Around line 350:
'=item' outside of any '=over'