A bunch of improvements to Linkedin API

This commit is contained in:
Sahat Yalkabov
2014-02-27 17:29:16 -05:00
parent c3320f28f2
commit 582cdf4e54
2 changed files with 55 additions and 54 deletions

View File

@ -488,33 +488,12 @@ exports.getLinkedin = function(req, res, next) {
var token = _.findWhere(req.user.tokens, { kind: 'linkedin' }); var token = _.findWhere(req.user.tokens, { kind: 'linkedin' });
var linkedin = Linkedin.init(token.accessToken); var linkedin = Linkedin.init(token.accessToken);
async.parallel({ linkedin.people.me(function(err, $in) {
profile: function(done) { if (err) return next(err);
linkedin.people.me(function(err, $in) { console.log($in.positions.values);
console.log($in); res.render('api/linkedin', {
done(err, $in); title: 'LinkedIn API',
}); profile: $in
},
connections: function(done) {
linkedin.connections.retrieve(function(err, $in) {
// console.log($in);
done(err, $in);
});
},
companies: function(done) {
linkedin.companies.company('http://www.linkedin.com/company/continuum-analytics-inc-', function(err, $in) {
console.log($in);
done(err, $in);
});
}
},
function(err, results) {
if (err) return next(err);
res.render('api/linkedin', {
title: 'LinkedIn API',
profile: results.profile,
connections: results.connections,
companies: results.companies
});
}); });
});
}; };

View File

@ -17,33 +17,55 @@ block content
i.fa.fa-code-fork i.fa.fa-code-fork
| API Endpoints | API Endpoints
h3.text-primary My Profile h3.text-primary My LinkedIn Profile
.well.well-sm .well.well-sm
.row .row
.col-xs-2 .col-sm-12
img(src='#{profile.pictureUrl}') .col-sm-2
.col-xs-10 br
h3= profile.formattedName img.thumbnail(src='#{profile.pictureUrl}')
h4= profile.headline .col-sm-10
span.text-muted #{profile.location.name} | #{profile.industry} h3= profile.formattedName
h4= profile.headline
span.text-muted #{profile.location.name} | #{profile.industry}
br
.row .row
hr .col-sm-12
dl.dl-horizontal dl.dl-horizontal
dt.text-muted Current dt.text-muted Current
dd A description list is perfect for defining terms. for company in profile.positions.values
dt.text-muted Education if company.isCurrent
for education in profile.educations.values dd
dd= education.schoolName strong= company.title
dt.text-muted Recommendations | at
dd #{profile.recommendationsReceived} recommendation(s) received strong #{company.company.name}
dt.text-muted Connections dt.text-muted Previous
dd #{profile.numConnections} connections for company in profile.positions.values
if !company.isCurrent
dd
| #{company.title}
| at
| #{company.company.name}
dt.text-muted Education
for education in profile.educations.values
dd= education.schoolName
dt.text-muted Recommendations
dd
strong #{profile.numRecommenders}
| recommendation(s) received
dt.text-muted Connections
dd
strong #{profile.numConnections}
| connections
.text-center
small.text-muted= profile.publicProfileUrl
h3 Connections h3.text-primary LinkedIn Connections
.row table.table.table-hover.table-striped.table-bordered
for connection in connections.values tbody
.col-xs-3.col-md-2 for connection in profile.connections.values
img(src='#{connection.pictureUrl}') if connection.id != 'private'
div.facebook-caption= connection.firstName tr
td
h3 Company Information strong #{connection.firstName} #{connection.lastName}
.text-muted #{connection.headline}