Class: Eco::API::Organization::LoginProviders
Constant Summary
Language::Models::Collection::BASIC_METHODS, Language::Models::Collection::EXTENDED_METHODS
Instance Method Summary
collapse
#<, #<<, #attr, #attr?, attr_collection, attr_presence, #attrs, attrs_create_method, #contains, #delete!, #each, #empty, #empty?, #exclude, #group_by, #length, #merge, #new, #newFrom, #present, #present_all?, #present_some?, #remove, #to_c, #to_h, #unique_attrs, #update
Constructor Details
#initialize(login_providers = [], klass: Ecoportal::API::Internal::LoginProvider, factory: nil) ⇒ LoginProviders
Returns a new instance of LoginProviders.
8
9
10
11
12
13
14
15
|
# File 'lib/eco/api/organization/login_providers.rb', line 8
def initialize(login_providers = [], klass: Ecoportal::API::Internal::LoginProvider, factory: nil)
@klass = Ecoportal::API::Internal::LoginProvider
@caches_init = false
super(login_providers, klass: @klass)
init_caches
end
|
Instance Method Details
21
22
23
|
# File 'lib/eco/api/organization/login_providers.rb', line 21
def active
select {|lp| lp != "disabled"}
end
|
#any_optional? ⇒ Boolean
25
26
27
28
29
|
# File 'lib/eco/api/organization/login_providers.rb', line 25
def any_optional?
active.any? do |lp|
lp.enabled_for = "some"
end
end
|
31
32
33
|
# File 'lib/eco/api/organization/login_providers.rb', line 31
def ids
@by_id.keys
end
|
#login_provider(id_name_type) ⇒ Object
64
65
66
|
# File 'lib/eco/api/organization/login_providers.rb', line 64
def login_provider(id_name_type)
@by_id[login_provider_id(id_name_type)]
end
|
35
36
37
|
# File 'lib/eco/api/organization/login_providers.rb', line 35
def names
@by_name.keys
end
|
#password_id ⇒ Object
17
18
19
|
# File 'lib/eco/api/organization/login_providers.rb', line 17
def password_id
to_id("password")
end
|
#to_id(name) ⇒ Object
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/eco/api/organization/login_providers.rb', line 39
def to_id(name)
case name
when Enumerable
name.map do |n|
login_provider(n)&.id
end.compact
else
login_provider(name)&.id
end
end
|
#to_name(id) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/eco/api/organization/login_providers.rb', line 50
def to_name(id)
case name
when Enumerable
id.map do |i|
login_provider(i)&.name
end.compact
else
login_provider(id)&.name
end
end
|