Class: CommandTower::Secrets::Cleanse

Inherits:
CommandTower::ServiceBase show all
Defined in:
app/services/command_tower/secrets/cleanse.rb

Constant Summary

Constants inherited from CommandTower::ServiceBase

CommandTower::ServiceBase::ON_ARGUMENT_VALIDATION

Instance Method Summary collapse

Methods inherited from CommandTower::ServiceBase

inherited, #internal_validate, #service_base_logging, #validate!

Methods included from ArgumentValidation

included

Methods included from CommandTower::ServiceLogging

#aletered_message, #class_name, #log, #log_error, #log_info, #log_prefix, #log_warn, #logger, #service_id

Instance Method Details

#callObject



8
9
10
11
12
# File 'app/services/command_tower/secrets/cleanse.rb', line 8

def call
  secrets = UserSecret.where(user:, reason:)
  count = secrets.delete_all
  log_info("Cleansed #{count} #{reason} secret(s) from the store for user [#{user.id}]")
end