codecombat/app/lib/LinkedInHandler.coffee

35 lines
946 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:
2014-04-25 13:46:43 -04:00
'linkedin-loaded': 'onLinkedInLoaded'
onLinkedInLoaded: (e) ->
2014-04-23 14:25:36 -04:00
IN.Event.on IN, "auth", @onLinkedInAuth
2014-04-25 10:48:59 -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) =>
IN.API.Profile("me")
.fields(["positions","public-profile-url","id","first-name","last-name","email-address"])
.error(cb)
.result (profiles) =>
cb null, profiles.values[0]
getProfileData: (cb) =>
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()