Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

doc fix, getSingle, Klout.key checking

  • Loading branch information...
commit 121f1b0a3eae9b951c34e3c59cdf4a1438d89f88 1 parent cfff52b
@edwardhotchkiss authored
View
5 README.md
@@ -3,10 +3,9 @@ node-klout
==========
* Extremely reliable Node.js Klout API Wrapper
- * Returns null on non-parseable JSON (ocassional) from the Klout API.
+ * Returns null on non-parseable JSON (ocassionally happens from the Klout API)
```javascript
-
var Klout = require("node-klout");
Klout.key = "MY_API_KEY";
@@ -14,7 +13,7 @@ Klout.getSingle("kisshotch", function(error, klout) {
if (error) {
console.error(error);
} else {
- console.log("Klout Score: ", klout);
+ console.log("Klout Score for @kisshotch:", klout);
};
});
```
View
11 examples/Klout.getSingle.js
@@ -0,0 +1,11 @@
+
+var Klout = require("../");
+Klout.key = "MY_API_KEY";
+
+Klout.getSingle("kisshotch", function(error, klout) {
+ if (error) {
+ console.error(error);
+ } else {
+ console.log("Klout Score for @kisshotch:", klout);
+ };
+});
View
19 lib/node-klout.js
@@ -1,8 +1,14 @@
-(function(global, undefined) {
- var request = require("request");
- var Klout = function(){};
- Klout.klout = function(handles, callback) {
+var request = require("request");
+
+var Klout = function(){};
+Klout.key = null;
+
+Klout.getSingle = function(handles, callback) {
+ if (Klout.key === null || Klout.key === "MY_API_KEY") {
+ var error = { message : "set your Klout.key" };
+ callback(error, null);
+ } else {
var method = "http://api.klout.com/1//klout.json?";
var path = "key=" + Klout.key + "&users=" + handles;
var URL = method + path;
@@ -22,7 +28,8 @@
}
});
};
- module.exports = Klout;
-})(global);
+};
+
+module.exports = Klout;
/* EOF */
View
4 package.json
@@ -2,12 +2,12 @@
"author": "Edward Hotchkiss <e@ingk.com>",
"name": "node-klout",
"description": "Extremely reliable Node.js Klout API Wrapper",
- "version": "0.0.5",
+ "version": "0.0.6",
"repository": {
"type": "git",
"url": "git://github.com/edwardhotchkiss/node-klout.git"
},
- "keywords": ["klout", "node-klout", "twitter"],
+ "keywords": ["klout", "node-klout", "twitter", "rank"],
"main": "./index",
"engines": {
"node": "~v0.4.11"
Please sign in to comment.
Something went wrong with that request. Please try again.