linkedin-js
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -25,3 +25,4 @@ var url = require('url') | ||
} | ||
, paramAppender = "?" | ||
, hasParameters = /\/*\?/i | ||
, _rest_base = 'http://api.linkedin.com/v1'; | ||
@@ -62,5 +63,9 @@ | ||
params.format = 'json'; | ||
if (path.match(hasParameters)) { | ||
paramAppender = "&"; | ||
} | ||
return CLIENT.oauth.get( | ||
_rest_base + path + '?' + querystring.stringify(params) | ||
_rest_base + path + paramAppender + querystring.stringify(params) | ||
, token.oauth_token | ||
@@ -67,0 +72,0 @@ , token.oauth_token_secret |
{ | ||
"name": "linkedin-js", | ||
"description": "Minimalistic linkedin API client", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"author": "Pau Ramon <masylum@gmail.com>", | ||
@@ -6,0 +6,0 @@ "keywords": ["linkedin"], |
@@ -27,4 +27,4 @@ # linkedin-js | ||
, app = express.createServer( | ||
express.cookieDecoder() | ||
, express.session() | ||
express.cookieParser() | ||
, express.session({ secret: "string" }) | ||
); | ||
@@ -36,2 +36,4 @@ | ||
// will enter here when coming back from linkedin | ||
req.session.token = token; | ||
res.render('auth'); | ||
@@ -45,4 +47,4 @@ }); | ||
token: { | ||
oauth_token_secret: req.param('oauth_token_secret') | ||
, oauth_token: req.param('oauth_token') | ||
oauth_token_secret: req.session.token.oauth_token_secret | ||
, oauth_token: req.session.token.oauth_token | ||
} | ||
@@ -49,0 +51,0 @@ , share: { |
@@ -55,3 +55,21 @@ var testosterone = require('testosterone')({title: 'models/linkedin'}) | ||
}) | ||
.add('`apiCall` GET', function (done) { | ||
var callback; | ||
gently.expect(linkedin_client.oauth, 'get', function (_path, _token, _secret, _callback) { | ||
assert.equal(_path, 'http://api.linkedin.com/v1/people-search?keywords=linkedin&format=json'); | ||
assert.equal(_token, token.oauth_token); | ||
assert.equal(_secret, token.oauth_token_secret); | ||
assert.equal(_callback, callback); | ||
_callback(); | ||
}); | ||
callback = gently.expect(function (error, response, body) { | ||
done(); | ||
}); | ||
linkedin_client.apiCall('GET', '/people-search?keywords=linkedin', {token: token}, callback); | ||
}) | ||
.run(); |
8751
185
69