Class: OpenC3::OfflineAccessModel

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

Overview

Note: This model is locked to the DEFAULT scope

Constant Summary collapse

PRIMARY_KEY =
'DEFAULT__openc3__offline_access'

Instance Attribute Summary collapse

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:, offline_access_token: nil, updated_at: nil, scope: 'DEFAULT') ⇒ OfflineAccessModel

END NOTE



43
44
45
46
# File 'lib/openc3/models/offline_access_model.rb', line 43

def initialize(name:, offline_access_token: nil, updated_at: nil, scope: 'DEFAULT')
  super(PRIMARY_KEY, name: name, updated_at: updated_at, scope: 'DEFAULT')
  @offline_access_token = offline_access_token
end

Instance Attribute Details

#offline_access_tokenObject

Returns the value of attribute offline_access_token.



26
27
28
# File 'lib/openc3/models/offline_access_model.rb', line 26

def offline_access_token
  @offline_access_token
end

Class Method Details

.all(scope:) ⇒ Object



38
39
40
# File 'lib/openc3/models/offline_access_model.rb', line 38

def self.all(scope:)
  super(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



30
31
32
# File 'lib/openc3/models/offline_access_model.rb', line 30

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

.names(scope:) ⇒ Object



34
35
36
# File 'lib/openc3/models/offline_access_model.rb', line 34

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

Instance Method Details

#as_json(*a) ⇒ Hash

Returns JSON encoding of this model.

Returns:

  • (Hash)

    JSON encoding of this model



49
50
51
52
53
54
# File 'lib/openc3/models/offline_access_model.rb', line 49

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