Permalink
Browse files

Get followers, get followings + test.

  • Loading branch information...
1 parent 498ab47 commit 14356466c4e2f9ea6c4579f15035836e6feb4ba5 @bnjbvr committed Apr 10, 2013
Showing with 63 additions and 16 deletions.
  1. +0 −16 example/test-public-posts.js
  2. +27 −0 example/test-public.js
  3. +16 −0 lib/followers.coffee
  4. +16 −0 lib/following.coffee
  5. +4 −0 lib/tent.coffee
View
16 example/test-public-posts.js
@@ -1,16 +0,0 @@
-var tent = require('../lib/tent');
-var config = require('./config');
-
-var client = new tent( config.stalkedEntity );
-
-var params = {
- limit: 1,
- post_types: client.posts.TYPES.essay.url
-};
-
-client.posts.get( params, function(err, posts) {
- if(err) { console.error(err); } else {
- console.log('last post from stalked entity: ' + JSON.stringify(posts) );
- }
-});
-
View
27 example/test-public.js
@@ -0,0 +1,27 @@
+var tent = require('../lib/tent');
+var config = require('./config');
+
+var client = new tent( config.stalkedEntity );
+
+var params = {
+ limit: 1,
+ post_types: client.posts.TYPES.essay.url
+};
+
+client.posts.get( params, function(err, posts) {
+ if(err) { console.error(err); } else {
+ console.log('last post from stalked entity: ' + JSON.stringify(posts) );
+
+ client.followings.get({}, function(err, followings) {
+ if(err) { console.error(err); } else {
+ console.log( 'followings:\n' + JSON.stringify(followings));
+ client.followers.get({}, function(err, followers) {
+ if(err) { console.error(err); } else {
+ console.log( 'followers:\n' + JSON.stringify(followers) );
+ }
+ });
+ }
+ });
+ }
+});
+
View
16 lib/followers.coffee
@@ -0,0 +1,16 @@
+SubModule = require './submodule'
+utils = require './utils'
+
+class Followers extends SubModule
+ get: (params, cb) ->
+ url = '/followers'
+ reqParam =
+ url: url
+ additional: params
+ method: 'GET'
+ rcb = utils.makeGenericCallback cb
+ @call reqParam, rcb
+ @
+
+module.exports = Followers
+
View
16 lib/following.coffee
@@ -0,0 +1,16 @@
+SubModule = require './submodule'
+utils = require './utils'
+
+class Followings extends SubModule
+ get: (params, cb) ->
+ url = '/followings'
+ reqParam =
+ url: url
+ additional: params
+ method: 'GET'
+ # no auth?
+ rcb = utils.makeGenericCallback cb
+ @call reqParam, rcb
+ @
+
+module.exports = Followings
View
4 lib/tent.coffee
@@ -5,6 +5,8 @@ Request = require './requests'
AppModule = require './app'
PostsModule = require './posts'
ProfileModule = require './profile'
+FollowingModule = require './following'
+FollowerModule = require './followers'
Credentials = require './credentials'
@@ -13,6 +15,8 @@ class Client
@app = new AppModule @
@posts = new PostsModule @
@profile = new ProfileModule @
+ @followings = new FollowingModule @
+ @followers = new FollowerModule @
@queue = []
@queueBusy = false

0 comments on commit 1435646

Please sign in to comment.