codecombat/app/lib/LinkedInHandler.coffee

28 lines
705 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]
2014-04-25 13:46:43 -04:00
2014-04-23 14:25:36 -04:00
destroy: ->
super()