codecombat/app/lib/LinkedInHandler.coffee

35 lines
961 B
CoffeeScript
Raw Normal View History

2014-04-23 14:25:36 -04:00
CocoClass = require 'lib/CocoClass'
{me} = require 'lib/auth'
{backboneFailure} = require 'lib/errors'
storage = require 'lib/storage'
module.exports = LinkedInHandler = class LinkedInHandler extends CocoClass
constructor: ->
super()
2014-04-25 13:46:43 -04:00
2014-04-23 14:25:36 -04:00
subscriptions:
'auth:linkedin-api-loaded': 'onLinkedInLoaded'
2014-04-25 13:46:43 -04:00
onLinkedInLoaded: (e) ->
2014-06-30 22:16:26 -04:00
IN.Event.on IN, 'auth', @onLinkedInAuth
2014-04-23 14:25:36 -04:00
2014-08-21 19:27:52 -04:00
onLinkedInAuth: (e) => #console.log 'Authorized with LinkedIn'
2014-04-25 13:46:43 -04:00
2014-04-24 20:36:07 -04:00
constructEmployerAgreementObject: (cb) =>
2014-06-30 22:16:26 -04:00
IN.API.Profile('me')
.fields(['positions', 'public-profile-url', 'id', 'first-name', 'last-name', 'email-address'])
2014-04-24 20:36:07 -04:00
.error(cb)
.result (profiles) =>
cb null, profiles.values[0]
2014-06-30 22:16:26 -04:00
getProfileData: (cb) =>
2014-06-30 22:16:26 -04:00
IN.API.Profile('me')
.fields(['formatted-name', 'educations', 'skills', 'headline', 'summary', 'positions', 'public-profile-url'])
.error(cb)
.result (profiles) =>
cb null, profiles.values[0]
2014-04-25 13:46:43 -04:00
2014-04-23 14:25:36 -04:00
destroy: ->
super()