Class: OpenC3::SecretModel
- Defined in:
- lib/openc3/models/secret_model.rb
Constant Summary collapse
- PRIMARY_KEY =
'openc3__secrets'
Instance Attribute Summary
Attributes inherited from Model
#name, #plugin, #scope, #updated_at
Class Method Summary collapse
- .all(scope:) ⇒ Object
-
.get(name:, scope:) ⇒ Object
NOTE: The following three class methods are used by the ModelController and are reimplemented to enable various Model class methods to work.
- .names(scope:) ⇒ Object
Instance Method Summary collapse
-
#as_json(*a) ⇒ Hash
JSON encoding of this model.
-
#initialize(name:, value:, scope:) ⇒ SecretModel
constructor
END NOTE.
Methods inherited from Model
#check_disable_erb, #create, #deploy, #destroy, #destroyed?, #diff, filter, find_all_by_plugin, from_json, get_all_models, get_model, handle_config, set, store, store_queued, #undeploy, #update
Constructor Details
#initialize(name:, value:, scope:) ⇒ SecretModel
END NOTE
35 36 37 38 |
# File 'lib/openc3/models/secret_model.rb', line 35 def initialize(name:, value:, scope:) super("#{scope}__#{PRIMARY_KEY}", name: name, scope: scope) @value = value end |
Class Method Details
.all(scope:) ⇒ Object
30 31 32 |
# File 'lib/openc3/models/secret_model.rb', line 30 def self.all(scope:) super("#{scope}__#{PRIMARY_KEY}") end |
.get(name:, scope:) ⇒ Object
NOTE: The following three class methods are used by the ModelController and are reimplemented to enable various Model class methods to work
22 23 24 |
# File 'lib/openc3/models/secret_model.rb', line 22 def self.get(name:, scope:) super("#{scope}__#{PRIMARY_KEY}", name: name) end |
.names(scope:) ⇒ Object
26 27 28 |
# File 'lib/openc3/models/secret_model.rb', line 26 def self.names(scope:) super("#{scope}__#{PRIMARY_KEY}") end |
Instance Method Details
#as_json(*a) ⇒ Hash
Returns JSON encoding of this model.
41 42 43 44 45 46 |
# File 'lib/openc3/models/secret_model.rb', line 41 def as_json(*a) { 'name' => @name, 'value' => @value.as_json(*a), } end |