Class: WebHooks::LogDestroyService

Inherits:
Object
  • Object
show all
Defined in:
app/services/web_hooks/log_destroy_service.rb

Constant Summary collapse

BATCH_SIZE =
1000

Instance Method Summary collapse

Constructor Details

#initialize(web_hook_id) ⇒ LogDestroyService

Returns a new instance of LogDestroyService.



7
8
9
# File 'app/services/web_hooks/log_destroy_service.rb', line 7

def initialize(web_hook_id)
  @web_hook_id = web_hook_id
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
# File 'app/services/web_hooks/log_destroy_service.rb', line 11

def execute
  next while WebHookLog.delete_batch_for(@web_hook_id, batch_size: BATCH_SIZE)

  ServiceResponse.success
rescue StandardError => ex
  ServiceResponse.error(message: ex.message)
end