Sha256: 2bab61cd868196477cb13615a917be9dbcf964c6213c94282262d1d89c1afcf0
Contents?: true
Size: 1.15 KB
Versions: 9
Compression:
Stored size: 1.15 KB
Contents
require 'omniauth/oauth' require 'multi_json' module OmniAuth module Strategies class ThirtySevenSignals < OAuth2 def initialize(app, app_id, app_secret, options = {}) options[:site] = 'https://launchpad.37signals.com/' options[:authorize_path] = '/authorization/new' options[:access_token_path] = '/authorization/token' super(app, :thirty_seven_signals, app_id, app_secret, options) end def user_data @data ||= MultiJson.decode(@access_token.get('/authorization.json')) end def user_info { 'email' => user_data['identity']['email_address'], 'first_name' => user_data['identity']['first_name'], 'last_name' => user_data['identity']['last_name'], 'name' => [user_data['identity']['first_name'], user_data['identity']['last_name']].join(' ').strip } end def auth_hash OmniAuth::Utils.deep_merge(super, { 'uid' => user_data['identity']['id'], 'user_info' => user_info, 'extra' => { 'accounts' => user_data['accounts'] } }) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems