Class: Cron::SwitchboardSyncModels

Inherits:
Job show all
Defined in:
lib/app/jobs/cron/switchboard_sync_models.rb

Overview

Cycle through all members and tell them to sync with with switchboard

Instance Attribute Summary

Attributes inherited from ApplicationJob

#payload, #started_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Job

cron_tab_entry, #notify_job_failure, #send_support_email

Methods inherited from ApplicationJob

#duration, #parse_payload, #perform, valid_environments

Methods included from App47Logger

clean_params, #clean_params, delete_parameter_keys, #log_controller_error, log_debug, #log_debug, log_error, #log_error, log_exception, #log_message, log_message, #log_warn, log_warn, mask_parameter_keys, #update_flash_messages

Class Method Details

.valid_environment?Boolean

Only run in environments where switchboard is configured

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/app/jobs/cron/switchboard_sync_models.rb', line 14

def self.valid_environment?
  SystemConfiguration.switchboard_configured? && Web47core::Config.switchboard_able_models.present?
rescue StandardError
  false
end

Instance Method Details

#executeObject

Cycle through the collection and perform an upsert on it



23
24
25
# File 'lib/app/jobs/cron/switchboard_sync_models.rb', line 23

def execute
  Web47core::Config.switchboard_able_models.each { |model| model.each(&:switchboard_upsert) }
end