Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Lint fixes

  • Loading branch information...
commit 0c1391273f94879e2176433e7dc342690a58cc03 1 parent 30abe5a
@bencevans authored
Showing with 106 additions and 81 deletions.
  1. +27 −0 .jshintrc
  2. +79 −81 lib/nodeGauges.js
View
27 .jshintrc
@@ -0,0 +1,27 @@
+{
+ "browser": true,
+ "node": true,
+
+ "strict": false,
+ "undef": true,
+ "unused": true,
+ "latedef": true,
+ "immed": true,
+ "noarg": true,
+ "indent": 2,
+ "trailing": true,
+ "quotmark": "single",
+ "camelcase": false,
+ "newcap": true,
+ "eqeqeq": true,
+ "predef": [
+ "require",
+ "define",
+ "before",
+ "after",
+ "describe",
+ "it",
+ "beforeEach",
+ "afterEach"
+ ]
+}
View
160 lib/nodeGauges.js
@@ -1,7 +1,6 @@
function nodeGaugesClient (apiKey) {
var request = require('request');
- var querystring = require('querystring');
this.apiKey = apiKey;
this.apiBase = 'https://secure.gaug.es';
@@ -20,188 +19,187 @@ function nodeGaugesClient (apiKey) {
//
this.me = function (var1, var2) {
- if (typeof var2 == 'undefined') {
+ if (typeof var2 === 'undefined') {
// GET
nodeGauges.apiCall('/me', 'GET', {}, var1);
} else {
nodeGauges.apiCall('/me', 'PUT', var1, var2);
- };
- }
+ }
+ };
// GET /clients
this.clients = function (callback) {
nodeGauges.apiCall('/clients', 'GET', {}, callback);
- }
+ };
this.clients.create = function (options, callback) {
nodeGauges.apiCall('/clients', 'POST', options, callback);
- }
+ };
this.clients.delete = function (clientID, callback) {
nodeGauges.apiCall('/clients/' + clientID, 'DELETE', {}, callback);
- }
+ };
// if gaugeID set return /gauges/:id
// else just return /gauges
this.gauges = function (var1, var2) {
- if(typeof var2 == 'undefined') {
+ if(typeof var2 === 'undefined') {
//Get List
nodeGauges.apiCall('/gauges', 'GET', {}, var1);
} else {
//Get Individual
nodeGauges.apiCall('/gauges/' + var1, 'GET', {}, var2);
}
- }
+ };
this.gauges.create = function (parameters, callback) {
nodeGauges.apiCall('/gauges', 'POST', parameters, callback);
- }
+ };
this.gauges.update = function (gaugeID, parameters, callback) {
nodeGauges.apiCall('/gauges/' + gaugeID, 'UPDATE', parameters, callback);
- }
+ };
this.gauges.delete = function (gaugeID, callback) {
nodeGauges.apiCall('/gauges/' + gaugeID, 'DELETE', {}, callback);
- }
+ };
this.sharing = function (gaugeID, callback) {
nodeGauges.apiCall('/gauges/' + gaugeID + '/shares', 'GET', {}, callback);
- }
+ };
this.sharing.share = function (gaugeID, email, callback) {
nodeGauges.apiCall('/gauges/' + gaugeID + '/shares', 'POST', {
email:email
}, callback);
- }
+ };
this.sharing.unshare = function (gaugeID, userID, callback) {
- nodeGauges.apiCall('/gauges/' + gaugeID + '/shares/' + userID, 'DELETE', {
- email:email
- }, callback);
- }
+ nodeGauges.apiCall('/gauges/' + gaugeID + '/shares/' + userID, 'DELETE', callback);
+ };
this.content = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/content', 'GET', parameters, callback);
- }
+ };
this.referrers = function (gaugeID, var1, var2) {
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/referrers', 'GET', parameters, callback);
- }
+ };
this.traffic = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/traffic', 'GET', parameters, callback);
- }
+ };
this.resolutions = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/resolutions', 'GET', parameters, callback);
- }
+ };
this.technology = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/technology', 'GET', parameters, callback);
- }
+ };
this.terms = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/terms', 'GET', parameters, callback);
- }
+ };
this.engines = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/engines', 'GET', parameters, callback);
- }
+ };
this.locations = function (gaugeID, var1, var2) {
-
- if(typeof var2 == 'undefined'){
- var parameters = {};
- var callback = var1;
+ var parameters, callback;
+ if(typeof var2 === 'undefined'){
+ parameters = {};
+ callback = var1;
} else{
- var parameters = var1;
- var callback = var2;
+ parameters = var1;
+ callback = var2;
}
nodeGauges.apiCall('/gauges/' + gaugeID + '/locations', 'GET', parameters, callback);
- }
+ };
this.apiCall = function (route, method, data, callback) {
- if(typeof route == 'undefined')
- throw noRouteGiven;
+ if(typeof route === 'undefined')
+ return callback(new Error('No Route Provided'));
var requestOptions = {
uri: nodeGauges.apiBase + route,
headers: {
- "X-Gauges-Token":this.apiKey,
+ 'X-Gauges-Token': this.apiKey,
},
json: true
- }
+ };
- if(typeof method == 'undefined')
- requestOptions.method = "GET";
+ if(typeof method === 'undefined')
+ requestOptions.method = 'GET';
else
requestOptions.method = method;
@@ -220,7 +218,7 @@ function nodeGaugesClient (apiKey) {
}
}
});
- }
+ };
}
@@ -229,6 +227,6 @@ exports.createClient = function(apiKey) {
var nodeGuages;
nodeGuages = new nodeGaugesClient(apiKey);
return nodeGuages;
-}
+};
Please sign in to comment.
Something went wrong with that request. Please try again.