Class: AlertManagement::HttpIntegrations::DestroyService

Inherits:
Object
  • Object
show all
Defined in:
app/services/alert_management/http_integrations/destroy_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(integration, current_user) ⇒ DestroyService

Returns a new instance of DestroyService.

Parameters:


8
9
10
11
# File 'app/services/alert_management/http_integrations/destroy_service.rb', line 8

def initialize(integration, current_user)
  @integration = integration
  @current_user = current_user
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
# File 'app/services/alert_management/http_integrations/destroy_service.rb', line 13

def execute
  return error_no_permissions unless allowed?

  if integration.destroy
    success
  else
    error(integration.errors.full_messages.to_sentence)
  end
end