forked from dmccrevan/wunderground-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (46 loc) · 1.56 KB
/
index.js
File metadata and controls
48 lines (46 loc) · 1.56 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var wundergroundApi = require('./lib/wunderground-node');
var wunderground = function(key, city, state) {
this.key = key || null;
this.city = city || null;
this.state = state || null;
this.path = function(apiType, opts, date){
var key = opts.key || this.key;
var city = opts.city || this.city;
var state = opts.state || this.state;
if(date){
if(apiType === 'history_' || apiType === 'planner_'){
return '/api/' + key + '/' + apiType + date + '/q/' + state + '/' + city + '.json';
}
else{
console.log("Error: Date field not null without API type of planner or history");
return '/api/' + key + '/' + apiType + '/q/' + state + '/' + city + '.json';
}
}
else{
if(apiType === 'currenthurricane'){
return '/api/' + key + '/' + apiType + '/view.json';
}
else{
return '/api/' + key + '/' + apiType + '/q/' + state + '/' + city + '.json';
}
}
};
this.conditions = wundergroundApi.API;
this.forecast = wundergroundApi.API;
this.forecast10day = wundergroundApi.API;
this.hourly = wundergroundApi.API;
this.hourly10day = wundergroundApi.API;
this.alerts = wundergroundApi.API;
this.almanac = wundergroundApi.API;
this.astronomy = wundergroundApi.API;
this.currentHurricane = wundergroundApi.API;
this.geolookup = wundergroundApi.API;
this.history = wundergroundApi.APIDate;
this.planner = wundergroundApi.APIDate;
this.rawtide = wundergroundApi.API;
this.satellite = wundergroundApi.API;
this.tide = wundergroundApi.API;
this.webcams = wundergroundApi.API;
this.yesterday = wundergroundApi.API;
};
module.exports = wunderground;