Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

disqus-node

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

disqus-node - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

.travis.yml

5

CHANGELOG.md

@@ -0,1 +1,6 @@

##### 0.9.0 - 14 June 2014
###### Backwards compatible API changes
- #10 - Implemented Topics
##### 0.8.0 - 13 June 2014

@@ -2,0 +7,0 @@

173

Gruntfile.js
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
clean: {
doc: ['doc/']
},
grunt.initConfig({
clean: {
doc: ['doc/'],
coverage: ['test/coverage/']
},
watch: {
dist: {
files: ['lib/**/*.js', 'README.md'],
tasks: ['build']
}
},
watch: {
dist: {
files: ['lib/**/*.js', 'README.md'],
tasks: ['build']
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'lib/**/*.js',
'test/**/*.js'
]
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'lib/**/*.js',
'test/unit/**/*.js',
'test/requireHelper.js'
]
},
simplemocha: {
options: {
globals: [],
timeout: 5000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
dist: {
src: [
'test/**/*.js'
]
}
},
simplemocha: {
options: {
globals: [],
timeout: 5000,
ignoreLeaks: false,
ui: 'bdd',
reporter: 'spec'
},
dist: {
src: [
'test/**/*.js'
]
}
},
groc: {
javascript: [
'lib/**/*.js', 'README.md'
],
options: {
'out': 'doc/'
}
}
});
groc: {
javascript: [
'lib/**/*.js', 'doc.md'
],
options: {
'out': 'doc/',
'index': 'doc.md',
'repository-url': 'https://github.com/jmdobry/disqus-node'
}
},
grunt.registerTask('doc', ['clean', 'groc']);
mochaTest: {
unit: {
options: {
reporter: 'spec'
},
src: ['test/unit/**/*.js']
}
},
grunt.registerTask('build', [
'jshint',
'doc'
]);
env: {
coverage: {
APP_DIR_FOR_CODE_COVERAGE: '../test/coverage/instrument/lib/'
}
},
grunt.registerTask('default', [
'build'
]);
instrument: {
files: 'lib/**/*.js',
options: {
lazy: true,
basePath: 'test/coverage/instrument/'
}
},
grunt.registerTask('go', [
'build',
'watch'
]);
storeCoverage: {
options: {
dir: 'test/coverage/reports'
}
},
makeReport: {
src: 'test/coverage/reports/**/*.json',
options: {
type: 'lcov',
dir: 'test/coverage/reports',
print: 'detail'
}
},
coveralls: {
options: {
coverage_dir: 'test/coverage/reports'
}
}
});
grunt.registerTask('doc', ['clean:doc', 'groc']);
grunt.registerTask('build', [
'test',
'doc'
]);
grunt.registerTask('default', [
'build'
]);
grunt.registerTask('test', ['jshint', 'mochaTest:unit']);
grunt.registerTask('coverage', [
'clean:coverage',
'env:coverage',
'instrument',
'test',
'storeCoverage',
'makeReport'
]);
grunt.registerTask('go', [
'build',
'watch'
]);
};

@@ -8,6 +8,5 @@ /**

*/
var Disqus = require('../');
var commander = require('commander');
var applications = new commander.Command('disqus applications');
var util = require('../util');
var container = require('../container');
var Command = container.get('commander').Command;
var applications = new Command('disqus applications');

@@ -44,7 +43,8 @@ applications

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).applications.listUsage(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).applications.listUsage(options, container.get('util').printCliResult);
});
module.exports = applications;

@@ -8,6 +8,5 @@ /**

*/
var Disqus = require('../');
var commander = require('commander');
var blacklists = new commander.Command('disqus blacklists');
var util = require('../util');
var container = require('../container');
var Command = container.get('commander').Command;
var blacklists = new Command('disqus blacklists');

@@ -54,7 +53,8 @@ blacklists

.option('-r --retroactive [boolean]', 'Defaults to false.', false)
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-u --user [array]', 'Looks up a user by ID. You may look up a user by username using the "username" query type. Defaults to [].', [])
.option('-w --word [array]', 'Maximum length of 200. Defaults to [].', [])
.action(function (options) {
new Disqus(options).blacklists.add(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).blacklists.add(options, container.get('util').printCliResult);
});

@@ -101,5 +101,6 @@

.option('-s --since [number]', 'Unix timestamp (or ISO datetime standard)', null)
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).blacklists.list(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).blacklists.list(options, container.get('util').printCliResult);
});

@@ -138,9 +139,10 @@

