Comparing version 0.1.0 to 0.2.0
32
index.js
var api = require('./api'); | ||
function Aeris(client_id, client_secret, city, state) { | ||
function Aeris(client_id, client_secret) { | ||
this.client_id = client_id || null; | ||
this.client_secret = client_secret || null; | ||
this.city = city || null; | ||
this.state = state || null; | ||
this.url = function(endpoint, opts) { | ||
var city = this.city; | ||
var state = this.state; | ||
var client_id = this.client_id; | ||
var client_secret = this.client_secret; | ||
var url = ['http://api.aerisapi.com/', endpoint, '/', city, ',', state, '?client_id=', client_id, '&client_secret=', client_secret]; | ||
for (key in opts) { | ||
this.url = function(endpoint, options) { | ||
var url = ['http://api.aerisapi.com/', endpoint, '/?client_id=', this.client_id, '&client_secret=', this.client_secret]; | ||
var location = '&p='; | ||
switch (options.location.type) { | ||
case 'city': | ||
location += options.location.city + ',' + options.location.state | ||
break; | ||
case 'zip': | ||
location += options.location.zip | ||
break; | ||
case 'latlong': | ||
location += options.location.latitude + ',' + options.location.longitude | ||
break; | ||
default: | ||
location = ''; | ||
} | ||
url.push(location); | ||
delete options.location; | ||
for (key in options) { | ||
url.push('&' + key + '='); | ||
url.push(opts[key]); | ||
url.push(options[key]); | ||
} | ||
@@ -19,0 +29,0 @@ return url.join(''); |
{ | ||
"name": "aeris", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Aeris Weather API wrapper for node", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
2909
6
56
1
23