Skip to content
Browse files

0.0.2, improved npm and docs

  • Loading branch information...
1 parent 07b8128 commit 5d9500a15e8964e83ad10644547050e716af7f2f @masylum committed Nov 7, 2010
Showing with 16 additions and 8 deletions.
  1. +9 −1 Readme.md
  2. +1 −1 index.js
  3. +3 −4 lib/twitter_client.js
  4. +3 −2 package.json
View
10 Readme.md
@@ -11,11 +11,19 @@ twitter-js has two methods.
* getAccesToken(_req_, _res_, _callback_): Uses oAuth module to retrieve the access_token
* apiCall(_http_method_, _path_, _params_, _callback_): Does a call to twitter API.
+Params must contain the token.
+
## Example using express.js
+ // You need sessions
+ app.configure(function () {
+ app.use(connect.cookieDecoder());
+ app.use(connect.session());
+ });
+
app.post('/tweet/:message', function (req, res) {
var self = this,
- twitterClient = require('twitter-js').twitterClient('consumerKey', 'consumerSecret');
+ twitterClient = require('twitter-js')('consumerKey', 'consumerSecret');
twitterClient.getAccessToken(req, res, function (error, token) {
twitterClient.apiCall('POST', '/statuses/update.json',
View
2 index.js
@@ -1 +1 @@
-module.exports.twitterClient = require('./lib/twitter_client');
+module.exports = require('./lib/twitter_client');
View
7 lib/twitter_client.js
@@ -12,9 +12,8 @@ var url = require("url"),
OAuth = require('oauth').OAuth,
querystring = require("querystring");
-
-module.exports = function (api_key, api_secret) {
- var client = {version: '0.0.1'},
+module.exports = function (api_key, api_secret, redirect) {
+ var client = {version: '0.0.2'},
// PRIVATE
oAuth = new OAuth(
@@ -23,7 +22,7 @@ module.exports = function (api_key, api_secret) {
api_key,
api_secret,
'1.0',
- 'http://zpeaker.com:3000/auth/twitter/',
+ redirect,
'HMAC-SHA1',
null,
{'Accept': '*/*', 'Connection': 'close', 'User-Agent': 'twitter-js ' + client.version}
View
5 package.json
@@ -1,11 +1,12 @@
{
"name": "twitter-js",
"description": "easy peasy twitter client",
- "version": "0.0.1",
+ "version": "0.0.2",
"author": "Pau Ramon <masylum@gmail.com>",
"keywords": ["twitter"],
+ "main" : "lib/twitter_client.js",
+ "directories" : { "lib" : "./lib" },
"dependencies": { "oauth": ">= 0.8.2" },
"repository" : {"type": "git" , "url": "http://github.com/masylum/twitter-js.git" },
"engines": { "node": ">= 0.2.0" }
}
-

0 comments on commit 5d9500a

Please sign in to comment.
Something went wrong with that request. Please try again.