Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some fixes

  • Loading branch information...
commit ae79178a6208425bae6398b370de9a80edd0a7db 1 parent 43e5df6
@danzajdband authored
Showing with 15 additions and 6 deletions.
  1. +10 −3 lib/request.js
  2. +5 −3 lib/tuiter.js
View
13 lib/request.js
@@ -39,7 +39,6 @@ Stream.prototype.destroy = function(){
exports.oauth = function(params){
// defaults
-
params.consumer_key = params.consumer_key || null;
params.consumer_secret = params.consumer_secret || null;
params.callback_url = params.callback_url || "http://localhost:3000/oauth/callback";
@@ -51,6 +50,13 @@ exports.oauth = function(params){
, config.oauth.version
, null
, config.oauth.method
+ , null
+ , {
+ 'Accept': '*/*'
+ , 'User-Agent': 'Tuiter'
+ , 'Accept-Encoding': 'deflate, gzip'
+
+ }
);
this.oa.access_token_key = params.access_token_key;
@@ -65,15 +71,16 @@ exports.oauth = function(params){
* @param {Function} callback: callback funcion
*/
-Tuiter.prototype.request = function(method, url, params, is_stream, callback) {
+exports.request = function(method, url, params, is_stream, callback) {
request(method, url)
.sign(this.oa, this.oa.access_token_key, this.oa.access_token_secret)
.buffer(is_stream)
.send(params)
.set('Accept', '*/*')
- .set('User-Agent', 'Tuiter v' + Tuiter.version)
+ .set('User-Agent', 'Tuiter')
.set('Accept-Encoding', 'deflate, gzip')
.end(function(res){
+ console.log('a');
if(res.ok) callback(null, res.body);
else callback(res.text, res.body);
});
View
8 lib/tuiter.js
@@ -29,7 +29,7 @@ Tuiter.version = '0.1.5';
module.exports = function(oauth_params){
if(oauth_params) return new Tuiter(oauth_params);
- else return new Error('Please provide Twitter API credentials');
+ else return Tuiter;
};
/*
@@ -45,7 +45,7 @@ Object.keys(rest).forEach(function(key){
}
params = params || {};
method = utils.preprocess(method, params);
- this.request(rest[key].method, method, params, false, callback);
+ request.request.call(this, rest[key].method, method, params, false, callback);
return this;
};
});
@@ -63,7 +63,9 @@ Object.keys(streaming).forEach(function(key){
}
params = params || {};
method = utils.preprocess(method, params);
- this.request(streaming[key].method, method, params, true, callback);
+ request.request.call(this, streaming[key].method, method, params, true, callback);
return this;
};
});
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.