Class: BridgeCache::EnrollmentProfile

Inherits:
BridgeBaseModel show all
Extended by:
Data::BridgeModel
Defined in:
app/models/bridge_cache/enrollment_profile.rb

Constant Summary

Constants included from Data::BridgeModel

Data::BridgeModel::EXCLUDED_COLUMNS, Data::BridgeModel::OVERRIDDEN_COLUMNS

Constants inherited from BridgeBaseModel

BridgeBaseModel::BRIDGE_ID, BridgeBaseModel::DOMAIN_ID, BridgeBaseModel::OWNER_ID, BridgeBaseModel::PARENT_ID

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Data::BridgeModel

adjusted_table_name, cleanup, create_from_csv_row, csv_mapping, extended, for_domain, format_import_row, import_from_csv, is_active?, uniq_constraint_name, unique_column_names, webhook_completed, webhook_created, webhook_deleted, webhook_updated

Methods inherited from BridgeBaseModel

#adjusted_table_name, #bridge_id

Class Method Details

.format_import_row(row) ⇒ Object



22
23
24
25
26
# File 'app/models/bridge_cache/enrollment_profile.rb', line 22

def self.format_import_row(row)
  json = parse_config(row['config'])
  row['config'] = json if json.present?
  row
end

.parse_config(config) ⇒ Object



18
19
20
# File 'app/models/bridge_cache/enrollment_profile.rb', line 18

def self.parse_config(config)
  BridgeCache::Plugins::DataTransform.valid_json?(config)
end

.unique_column_namesObject



28
29
30
# File 'app/models/bridge_cache/enrollment_profile.rb', line 28

def self.unique_column_names
  %w[bridge_id domain_id]
end

Instance Method Details

#namespace_enrollable_typeObject



9
10
11
# File 'app/models/bridge_cache/enrollment_profile.rb', line 9

def namespace_enrollable_type
  self.enrollable_type = "BridgeCache::#{enrollable_type}" unless enrollable_type&.include? 'BridgeCache::'
end

#parse_jsonObject



13
14
15
16
# File 'app/models/bridge_cache/enrollment_profile.rb', line 13

def parse_json
  json = self.class.parse_config(config)
  self.config = json if json.present?
end