Class: CommandTower::Secrets::Cleanse
- Inherits:
-
Object
- Object
- CommandTower::Secrets::Cleanse
- Includes:
- CommandTower::ServiceLogging
- Defined in:
- app/services/command_tower/secrets/cleanse.rb
Overview
Drops every outstanding secret a user holds for one reason.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user:, reason:) ⇒ Cleanse
constructor
A new instance of Cleanse.
Methods included from CommandTower::ServiceLogging
Constructor Details
#initialize(user:, reason:) ⇒ Cleanse
Returns a new instance of Cleanse.
12 13 14 15 |
# File 'app/services/command_tower/secrets/cleanse.rb', line 12 def initialize(user:, reason:) @user = user @reason = reason end |
Class Method Details
.call(user:, reason:) ⇒ Object
8 9 10 |
# File 'app/services/command_tower/secrets/cleanse.rb', line 8 def self.call(user:, reason:) new(user:, reason:).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 22 |
# File 'app/services/command_tower/secrets/cleanse.rb', line 17 def call count = UserSecret.where(user:, reason:).delete_all log_info("Cleansed #{count} #{reason} secret(s) from the store for user [#{user.id}]") count end |