Class: Aspera::Secret::Store::Factory
- Inherits:
-
Object
- Object
- Aspera::Secret::Store::Factory
- Defined in:
- lib/aspera/secret/store/factory.rb
Overview
Creates stores of secrets from their parameters: type, and parameters of the class of type (PARAMETERS).
Types: file, vault, system (macOS), secret_service (Linux), 1password (source: api or cli), keeper, and types added with register_type.
Class Method Summary collapse
-
.check(params) ⇒ Object
Checks the type and the names of parameters, without creating the store.
-
.create(params) ⇒ Base
New store.
-
.register_type(name, klass) ⇒ Object
Add a type of store, e.g.
-
.types ⇒ Array<String>
Names of types.
Class Method Details
.check(params) ⇒ Object
Checks the type and the names of parameters, without creating the store
41 42 43 44 |
# File 'lib/aspera/secret/store/factory.rb', line 41 def check(params) checked(params) nil end |
.create(params) ⇒ Base
Returns New store.
49 50 51 52 |
# File 'lib/aspera/secret/store/factory.rb', line 49 def create(params) klass, params = checked(params) klass.new(**klass.arguments(params)) end |
.register_type(name, klass) ⇒ Object
Add a type of store, e.g. from the host application
27 28 29 30 31 |
# File 'lib/aspera/secret/store/factory.rb', line 27 def register_type(name, klass) Aspera.assert(klass.is_a?(Class) && klass <= Base) { "#{klass} shall be a subclass of #{Base}" } @types[name.to_s] = klass nil end |
.types ⇒ Array<String>
Returns Names of types.
34 35 36 |
# File 'lib/aspera/secret/store/factory.rb', line 34 def types (BUILTIN_TYPES + @types.keys).uniq end |