New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

twitter-rest-lite

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

twitter-rest-lite - npm Package Compare versions

Comparing version 0.3.7 to 0.3.8

docs/api.html

3

gulpfile.js

@@ -89,4 +89,3 @@ 'use strict';

message: 'Updating docs'
}))
.pipe(rimraf());
}));
});

@@ -93,0 +92,0 @@

@@ -10,3 +10,3 @@ 'use strict';

module.exports.check = function check (obj, type, empty, errMsg, cb) {
var check = module.exports.check = function check (obj, type, empty, errMsg, cb) {
if (errMsg == null || typeof errMsg !== 'string' || errMsg === '') {

@@ -28,1 +28,5 @@ callError('errMsg needs to be defined', cb);

module.exports.authyThing = function authyThing (what, token, cb) {
if (!check(token, 'string', '', 'Requires a token', cb))
return cb(null, this.uri[what] + '?oauth_token=' + token);
};

@@ -61,4 +61,4 @@ 'use strict';

/* Extending `uri` with oauth URI's */
this.uri.request_token = 'https://api.twitter.com/oauth/request_token';
this.uri.access_token = 'https://api.twitter.com/oauth/access_token';
this.uri.requestToken = 'https://api.twitter.com/oauth/request_token';
this.uri.accessToken = 'https://api.twitter.com/oauth/access_token';
this.uri.authenticate = 'https://api.twitter.com/oauth/authenticate';

@@ -116,14 +116,12 @@ this.uri.authorize = 'https://api.twitter.com/oauth/authorize';

var request = require('request');
var oauth = {
consumer_key: self.opts.consumer_key,
consumer_secret: self.opts.consumer_secret
};
var oauth = {};
['consumer_key', 'consumer_secret', 'callback'].forEach(function (e) {
if (self.opts[e] != null)
oauth[e] = self.opts[e];
});
if (self.opts.callback != null) {
oauth['callback'] = self.opts.callback;
}
request({
method: 'POST',
uri: self.uri.request_token,
uri: self.uri.requestToken,
oauth: oauth

@@ -215,3 +213,3 @@ }, function (err, response, body) {

method: 'POST',
uri: self.uri.access_token,
uri: self.uri.accessToken,
oauth: oauth

@@ -259,6 +257,3 @@ }, function(err, response, body) {

OAuth.prototype.authenticate = function(token, cb) {
var self = this;
helper.check(token, 'string','','Requires a token', cb);
return cb(null, self.uri.authenticate + '?oauth_token=' + token);
helper.authyThing.call(this, 'authenticate', token, cb);
};

@@ -295,8 +290,5 @@

OAuth.prototype.authorize = function(token, cb) {
var self = this;
helper.check(token, 'string', '', 'Requires a token', cb);
return cb(null, self.uri.authorize + '?oauth_token=' + token);
helper.authyThing.call(this, 'authorize', token, cb);
};
module.exports = OAuth;
{
"name": "twitter-rest-lite",
"version": "0.3.7",
"version": "0.3.8",
"description": "Twitter's REST API Lite",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -60,2 +60,10 @@ /* global describe,it */

it('on errors it should return true', function (done) {
function cb (err) {
should.exist(err);
}
if (h.check('', 'string', '', 'Send error', cb))
done();
});
it('should pass clean if obj exists', function () {

@@ -76,4 +84,29 @@ try {

});
});
describe('authyThing', function () {
it('should exist and be a function', function () {
should.exist(h.authyThing);
(typeof(h.authyThing)).should.equal('function');
});
it('should print a token url', function (done) {
var a = {
uri: {
anything: 'random'
}
};
h.authyThing.call(a, 'anything', 'token', function (err, res) {
should.not.exist(err);
should.exist(res);
res.should.equal('random?oauth_token=token');
done();
});
});
});
});

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