Class: Decidim::AccessRequests::Verification::Admin::DestroyAuthorization

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/access_requests/verification/admin/destroy_authorization.rb

Overview

A command to destroy an authorization.

Instance Method Summary collapse

Constructor Details

#initialize(authorization) ⇒ DestroyAuthorization

Public: Initializes the command.

authorization - The authorization object to destroy.



12
13
14
# File 'app/commands/decidim/access_requests/verification/admin/destroy_authorization.rb', line 12

def initialize(authorization)
  @authorization = authorization
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the authorization couldn’t be destroyed.

Returns nothing.



22
23
24
25
26
27
# File 'app/commands/decidim/access_requests/verification/admin/destroy_authorization.rb', line 22

def call
  return broadcast(:invalid) unless authorization

  destroy_authorization
  broadcast(:ok)
end