Class: OmniAuth::Strategies::PopUpTalent

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/pop_up_talent.rb

Constant Summary collapse

DEFAULT_HOST =
"https://accounts.popuptalent.com"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, opts = {}) ⇒ PopUpTalent

Returns a new instance of PopUpTalent.



30
31
32
33
34
35
36
# File 'lib/omniauth/strategies/pop_up_talent.rb', line 30

def initialize(app, opts = {})
  super(app, opts[:key], opts[:secret])

  host = opts[:host] || DEFAULT_HOST
  options[:client_options][:site] = host
  options[:client_options][:token_url] = "#{host}/oauth/authorize"
end

Class Method Details

.invalidate_sessions!(opts = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/omniauth/strategies/pop_up_talent.rb', line 19

def self.invalidate_sessions!(opts = {})
  key = opts.fetch(:key)
  secret = opts.fetch(:secret)
  host = opts.fetch(:host, DEFAULT_HOST)
  token = opts.fetch(:token)

  client = ::OAuth2::Client.new(key, secret, site: host)
  access_token = ::OAuth2::AccessToken.new(client, token, mode: :query, param_name: :oauth_token)
  access_token.delete('/current_session')
end

Instance Method Details

#raw_infoObject



38
39
40
41
42
# File 'lib/omniauth/strategies/pop_up_talent.rb', line 38

def raw_info
  access_token.options[:mode] = :query
  access_token.options[:param_name] = 'oauth_token'
  @raw_info ||= access_token.get('me').parsed
end