Class: WebHooks::AdminDestroyService
- Inherits:
-
DestroyService
- Object
- DestroyService
- WebHooks::AdminDestroyService
- Defined in:
- app/services/web_hooks/admin_destroy_service.rb
Overview
A variant of the destroy service that can only be used by an administrator from a rake task.
Constant Summary
Constants inherited from DestroyService
Instance Attribute Summary
Attributes inherited from DestroyService
Instance Method Summary collapse
- #authorized?(web_hook) ⇒ Boolean
-
#initialize(rake_task:) ⇒ AdminDestroyService
constructor
A new instance of AdminDestroyService.
- #log_message(hook) ⇒ Object
Methods inherited from DestroyService
Methods included from Services::ReturnServiceResponses
Constructor Details
#initialize(rake_task:) ⇒ AdminDestroyService
Returns a new instance of AdminDestroyService.
7 8 9 10 |
# File 'app/services/web_hooks/admin_destroy_service.rb', line 7 def initialize(rake_task:) super(nil) @rake_task = rake_task end |
Instance Method Details
#authorized?(web_hook) ⇒ Boolean
12 13 14 |
# File 'app/services/web_hooks/admin_destroy_service.rb', line 12 def (web_hook) @rake_task.present? # Not impossible to circumvent, but you need to provide something end |
#log_message(hook) ⇒ Object
16 17 18 |
# File 'app/services/web_hooks/admin_destroy_service.rb', line 16 def (hook) "An administrator scheduled a deletion of logs for hook ID #{hook.id} from #{@rake_task.name}" end |