Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

more tests, more docs, more methods following all klout user api calls

  • Loading branch information...
commit 7853c22ca17c9d735ae0538ba81ab466d7ed901d 1 parent b3cae2f
Edward Hotchkiss authored
1  .gitignore
... ... @@ -0,0 +1 @@
  1 +node_modules/
46 lib/klout.js
@@ -70,7 +70,7 @@ klout.get = function(path, users, callback) {
70 70 };
71 71
72 72 /*!
73   - Get's a user or group of users <path>
  73 + Get's users Klout Score
74 74 @param {String} users Comma separated list of users to inquire about
75 75 @param {Function} callback Function to call upon error or success
76 76 @returns {Object} error, {Object} users
@@ -80,6 +80,50 @@ klout.getKlout = function(users, callback) {
80 80 this.get("/klout", users, callback);
81 81 };
82 82
  83 +/*!
  84 + Get's a users "User" object
  85 + @param {String} users Comma separated list of users to inquire about
  86 + @param {Function} callback Function to call upon error or success
  87 + @returns {Object} error, {Object} users
  88 +*/
  89 +
  90 +klout.getShow = function(users, callback) {
  91 + this.get("/users/show", users, callback);
  92 +};
  93 +
  94 +/*!
  95 + Get's a users topics related to that user
  96 + @param {String} users Comma separated list of users to inquire about
  97 + @param {Function} callback Function to call upon error or success
  98 + @returns {Object} error, {Object} users
  99 +*/
  100 +
  101 +klout.getTopics = function(users, callback) {
  102 + this.get("/users/topics", users, callback);
  103 +};
  104 +
  105 +/*!
  106 + Get's the users that influence users
  107 + @param {String} users Comma separated list of users to inquire about
  108 + @param {Function} callback Function to call upon error or success
  109 + @returns {Object} error, {Object} users
  110 +*/
  111 +
  112 +klout.getInfluencedBy = function(users, callback) {
  113 + this.get("/soi/influenced_by", users, callback);
  114 +};
  115 +
  116 +/*!
  117 + Get's the users that are influencer of this users
  118 + @param {String} users Comma separated list of users to inquire about
  119 + @param {Function} callback Function to call upon error or success
  120 + @returns {Object} error, {Object} users
  121 +*/
  122 +
  123 +klout.prototype.getInfluencerOf = function(users, callback) {
  124 + this.get("/soi/influencer_of", users, callback);
  125 +};
  126 +
83 127 // export module function klout(){}
84 128 module.exports = klout;
85 129
2  package.json
@@ -2,7 +2,7 @@
2 2 "author":"Edward Hotchkiss <e@ingk.com>",
3 3 "name":"klout",
4 4 "description":"NodeJS Klout API Wrapper",
5   - "version": "0.1.1",
  5 + "version": "0.1.2",
6 6 "repository":{
7 7 "type":"git",
8 8 "url":"git://github.com/edwardhotchkiss/klout.git"
13 test/index.test.js
@@ -21,8 +21,19 @@ vows.describe("general module tests").addBatch({
21 21 topic:function(){
22 22 klout.getKlout("kisshotch", this.callback);
23 23 },
24   - "we should be able to get a klout score":function(error, users){
  24 + "we should be able to get a klout score, with no errors, and a user object with a length":function(error, users){
25 25 assert.equal(error, null);
  26 + assert.notEqual(users.users.length, undefined);
  27 + users.should.be.a("object");
  28 + }
  29 + },
  30 + "when requesting multipel users klout scores":{
  31 + topic:function(){
  32 + klout.getKlout("kisshotch,hankejh,craigablerino", this.callback);
  33 + },
  34 + "we should be able to get a set of klout scores, with no errors, users as an object and users should have a length":function(error, users){
  35 + assert.equal(error, null);
  36 + assert.notEqual(users.users.length, undefined);
26 37 users.should.be.a("object");
27 38 }
28 39 }

0 comments on commit 7853c22

Please sign in to comment.
Something went wrong with that request. Please try again.