Sha256: 6fad0f612fcb0ccf468eb6d9243e9fcb34eba8ce124d24878b5c876daae785bc
Contents?: true
Size: 1.74 KB
Versions: 3
Compression:
Stored size: 1.74 KB
Contents
require 'omniauth/oauth' require 'multi_json' module OmniAuth module Strategies # Authenticate to AngelList utilizing OAuth 2.0 and retrieve # basic user information. # # @example Basic Usage # use OmniAuth::Strategies::AngelList, 'API Key', 'Secret Key' class AngelList < OmniAuth::Strategies::OAuth2 # @param [Rack Application] app standard middleware application parameter # @param [String] client_id the application id as [registered on AngelList](http://angel.co/api/oauth/faq) # @param [String] client_secret the application secret as [registered on AngelList](http://bit.ly/api/oauth/faq ) def initialize(app, client_id=nil, client_secret=nil, options={}, &block) client_options = { :site => 'https://api.angel.co/', :authorize_url => 'https://angel.co/api/oauth/authorize', :token_url => 'https://angel.co/api/oauth/token' } super(app, :angellist, client_id, client_secret, client_options, options, &block) end def auth_hash OmniAuth::Utils.deep_merge( super, { 'uid' => user_data['id'], 'user_info' => user_info, 'extra' => { 'user_hash' => user_data, } } ) end def user_info { 'name' => user_data['name'], 'bio' => user_data['bio'], 'image' => user_data['image'], 'urls' => { 'AngelList' => user_data['angellist_url'], 'Website' => user_data['online_bio_url'] }, } end def user_data @data ||= begin @access_token.options[:mode] = :query @access_token.get('/1/me').parsed end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
oa-oauth-0.3.2 | lib/omniauth/strategies/oauth2/angellist.rb |
oa-oauth-0.3.0 | lib/omniauth/strategies/oauth2/angellist.rb |
oa-oauth-0.3.0.rc3 | lib/omniauth/strategies/oauth2/angellist.rb |