Permalink
Browse files

remove js

  • Loading branch information...
1 parent d7b7b0b commit 9937e715cd6059e27981ee5a56bcfb830470a20c @heupel committed Dec 23, 2011
Showing with 8 additions and 115 deletions.
  1. +2 −0 .gitignore
  2. +0 −108 lib/pingdom.js
  3. +6 −7 package.json
View
@@ -1 +1,3 @@
node_modules
+lib
+.DS_Store
View
@@ -1,108 +0,0 @@
-(function() {
- var Pingdom, createClient, http, request, url;
-
- http = require('http');
-
- url = require('url');
-
- request = require('request');
-
- Pingdom = (function() {
- Pingdom.name = 'Pingdom';
- function Pingdom(apiKey, username, password, version) {
- this.apiKey = apiKey;
- this.username = username;
- this.password = password;
- this.version = version != null ? version : '2.0';
- if (!(this instanceof Pingdom)) {
- return new Pingdom(apiKey, username, password, version);
- }
- this.checks = [];
- this.baseUrl = "https://api.pingdom.com/api/" + this.version;
- }
-
- Pingdom.prototype.getCurrentServerTime = function(dataCallback) {
- var requestUrl;
- requestUrl = "" + this.baseUrl + "/servertime";
- return this.apiCall(requestUrl, dataCallback);
- };
-
- Pingdom.prototype.getCheckList = function(force, dataCallback) {
- var requestUrl;
- if (arguments.length === 1) {
- dataCallback = force;
- force = false;
- }
- if (!(force || this.checks.length === 0)) return this.checks;
- requestUrl = "" + this.baseUrl + "/checks";
- return this.apiCall(requestUrl, function(checks) {
- this.checks = checks;
- if (dataCallback) return dataCallback(checks);
- });
- };
-
- Pingdom.prototype.getDetailedCheckInfo = function(checkId, dataCallback) {
- var requestUrl;
- requestUrl = "" + this.baseUrl + "/checks/" + checkId;
- return this.apiCall(requestUrl, dataCallback);
- };
-
- Pingdom.prototype.getSummaryAverage = function(checkId, options, dataCallback) {
- var requestUrl;
- requestUrl = "" + this.baseUrl + "/summary.average/" + checkId + "/?" + (Pingdom.toQueryString(options));
- return this.apiCall(requestUrl, dataCallback);
- };
-
- Pingdom.prototype.getSummaryHoursOfDay = function(checkId, options, dataCallback) {
- var requestUrl;
- if (options == null) options = {};
- requestUrl = "" + this.baseUrl + "/summary.hoursofday/" + checkId + "/?" + (Pingdom.toQueryString(options));
- return this.apiCall(requestUrl, dataCallback);
- };
-
- Pingdom.prototype.apiCall = function(requestUrl, dataCallback) {
- var options, req;
- if (!this.auth) {
- this.auth = 'Basic ' + new Buffer(this.username + ':' + this.password).toString('base64');
- }
- options = {
- uri: url.parse(requestUrl),
- headers: {
- 'App-Key': this.apiKey,
- 'Authorization': this.auth
- }
- };
- return req = request(options, function(error, response, body) {
- if (!error && response.statusCode === 200) {
- return dataCallback(JSON.parse(body));
- } else {
- return console.log("Error: " + error + "\nResponse: " + response.body);
- }
- });
- };
-
- Pingdom.toQueryString = function(options) {
- var key, pairs, value;
- pairs = (function() {
- var _results;
- _results = [];
- for (key in options) {
- value = options[key];
- _results.push("" + key + "=" + value);
- }
- return _results;
- })();
- return pairs.join('&');
- };
-
- return Pingdom;
-
- })();
-
- createClient = function(apiKey, username, password, version) {
- return new Pingdom(apiKey, username, password, version);
- };
-
- exports.createClient = createClient;
-
-}).call(this);
View
@@ -8,20 +8,19 @@
{ "name": "Tony Heupel", "email": "tonyheupel@gmail.com"},
{ "name": "Grant Goodale", "email": "<ggoodale@moreblinktag.com>"}
],
- "directories": {"lib": "./lib", "test": "./test"},
+ "directories": {"src": "./src", "lib": "./lib", "test": "./test"},
"dependencies": {
- "request": ">=1.9.6"
- },
- "devDependencies": {
+ "request": ">=1.9.6",
"coffee-script": ">=1.2.1-pre",
"vows": ">=0.6.0"
},
- "repository": {
+ "repository": {
"type": "git",
"url": "git://github.com/jashkenas/coffee-script.git"
},
- "engines": {"node": ">=0.6.0"},
+ "engines": { "node": ">=0.6.0" },
"scripts": {
- "test": "vows test/*.coffee --spec"
+ "test": "vows test/*.coffee --spec",
+ "preinstall": "cake build"
}
}

0 comments on commit 9937e71

Please sign in to comment.