Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaxgeller/node-weatherunderground
Weather underground api wrapper for node
https://github.com/jaxgeller/node-weatherunderground
Last synced: 16 days ago
JSON representation
Weather underground api wrapper for node
- Host: GitHub
- URL: https://github.com/jaxgeller/node-weatherunderground
- Owner: jaxgeller
- Created: 2014-09-22T19:19:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-04T00:53:17.000Z (over 8 years ago)
- Last Synced: 2024-05-03T18:50:52.185Z (8 months ago)
- Language: JavaScript
- Size: 174 KB
- Stars: 9
- Watchers: 3
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-weatherunderground
[![Build Status](https://travis-ci.org/jacksongeller/node-weatherunderground.svg)](https://travis-ci.org/jacksongeller/node-weatherunderground)
# Install
`$ npm install node-weatherunderground --save`# Use
```js
var Wunderground = require('wunderground-api');
var client = new Wunderground('your api key here', 'Washington', 'DC');
```All parameters are optional at the point of init, you can change them later by adding in an object
```js
var Wunderground = require('wunderground-api');
var client = new Wunderground();
```# Examples
```js
var Wunderground = require('wunderground-api');
var client = new Wunderground('your api key here', 'Washington', 'DC');client.conditions('', function(err, data) {
if (err) throw err;
else console.log(data);
});client.hourly10day('', function(err, data) {
if (err) throw err;
else console.log(data);
});
```No config at the point of init
```js
var Wunderground = require('wunderground-api');
var client = new Wunderground();
var opts = {
key:'your api key here',
city:'Washington',
state: 'DC'
}client.conditions(opts, function(err, data) {
if (err) throw err;
else console.log(data);
});client.hourly10day(opts, function(err, data) {
if (err) throw err;
else console.log(data);
});
```Half init, opts will always overwrite init
```js
var Wunderground = require('wunderground-api');
var client = new Wunderground('your api key here');
var opts = {
city:'Washington',
state: 'DC'
}client.conditions(opts, function(err, data) {
if (err) throw err;
else console.log(data);
});client.hourly10day(opts, function(err, data) {
if (err) throw err;
else console.log(data);
});
```# Config Api
## WundergroundClient(apiKey, city, state)
Init a new Wunderground client for API use, all params optional at init and can be overwritten### Params:
* **String** *apiKey* - the Wunderground api key
* **String** *city* - city for weather data
* **String** *state* - state for weather data
## Opts
Optional object passed into API### Props
* **String** *key* - wunderground key
* **String** *city* - city
* **String** *state* - state# API
## conditions(opts, callback)
Gets conditions for a specific location
### Params:
* **Object** *opts* - optional object that bypasses initting a client
* **Function** *callback* - returns err, data## forecast(opts, callback)
Gets forecast for a specific location
### Params:
* **Object** *opts* - optional object that bypasses initting a client
* **Function** *callback* - returns err, data## forecast10day(opts, callback)
Gets forecast 10 days in advance for a specific location
### Params:
* **Object** *opts* - optional object that bypasses initting a client
* **Function** *callback* - returns err, data## hourly(opts, callback)
Gets hourly conditions for a specific location
### Params:
* **Object** *opts* - optional object that bypasses initting a client
* **Function** *callback* - returns err, data## hourly10day(opts, callback)
Gets hourly conditions 10 days in advance for a specific location
### Params:
* **Object** *opts* - optional object that bypasses initting a client
* **Function** *callback* - returns err, data