Class: Groovestack::Auth::Providers::OmniAuth
Constant Summary
collapse
- BASE_PATH =
'/users/auth'
Class Method Summary
collapse
available?, credential_for, enabled?, k, provider
Class Method Details
.as_json(keys = nil) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 33
def self.as_json(keys = nil)
verbose = super.merge({
required_credentials: required_credentials,
path: path,
generate_omniauth_args: generate_omniauth_args
})
return verbose if keys.nil?
verbose.slice(*keys)
end
|
17
18
19
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 17
def self.configured?
required_credentials_present?
end
|
.generate_omniauth_args ⇒ Object
21
22
23
24
25
26
27
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 21
def self.generate_omniauth_args
[
provider,
*required_credentials.map { |credential| credential_for(credential) }
]
end
|
.path ⇒ Object
29
30
31
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 29
def self.path
"#{BASE_PATH}/#{k}"
end
|
.required_credentials ⇒ Object
9
10
11
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 9
def self.required_credentials
const_defined?(:REQUIRED_CREDENTIALS) ? self::REQUIRED_CREDENTIALS : []
end
|
.required_credentials_present? ⇒ Boolean
13
14
15
|
# File 'lib/groovestack/auth/providers/omni_auth.rb', line 13
def self.required_credentials_present?
required_credentials.all? { |credential| credential_for(credential).present? }
end
|