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.4 to 0.3.5

.jshintrc

7

index.js

@@ -10,5 +10,4 @@ // twitter-rest-lite

var API = require('./lib/api'),
OAuth = require('./lib/oauth'),
uri;
var API = require('./lib/api');
var OAuth = require('./lib/oauth');

@@ -71,3 +70,3 @@ //

//
uri = {
var uri = {
base: 'https://api.twitter.com/1.1',

@@ -74,0 +73,0 @@ search: 'https://api.twitter.com/1.1/search'

@@ -0,1 +1,3 @@

'use strict';
//

@@ -27,4 +29,3 @@ // Module: API

// #### Code
var API,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
var API;

@@ -57,14 +58,10 @@ module.exports = API = (function() {

/* checking the required arguments */
['consumer_key', 'consumer_secret', 'token', 'token_secret'].forEach(function (item, index) {
['consumer_key', 'consumer_secret', 'token', 'token_secret'].forEach(function (item) {
if (opts[item] == null)
throw new Error("There's a required argument missing: " + item);
throw new Error('There\'s a required argument missing: ' + item);
});
this.opts = opts;
}
/* bindings */
this.get = __bind(this.get, this);
this.post = __bind(this.post, this);
};
//

@@ -101,4 +98,4 @@ // <a name='get'></a>

API.prototype.get = function(url, params, callback) {
var self = this,
request = require('request');
var self = this;
var request = require('request');

@@ -156,5 +153,5 @@ url = self.uri.base + url;

API.prototype.post = function(url, data, callback) {
var self = this,
request = require('request'),
body = null;
var self = this;
var request = require('request');
var body = null;

@@ -161,0 +158,0 @@ url = self.uri.base + url;

@@ -0,1 +1,3 @@

'use strict';
//

@@ -37,4 +39,3 @@ // Module: OAuth

// #### Code
var OAuth,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
var OAuth;

@@ -72,16 +73,10 @@ module.exports = OAuth = (function() {

/* checking the required arguments */
['consumer_key', 'consumer_secret'].forEach(function (item, index) {
['consumer_key', 'consumer_secret'].forEach(function (item) {
if (opts[item] == null)
throw new Error("There's a required argument missing: " + item);
throw new Error('There\'s a required argument missing: ' + item);
});
this.opts = opts;
}
/* bindings */
this.requestToken = __bind(this.requestToken, this);
this.accessToken = __bind(this.accessToken, this);
this.authenticate = __bind(this.authenticate, this);
this.authorize = __bind(this.authorize, this);
};
//

@@ -125,8 +120,8 @@ // <a name='requestToken'></a>

OAuth.prototype.requestToken = function(callback) {
var self = this,
request = require('request'),
oauth = {
consumer_key: self.opts.consumer_key,
consumer_secret: self.opts.consumer_secret
};
var self = this;
var request = require('request');
var oauth = {
consumer_key: self.opts.consumer_key,
consumer_secret: self.opts.consumer_secret
};

@@ -145,3 +140,3 @@ if (self.opts.callback != null) {

if (response.statusCode != 200) {
if (response.statusCode !== 200) {
return callback(new Error(

@@ -207,4 +202,4 @@ 'Twitter:OAuth.requestToken received an status differente than 200: \n' +

OAuth.prototype.accessToken = function(token, verifier, callback) {
var self = this,
request = require('request');
var self = this;
var request = require('request');

@@ -281,3 +276,3 @@ [token, verifier].forEach(function (item) {

null,
self.uri.authenticate + "?oauth_token=" + token
self.uri.authenticate + '?oauth_token=' + token
);

@@ -326,3 +321,3 @@

null,
self.uri.authorize + "?oauth_token=" + token
self.uri.authorize + '?oauth_token=' + token
);

@@ -329,0 +324,0 @@ };

{
"name": "twitter-rest-lite",
"version": "0.3.4",
"version": "0.3.5",
"description": "Twitter's REST API Lite",

@@ -26,3 +26,4 @@ "main": "index.js",

"should": "~3.1.0",
"express": "~3.4.8"
"express": "~3.4.8",
"optional": "~0.1.0-2"
},

@@ -29,0 +30,0 @@ "engines": {

@@ -1,2 +0,2 @@

twitter-rest-lite
twitter-rest-lite [![Build Status](https://secure.travis-ci.org/ghostbar/twitter-rest-lite.png)](http://travis.ci.org/ghostbar/twitter-rest-lite)
=================

@@ -13,3 +13,3 @@

In order to get testing done, first create the file `test/config.json` with the following format:
In order to get full testing done (with `make test-all`), first create the file `test/config.json` with the following format:

@@ -28,3 +28,3 @@ ```js

npm test
make test-all

@@ -31,0 +31,0 @@ Known Issues

@@ -1,5 +0,11 @@

var Twitter = require('../index'),
config = require('./config.json'),
should = require('should');
/* global describe */
/* global it */
'use strict';
var Twitter = require('../index');
var optional = require('optional');
var optConfig = {consumer_key: 'random', consumer_secret: 'random', token: 'random', token_secret: 'random'};
var config = optional('./config.json') || optConfig;
var should = require('should');
describe('Twitter.API Functions:', function() {

@@ -10,35 +16,9 @@ describe('API loading', function() {

api.should.be.an.instanceOf(Object);
});
});
should.exist(api.get);
describe('API.get()', function() {
it('should request an user timeline', function(done) {
var api = new Twitter.API(config);
should.exist(api.post);
api.get('/statuses/user_timeline.json', {screen_name: 'ghostbar', count: 1}, function(err, response) {
should.not.exist(err);
should.exist(response);
done();
});
api.should.be.an.instanceOf(Object);
});
});
describe('API.post()', function() {
it('should send a new tweet', function(done) {
this.timeout(40000);
var api = new Twitter.API(config);
api.post('/statuses/update.json', {status: "This is a test 123."}, function(err, response) {
should.not.exist(err);
should.exist(response);
done();
});
});
});
});

@@ -1,7 +0,13 @@

var Twitter = require('../index'),
config = require('./config.json'),
should = require('should');
/* global describe */
/* global it */
'use strict';
describe('Twitter.OAuth Functions:', function() {
describe('OAuth loading', function() {
var Twitter = require('../index');
var optional = require('optional');
var optConfig = {consumer_key: 'random', consumer_secret: 'random', token: 'random', token_secret: 'random'};
var config = optional('./config.json') || optConfig;
var should = require('should');
describe('Twitter.OAuth Functions:', function () {
describe('OAuth loading', function () {
it('should create the Object', function() {

@@ -14,7 +20,7 @@ var oauth = new Twitter.OAuth(config);

describe('OAuth.proto.requestToken():', function() {
it('should request a token', function(done) {
describe('OAuth.proto.authenticate():', function () {
it('should get an authenticate URL', function (done) {
var oauth = new Twitter.OAuth(config);
oauth.requestToken(function(err, response) {
oauth.authenticate(config.token, function (err, response) {
should.not.exist(err);

@@ -24,3 +30,3 @@

response.should.be.an.instanceOf(Object);
response.should.equal('https://api.twitter.com/oauth/authenticate?oauth_token=' + config.token);

@@ -32,14 +38,7 @@ done();

describe('OAuth.proto.accessToken():', function() {
it('should request an access_token', function(done) {
console.log('\nTODO: NEEDS TO BE IMPLEMENTED!');
done();
});
});
describe('OAuth.proto.authenticate():', function() {
it('should get an authenticate URL', function(done) {
describe('OAuth.proto.authorize():', function () {
it('should get an authorize URL', function (done) {
var oauth = new Twitter.OAuth(config);
oauth.authenticate(config.token, function(err, response) {
oauth.authorize(config.token, function (err, response) {
should.not.exist(err);

@@ -49,3 +48,3 @@

response.should.equal("https://api.twitter.com/oauth/authenticate?oauth_token=" + config.token);
response.should.equal('https://api.twitter.com/oauth/authorize?oauth_token=' + config.token);

@@ -57,18 +56,2 @@ done();

describe('OAuth.proto.authorize():', function() {
it('should get an authorize URL', function(done) {
var oauth = new Twitter.OAuth(config);
oauth.authorize(config.token, function(err, response) {
should.not.exist(err);
should.exist(response);
response.should.equal("https://api.twitter.com/oauth/authorize?oauth_token=" + config.token);
done();
});
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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