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
|
# 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
19
20
21
|
# File 'lib/eco/api/organization/login_providers.rb', line 19
def active
select {|lp| lp != "disabled"}
end
|
#any_optional? ⇒ Boolean
23
24
25
26
27
|
# File 'lib/eco/api/organization/login_providers.rb', line 23
def any_optional?
active.any? do |lp|
lp.enabled_for = "some"
end
end
|
29
30
31
|
# File 'lib/eco/api/organization/login_providers.rb', line 29
def ids
@by_id.keys
end
|
#login_provider(id_name_type) ⇒ Object
62
63
64
|
# File 'lib/eco/api/organization/login_providers.rb', line 62
def login_provider(id_name_type)
@by_id[login_provider_id(id_name_type)]
end
|
33
34
35
|
# File 'lib/eco/api/organization/login_providers.rb', line 33
def names
@by_name.keys
end
|
#password_id ⇒ Object
15
16
17
|
# File 'lib/eco/api/organization/login_providers.rb', line 15
def password_id
to_id("password")
end
|
#to_id(name) ⇒ Object
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/eco/api/organization/login_providers.rb', line 37
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
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/eco/api/organization/login_providers.rb', line 48
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
|