-
Notifications
You must be signed in to change notification settings - Fork 35
/
package.json
30 lines (30 loc) · 2.34 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"name": "forecast.io",
"version": "0.0.11",
"description": "wrapper around forecast.io weather API",
"main": "./index.js",
"scripts": {
"test": "DEBUG= ./node_modules/.bin/mocha -R spec -t 5000"
},
"dependencies": {
"debug": "^0.8.0",
"request": "^2.16.6"
},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"keywords": [],
"repository": {
"url": "[email protected]:mateodelnorte/forecast.io.git"
},
"homepage": "https://github.com/mateodelnorte/forecast.io",
"author": {
"name": "Matt Walters"
},
"license": "BSD",
"readme": "forecast.io\n===========\n\nA simple wrapper for the awesome forecast.io API: https://developer.forecast.io/docs/v2\n\nHow to use it: \n\n1. Require forecast.io\n\n```\nvar Forecast = require('forecast.io');\n```\n\n2. Instantiate an instance of Forecast. You'll need to provide options specifying your forecast.io API Key. \n\n```\nvar options = {\n APIKey: process.env.FORECAST_API_KEY\n},\nforecast = new Forecast(options);\n```\n\n3. Make a call to the API using the get or getAtTime methods. \n\n The get function calls to the https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE endpoint. \n\n```\nforecast.get(latitude, longitude, function (err, res, data) {\n if (err) throw err;\n log('res: ' + util.inspect(res));\n log('data: ' + util.inspect(data));\n});\n```\n \n getAtTime calls the similar endpoint with time specified: https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE,TIME.\n \n```\nvar time = new Date().setDate(0); // lets use an arbitrary date\nforecast.getAtTime(latitude, longitude, time, function (err, res, data) {\n if (err) throw err;\n log('res: ' + util.inspect(res));\n log('data: ' + util.inspect(data));\n});\n```\n \nAdditional: \n\n1. Both get and getAtTime functions accept optional parameters to accomodate the optional query string params available for the forecast API calls. The following call is, for instance, possible and will return only the current property and its child properties: \n\n```\nvar options = {\n exclude: 'minutely,hourly,daily,flags,alerts'\n};\nforecast.get(latitude, longitude, options, function (err, res, data) {\n if (err) throw err;\n log('res: ' + util.inspect(res));\n log('data: ' + util.inspect(data));\n});\n```\n",
"readmeFilename": "README.md",
"_id": "[email protected]",
"_from": "forecast.io@"
}