Socket
Socket
Sign inDemoInstall

chirp-rest

Package Overview
Dependencies
52
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 1.0.0

10

example.js

@@ -15,3 +15,3 @@ var ChirpRest = require('./');

//get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, body) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
console.log(err);

@@ -24,3 +24,3 @@ console.log(body.length);

count: 5
}, function(err, res, body) {
}, function(err, body) {
console.log(err);

@@ -31,3 +31,3 @@ console.log(body.length);

//get user timeline count = 10
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json?count=10', function(err, res, body) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json?count=10', function(err, body) {
console.log(err);

@@ -40,3 +40,3 @@ console.log(body.length);

status: 'Ladies!'
}, function(err, res, body) {
}, function(err, body) {
console.log(err);

@@ -46,3 +46,3 @@ console.log(body);

//delete
twitter.post('https://api.twitter.com/1.1/statuses/destroy/' + body.id + '.json', function(err, res, body) {
twitter.post('https://api.twitter.com/1.1/statuses/destroy/' + body.id + '.json', function(err, body) {
console.log(err);

@@ -49,0 +49,0 @@ console.log(body);

@@ -30,9 +30,2 @@ var qs = require('querystring');

/**
* debug
*
* @api private
*/
ChirpRest.prototype._log = debug;
ChirpRest.prototype.get = function(url, param, callback) {

@@ -52,3 +45,3 @@ if(arguments.length === 2) {

this._log('#get', url, param);
debug('#get', url, param);

@@ -59,3 +52,17 @@ this.oauth.get({

json: true
}, callback);
}, function(err, res, body) {
if(err) {
debug('#get request err', err);
return callback(err);
}
if(res.statusCode != 200) {
debug('#get twitter err', body);
return callback(body);
}
debug('#get success');
return callback(null, body);
});
};

@@ -79,3 +86,3 @@

this._log('#post', url, param);
debug('#post', url, param);

@@ -86,3 +93,17 @@ this.oauth.post({

json: true
}, callback);
}, function(err, res, body) {
if(err) {
debug('#post request err', err);
return callback(err);
}
if(res.statusCode != 200) {
debug('#post twitter err', body);
return callback(body);
}
debug('#post success');
return callback(null, body);
});
};
{
"name": "chirp-rest",
"version": "0.0.2",
"version": "1.0.0",
"description": "twitter rest apis in nodejs",

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

"dependencies": {
"debug": "^0.8.1",
"debug": "^1.0.0",
"oauth-request": "0.0.1"

@@ -29,0 +29,0 @@ },

@@ -35,3 +35,3 @@ chirp-rest [![Build Status](https://travis-ci.org/ddo/chirp-rest.svg)](https://travis-ci.org/ddo/chirp-rest)

//get user timeline
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, body) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
//body -> tweets

@@ -46,3 +46,3 @@ });

```js
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, body) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
//body -> tweets

@@ -57,3 +57,3 @@ });

count: 5
}, function(err, res, body) {
}, function(err, body) {
//body -> tweets

@@ -66,3 +66,3 @@ });

```js
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, body) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, body) {
//body -> tweets

@@ -77,3 +77,3 @@ });

status: 'chirp chirp'
}, function(err, res, body) {
}, function(err, body) {
//body -> tweet data

@@ -80,0 +80,0 @@ });

@@ -20,3 +20,3 @@ var expect = require('chai').expect;

twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, res, tweets) {
twitter.get('https://api.twitter.com/1.1/statuses/user_timeline.json', function(err, tweets) {

@@ -36,3 +36,3 @@ expect(tweets).to.be.an('array').that.have.length(20);

count: 5
}, function(err, res, tweets) {
}, function(err, tweets) {

@@ -55,3 +55,3 @@ expect(tweets).to.be.an('array').that.have.length(5);

status: message
}, function(err, res, tweet) {
}, function(err, tweet) {
tweet_id = tweet.id_str;

@@ -70,3 +70,3 @@

twitter.post('https://api.twitter.com/1.1/statuses/destroy/' + tweet_id + '.json', function(err, res, tweet) {
twitter.post('https://api.twitter.com/1.1/statuses/destroy/' + tweet_id + '.json', function(err, tweet) {
expect(tweet).to.have.property('id');

@@ -73,0 +73,0 @@ expect(tweet).to.have.property('created_at');

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc