stackexchange
Advanced tools
Comparing version 0.0.7 to 0.1.0
@@ -10,3 +10,3 @@ 'use strict'; | ||
, site: 'stackoverflow' | ||
, version: 2.1 | ||
, version: 2.2 | ||
}); | ||
@@ -13,0 +13,0 @@ |
@@ -52,5 +52,10 @@ 'use strict'; | ||
, function response (error, res) { | ||
if (!error) parseBody.call(this, res.body, callback); | ||
if (error) { | ||
callback(error); | ||
} | ||
else { | ||
parseBody.call(this, res.body, callback); | ||
} | ||
} | ||
); | ||
}; |
'use strict'; | ||
var util = require('utile') | ||
, config = require('./config') | ||
, search = require('./methods/search') | ||
, questions = require('./methods/questions'); | ||
, config = require('./config') | ||
, search = require('./methods/search') | ||
, questions = require('./methods/questions') | ||
, users = require('./methods/users'); | ||
@@ -15,12 +16,13 @@ /** | ||
*/ | ||
module.exports = function StackExchange (options) { | ||
// Mitigate options to config. | ||
this.config = config; | ||
Object.keys(options || {}).forEach(function setConfig (key) { | ||
config.set(key, options[key]); | ||
}); | ||
module.exports = function StackExchange(options) { | ||
// Mitigate options to config. | ||
this.config = config; | ||
Object.keys(options || {}).forEach(function setConfig(key) { | ||
config.set(key, options[key]); | ||
}); | ||
// Expose methods. | ||
this.search = search; | ||
this.questions = questions; | ||
// Expose methods. | ||
this.search = search; | ||
this.questions = questions; | ||
this.users = users; | ||
}; |
{ | ||
"name": "stackexchange", | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"description": "Node.js implementation of the stackexchange/stackoverflow API", | ||
"main": "./lib/stackexchange", | ||
"scripts": { | ||
"test": "make test" | ||
"test": "NODE_ENV=test ./node_modules/.bin/mocha $(find test -name '*.test.js')" | ||
}, | ||
@@ -14,7 +14,14 @@ "repository": { | ||
"dependencies": { | ||
"nconf": "0.6.7", | ||
"request": "2.12.0", | ||
"devnull": "0.0.10", | ||
"utile": "0.1.7" | ||
"nconf": "0.6.x", | ||
"request": "2.21.x", | ||
"devnull": "0.0.x", | ||
"utile": "0.2.x" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.10.x", | ||
"chai": "1.6.x", | ||
"sinon": "1.7.x", | ||
"sinon-chai": "2.4.x", | ||
"pre-commit": "0.0.x" | ||
}, | ||
"keywords": [ | ||
@@ -21,0 +28,0 @@ "stackoverflow", |
@@ -5,1 +5,35 @@ # Stackexchange API for Node.js | ||
answers. | ||
Installation | ||
---- | ||
``` | ||
npm install stackexchange --save | ||
``` | ||
Usage | ||
---- | ||
```js | ||
var stackexchange = require('stackexchange'); | ||
var options = { version: 2.2 }; | ||
var context = new stackexchange(options); | ||
var filter = { | ||
key: 'YOUR_API_KEY', | ||
pagesize: 50, | ||
tagged: 'node.js', | ||
sort: 'activity', | ||
order: 'asc' | ||
}; | ||
// Get all the questions (http://api.stackexchange.com/docs/questions) | ||
context.questions.questions(filter, function(err, results){ | ||
if (err) throw err; | ||
console.log(results.items); | ||
console.log(results.has_more); | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7334
12
201
39
5
+ Addedasn1@0.1.11(transitive)
+ Addedassert-plus@0.1.2(transitive)
+ Addedasync@0.2.9(transitive)
+ Addedaws-sign@0.3.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedboom@0.4.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcolors@0.6.2(transitive)
+ Addedcombined-stream@0.0.7(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcookie-jar@0.3.0(transitive)
+ Addedcryptiles@0.2.2(transitive)
+ Addedctype@0.5.2(transitive)
+ Addeddelayed-stream@0.0.5(transitive)
+ Addeddevnull@0.0.12(transitive)
+ Addedforever-agent@0.5.2(transitive)
+ Addedform-data@0.0.8(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhawk@0.13.1(transitive)
+ Addedhoek@0.8.50.9.1(transitive)
+ Addedhttp-signature@0.9.11(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjson-stringify-safe@4.0.0(transitive)
+ Addedmime@1.2.11(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@0.0.10(transitive)
+ Addednconf@0.6.9(transitive)
+ Addedncp@0.4.2(transitive)
+ Addednode-uuid@1.4.8(transitive)
+ Addedoauth-sign@0.3.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedoptimist@0.6.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedqs@0.6.6(transitive)
+ Addedrequest@2.21.0(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsntp@0.2.4(transitive)
+ Addedtunnel-agent@0.3.0(transitive)
+ Addedutile@0.2.1(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedasync@0.1.22(transitive)
- Removedcolors@0.6.0-1(transitive)
- Removeddevnull@0.0.10(transitive)
- Removednconf@0.6.7(transitive)
- Removedncp@0.2.7(transitive)
- Removedoptimist@0.3.7(transitive)
- Removedpkginfo@0.2.3(transitive)
- Removedrequest@2.12.0(transitive)
- Removedrimraf@1.0.9(transitive)
- Removedutile@0.1.7(transitive)
Updateddevnull@0.0.x
Updatednconf@0.6.x
Updatedrequest@2.21.x
Updatedutile@0.2.x