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({
profile: function(done) {
linkedin.people.me(function(err, $in) { linkedin.people.me(function(err, $in) {
console.log($in);
done(err, $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); if (err) return next(err);
console.log($in.positions.values);
res.render('api/linkedin', { res.render('api/linkedin', {
title: 'LinkedIn API', title: 'LinkedIn API',
profile: results.profile, profile: $in
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
img.thumbnail(src='#{profile.pictureUrl}')
.col-sm-10
h3= profile.formattedName h3= profile.formattedName
h4= profile.headline h4= profile.headline
span.text-muted #{profile.location.name} | #{profile.industry} 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
if company.isCurrent
dd
strong= company.title
| at
strong #{company.company.name}
dt.text-muted Previous
for company in profile.positions.values
if !company.isCurrent
dd
| #{company.title}
| at
| #{company.company.name}
dt.text-muted Education dt.text-muted Education
for education in profile.educations.values for education in profile.educations.values
dd= education.schoolName dd= education.schoolName
dt.text-muted Recommendations dt.text-muted Recommendations
dd #{profile.recommendationsReceived} recommendation(s) received dd
strong #{profile.numRecommenders}
| recommendation(s) received
dt.text-muted Connections dt.text-muted Connections
dd #{profile.numConnections} 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}