Class: OpenC3::MigrationModel

Inherits:
Model show all
Defined in:
lib/openc3/models/migration_model.rb

Constant Summary collapse

PRIMARY_KEY =
'openc3__migrations'

Instance Attribute Summary

Attributes inherited from Model

#name, #plugin, #scope, #updated_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#check_disable_erb, #create, #deploy, #destroy, #destroyed?, filter, find_all_by_plugin, from_json, get_all_models, get_model, handle_config, set, store, store_queued, #undeploy, #update

Constructor Details

#initialize(name:) ⇒ MigrationModel

END NOTE



40
41
42
# File 'lib/openc3/models/migration_model.rb', line 40

def initialize(name:)
  super(PRIMARY_KEY, name: name)
end

Class Method Details

.all(scope: nil) ⇒ Object



35
36
37
# File 'lib/openc3/models/migration_model.rb', line 35

def self.all(scope: nil)
  super(PRIMARY_KEY)
end

.get(name:, scope: nil) ⇒ Object

NOTE: The following three class methods are used by the ModelController and are reimplemented to enable various Model class methods to work



27
28
29
# File 'lib/openc3/models/migration_model.rb', line 27

def self.get(name:, scope: nil)
  super(PRIMARY_KEY, name: name)
end

.names(scope: nil) ⇒ Object



31
32
33
# File 'lib/openc3/models/migration_model.rb', line 31

def self.names(scope: nil)
  super(PRIMARY_KEY)
end

Instance Method Details

#as_json(*a) ⇒ Hash

Returns JSON encoding of this model.

Returns:

  • (Hash)

    JSON encoding of this model



45
46
47
48
49
50
# File 'lib/openc3/models/migration_model.rb', line 45

def as_json(*a)
  {
    'name' => @name,
    'updated_at' => @updated_at
  }
end