.option('-i --ip [array]', 'IP address in CIDR notation. Defaults to [].', [])
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-u --user [array]', 'Looks up a user by ID. You may look up a user by username using the "username" query type. Defaults to [].', [])
.option('-w --word [array]', 'Maximum length of 200. Defaults to [].', [])
.action(function (forumId, options) {
new Disqus(options).blacklists.remove(options, util.printCliResult);
.action(function (options) {
var Disqus = container.get('Disqus');
new Disqus(options).blacklists.remove(options, container.get('util').printCliResult);
});
module.exports = blacklists;

@@ -8,6 +8,5 @@ /**

*/
var Disqus = require('../');
var commander = require('commander');
var categories = new commander.Command('disqus categories');
var util = require('../util');
var container = require('../container');
var Command = container.get('commander').Command;
var categories = new Command('disqus categories');

@@ -43,6 +42,7 @@ categories

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-t, --title <string>', 'Maximum length of 50')
.action(function (options) {
new Disqus(options).categories.create(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).categories.create(options, container.get('util').printCliResult);
});

@@ -73,5 +73,6 @@

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).categories.details(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).categories.details(options, container.get('util').printCliResult);
});

@@ -110,5 +111,6 @@

.option('-s, --since_id [string]', 'Defaults to null.', null)
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).categories.list(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).categories.list(options, container.get('util').printCliResult);
});

@@ -153,5 +155,6 @@

.option('-s, --since [string]', 'Defaults to null.', null)
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).categories.listPosts(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).categories.listPosts(options, container.get('util').printCliResult);
});

@@ -192,7 +195,8 @@

.option('-s, --since [string]', 'Defaults to null.', null)
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).categories.listThreads(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).categories.listThreads(options, container.get('util').printCliResult);
});
module.exports = categories;

@@ -8,6 +8,5 @@ /**

*/
var Disqus = require('../');
var commander = require('commander');
var exports = new commander.Command('disqus exports');
var util = require('../util');
var container = require('../container');
var Command = container.get('commander').Command;
var exports = new Command('disqus exports');

@@ -44,7 +43,8 @@ exports

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).exports.exportForum(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).exports.exportForum(options, container.get('util').printCliResult);
});
module.exports = exports;

@@ -8,6 +8,5 @@ /**

*/
var Disqus = require('../');
var commander = require('commander');
var imports = new commander.Command('disqus imports');
var util = require('../util');
var container = require('../container');
var Command = container.get('commander').Command;
var imports = new Command('disqus imports');

@@ -33,3 +32,3 @@ imports

-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-S, --api_secret <string> Your applications's api_secret.
-S, --api_secret <string> Your application's api_secret.
* ```

@@ -45,5 +44,6 @@ */

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).imports.details(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).imports.details(options, container.get('util').printCliResult);
});

@@ -67,3 +67,3 @@

-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-S, --api_secret <string> Your applications's api_secret.
-S, --api_secret <string> Your application's api_secret.
* ```

@@ -79,7 +79,8 @@ */

.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.action(function (options) {
new Disqus(options).imports.list(options, util.printCliResult);
var Disqus = container.get('Disqus');
new Disqus(options).imports.list(options, container.get('util').printCliResult);
});
module.exports = imports;

@@ -42,2 +42,9 @@ var commander = require('commander');

.description('Execute command for the Imports resource.');
/**
* ###### Topics
* [API](/lib/api/topics.html) | [CLI](/lib/cli/topics.html) | [Disqus](https://disqus.com/api/docs/topics/)
*/
disqus
.command('topics <cmd> [options]')
.description('Execute command for the Topics resource.');

