From 582cdf4e544ee558a3efa3ec578849f32f4fa903 Mon Sep 17 00:00:00 2001 From: Sahat Yalkabov Date: Thu, 27 Feb 2014 17:29:16 -0500 Subject: [PATCH] A bunch of improvements to Linkedin API --- controllers/api.js | 35 ++++--------------- views/api/linkedin.jade | 74 ++++++++++++++++++++++++++--------------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/controllers/api.js b/controllers/api.js index c5d1209336..86b9dcb3f0 100644 --- a/controllers/api.js +++ b/controllers/api.js @@ -488,33 +488,12 @@ exports.getLinkedin = function(req, res, next) { var token = _.findWhere(req.user.tokens, { kind: 'linkedin' }); var linkedin = Linkedin.init(token.accessToken); - async.parallel({ - profile: function(done) { - 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); - res.render('api/linkedin', { - title: 'LinkedIn API', - profile: results.profile, - connections: results.connections, - companies: results.companies - }); + linkedin.people.me(function(err, $in) { + if (err) return next(err); + console.log($in.positions.values); + res.render('api/linkedin', { + title: 'LinkedIn API', + profile: $in }); + }); }; diff --git a/views/api/linkedin.jade b/views/api/linkedin.jade index a300c0fa6a..0620c98d7d 100644 --- a/views/api/linkedin.jade +++ b/views/api/linkedin.jade @@ -17,33 +17,55 @@ block content i.fa.fa-code-fork | API Endpoints - h3.text-primary My Profile + h3.text-primary My LinkedIn Profile .well.well-sm .row - .col-xs-2 - img(src='#{profile.pictureUrl}') - .col-xs-10 - h3= profile.formattedName - h4= profile.headline - span.text-muted #{profile.location.name} | #{profile.industry} + .col-sm-12 + .col-sm-2 + br + img.thumbnail(src='#{profile.pictureUrl}') + .col-sm-10 + h3= profile.formattedName + h4= profile.headline + span.text-muted #{profile.location.name} | #{profile.industry} + br .row - hr - dl.dl-horizontal - dt.text-muted Current - dd A description list is perfect for defining terms. - dt.text-muted Education - for education in profile.educations.values - dd= education.schoolName - dt.text-muted Recommendations - dd #{profile.recommendationsReceived} recommendation(s) received - dt.text-muted Connections - dd #{profile.numConnections} connections + .col-sm-12 + dl.dl-horizontal + dt.text-muted Current + 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 + 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 - .row - for connection in connections.values - .col-xs-3.col-md-2 - img(src='#{connection.pictureUrl}') - div.facebook-caption= connection.firstName - - h3 Company Information + h3.text-primary LinkedIn Connections + table.table.table-hover.table-striped.table-bordered + tbody + for connection in profile.connections.values + if connection.id != 'private' + tr + td + strong #{connection.firstName} #{connection.lastName} + .text-muted #{connection.headline}