@@ -53,2 +60,3 @@ exports.parse = function (primaryArgs, secondaryArgs) {

case 'imports':
case 'topics':
if (!secondaryArgs.length) {

@@ -55,0 +63,0 @@ primaryArgs.push('--help');

@@ -8,4 +8,5 @@ /**

*/
var commander = require('commander');
var topics = new commander.Command('disqus topics');
var container = require('../container');
var Command = container.get('commander').Command;
var topics = new Command('disqus topics');

@@ -25,7 +26,8 @@ topics

-h, --help output usage information
-A, --api_key <string> Your application's public api_key.
-H, --https [boolean] Whether to use https. Defaults to true.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-t, --target <string> Looks up a topic by ID (slug).
-h, --help output usage information
-A, --access_token <string> Your access token.
-H, --https [boolean] Whether to use https. Defaults to true.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-S, --api_secret <string> Your application's api_secret.
-t, --target <string> Looks up a topic by ID (slug).
* ```

@@ -36,26 +38,10 @@ */

.description('Follow a topic.')
.option('-A, --api_key <string>', 'Your applications\'s public api_key.')
.option('-A, --access_token <string>', 'Your access token.')
.option('-H, --https [boolean]', 'Whether to use https. Defaults to true.', true)
.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-t, --target <string>', 'Looks up a topic by ID (slug).')
.action(function (options) {
var Disqus = require('../');
var disqus = new Disqus({
logLevel: options.logLevel,
api_key: options.api_key,
api_secret: options.api_secret,
https: options.https
});
disqus.topics.follow({
target: options.target
}, function (err, result) {
if (err) {
console.error(err);
process.exit(1);
} else {
console.log(JSON.stringify(result, null, 2));
}
});
var Disqus = container.get('Disqus');
new Disqus(options).topics.follow(options, container.get('util').printCliResult);
});

@@ -73,11 +59,11 @@

-h, --help output usage information
-A, --api_key <string> Your application's public api_key.
-c, --cursor [string] Defaults to null.
-H, --https [boolean] Whether to use https. Defaults to true.
-l, --limit [number] Defaults to 25.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-o, --order [string] Defaults to "asc". Choices: asc, desc.
-s, --since_id [string] Defaults to null.
-t, --topic <string> Looks up a topic by ID (slug).
-h, --help output usage information
-c, --cursor [string] Defaults to null.
-H, --https [boolean] Whether to use https. Defaults to true.
-l, --limit [number] Defaults to 25.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-o, --order [string] Defaults to "asc". Choices: asc, desc.
-s, --since_id [string] Defaults to null.
-S, --api_secret <string> Your application's api_secret.
-t, --topic <string> Looks up a topic by ID (slug).
* ```

@@ -88,3 +74,2 @@ */

.description('Returns a list of users following a topic.')
.option('-A, --api_key <string>', 'Your applications\'s public api_key.')
.option('-c, --cursor [string]', 'Defaults to null.', null)

@@ -96,25 +81,7 @@ .option('-H, --https [boolean]', 'Whether to use https. Defaults to true.', true)

.option('-s, --since_id [string]', 'Defaults to null.', null)
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-t, --topic <string>', 'Looks up a topic by ID (slug).')
.action(function (options) {
var Disqus = require('../');
var disqus = new Disqus({
logLevel: options.logLevel,
api_key: options.api_key,
https: options.https
});
disqus.topics.listFollowers({
topic: options.topic,
since_id: options.since_id,
cursor: options.cursor,
limit: options.limit,
order: options.order
}, function (err, result) {
if (err) {
console.error(err);
process.exit(1);
} else {
console.log(JSON.stringify(result, null, 2));
}
});
var Disqus = container.get('Disqus');
new Disqus(options).topics.listFollowers(options, container.get('util').printCliResult);
});

@@ -132,8 +99,8 @@

-h, --help output usage information
-A, --api_key <string> Your application's public api_key.
-H, --https [boolean] Whether to use https. Defaults to true.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-S, --api_secret <string> Your application's api_secret.
-t, --target <string> Looks up a topic by ID (slug).
-h, --help output usage information
-A, --access_token <string> Your access token.
-H, --https [boolean] Whether to use https. Defaults to true.
-L, --logLevel [string] Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.
-S, --api_secret <string> Your application's api_secret.
-t, --target <string> Looks up a topic by ID (slug).
* ```

@@ -144,28 +111,12 @@ */

.description('Unfollow a topic.')
.option('-A, --api_key <string>', 'Your applications\'s public api_key.')
.option('-A, --access_token <string>', 'Your access token.')
.option('-H, --https [boolean]', 'Whether to use https. Defaults to true.', true)
.option('-L, --logLevel [string]', 'Output log level. Choices: debug, info, notice, warning, error, critical, alert, emergency.', 'info')
.option('-S, --api_secret <string>', 'Your applications\'s api_secret.')
.option('-S, --api_secret <string>', 'Your application\'s api_secret.')
.option('-t, --target <string>', 'Looks up a topic by ID (slug).')
.action(function (options) {
var Disqus = require('../');
var disqus = new Disqus({
logLevel: options.logLevel,
api_key: options.api_key,
api_secret: options.api_secret,
https: options.https
});
disqus.topics.unfollow({
target: options.target
}, function (err, result) {
if (err) {
console.error(err);
process.exit(1);
} else {
console.log(JSON.stringify(result, null, 2));
}
});
var Disqus = container.get('Disqus');
new Disqus(options).topics.unfollow(options, container.get('util').printCliResult);
});
module.exports = topics;

@@ -5,8 +5,3 @@ /**

*/
var Log = require('log');
var Applications = require('./api/applications');
var Blacklists = require('./api/blacklists');
var Categories = require('./api/categories');
var Exports = require('./api/exports');
var Imports = require('./api/imports');
var container = require('./container');

@@ -37,2 +32,9 @@ /**

var _this = this;
var Log = container.get('Log');
var Applications = container.get('Applications');
var Blacklists = container.get('Blacklists');
var Categories = container.get('Categories');
var Exports = container.get('Exports');
var Imports = container.get('Imports');
var Topics = container.get('Topics');

@@ -63,3 +65,3 @@ /**

* ###### api_secret
* Must be a string. Required for actions that require authentication.
* Must be a string. Required.
*/

@@ -70,2 +72,10 @@ if ('api_secret' in options && typeof options.api_secret !== 'string') {

/**
* ###### access_token
* Must be a string. Required for actions that require authentication.
*/
if ('access_token' in options && typeof options.access_token !== 'string') {
throw new Error('access_token must be a string!');
}
this.config = {

@@ -88,3 +98,3 @@ /**

this.logger = new Log(this.config.logLevel);
this.config.logger = new Log(this.config.logLevel);

@@ -98,3 +108,3 @@ /**

*/
this.applications = new Applications(this.config, this.logger);
this.applications = new Applications(this.config);
/**

@@ -104,3 +114,3 @@ * ###### Blacklists

*/
this.blacklists = new Blacklists(this.config, this.logger);
this.blacklists = new Blacklists(this.config);
/**

@@ -110,3 +120,3 @@ * ###### Categories

*/
this.categories = new Categories(this.config, this.logger);
this.categories = new Categories(this.config);
/**

@@ -116,3 +126,3 @@ * ###### Exports

*/
this.exports = new Exports(this.config, this.logger);
this.exports = new Exports(this.config);
/**

@@ -122,7 +132,18 @@ * ###### Imports

*/
this.imports = new Imports(this.config, this.logger);
this.imports = new Imports(this.config);
/**
* ###### Topics
* [API](/lib/api/topics.html) | [CLI](/lib/cli/topics.html) | [Disqus](https://disqus.com/api/docs/topics/)
*/
this.topics = new Topics(this.config);
this.logger.debug('Instantiated Disqus', JSON.stringify(this.config));
this.config.logger.debug('Instantiated Disqus', JSON.stringify(this.config, function (key, value) {
if (key === 'logger') {
return {};
} else {
return value;
}
}));
}
module.exports = Disqus;

@@ -5,3 +5,8 @@ var Promise = require('bluebird');

function parse(res) {
var json = JSON.parse(res[1]);
var json;
try {
json = JSON.parse(res[1]);
} catch (err) {
throw new Error('Failed to parse response from Disqus.');
}
if (!('code' in json) || (json.code !== '0' && json.code !== 0)) {

@@ -48,7 +53,5 @@ throw new Error(json.response);

applyOptions: applyOptions,
request: request,
executeAPIMethod: function (method, options, config, logger, cb) {
executeAPIMethod: function (method, options, config, cb) {
return Promise.resolve({})

@@ -65,3 +68,3 @@ .then(function (qs) {

};
logger.debug(JSON.stringify(opts));
config.logger.debug(JSON.stringify(opts));
return request(opts).then(parse);

@@ -68,0 +71,0 @@ }).nodeify(cb);

{
"name": "disqus-node",
"version": "0.8.0",
"version": "0.9.0",
"description": "Disqus API bindings and CLI for NodeJS http://disqus.com/api/",

@@ -36,3 +36,4 @@ "main": "./lib/index.js",

"commander": "^2.2.0",
"log": "^1.4.0"
"log": "^1.4.0",
"dependable": "^0.2.5"
},

@@ -47,4 +48,9 @@ "devDependencies": {

"load-grunt-tasks": "^0.5.0",
"grunt-contrib-clean": "^0.5.0"
"grunt-contrib-clean": "^0.5.0",
"grunt-env": "^0.4.1",
"grunt-mocha-test": "^0.11.0",
"grunt-istanbul": "^0.3.0",
"chai": "^1.9.1",
"grunt-karma-coveralls": "^2.5.1"
}
}

@@ -11,2 +11,13 @@ disqus-node

[![Build Status](https://travis-ci.org/jmdobry/disqus-node.svg?branch=master)](https://travis-ci.org/jmdobry/disqus-node)
[![Coverage Status](https://coveralls.io/repos/jmdobry/disqus-node/badge.png)](https://coveralls.io/r/jmdobry/disqus-node)
[![Code Climate](https://codeclimate.com/github/jmdobry/disqus-node.png)](https://codeclimate.com/github/jmdobry/disqus-node)
[![Dependency Status](https://gemnasium.com/jmdobry/disqus-node.svg)](https://gemnasium.com/jmdobry/disqus-node)
## Documentation
[API](http://disqus-node.pseudobry.com/lib/index.html) | [CLI](http://disqus-node.pseudobry.com/lib/cli/index.html)
## Functional

@@ -18,2 +29,3 @@ - Applications

- Imports
- Topics

@@ -24,3 +36,2 @@ ## Not Yet Implemented

- Threads
- Topics
- Trends

@@ -30,6 +41,3 @@ - Users

## Documentation
[API](http://disqus-node.pseudobry.com/lib/index.html) | [CLI](http://disqus-node.pseudobry.com/lib/cli/index.html)
## License
[Apache License Version 2.0](https://github.com/jmdobry/disqus-node/blob/master/LICENSE)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc