Class: Decidim::Verifications::DestroyUserAuthorization

Inherits:
Command
  • Object
show all
Defined in:
decidim-verifications/app/commands/decidim/verifications/destroy_user_authorization.rb

Overview

A command to Destroy the Authorization of a user.

Instance Method Summary collapse

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events

Constructor Details

#initialize(authorization) ⇒ DestroyUserAuthorization

Returns a new instance of DestroyUserAuthorization.



7
8
9
# File 'decidim-verifications/app/commands/decidim/verifications/destroy_user_authorization.rb', line 7

def initialize(authorization)
  @authorization = authorization
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#callObject



11
12
13
14
15
16
17
# File 'decidim-verifications/app/commands/decidim/verifications/destroy_user_authorization.rb', line 11

def call
  return broadcast(:invalid) unless authorization

  authorization.destroy!

  broadcast(:ok, authorization)
end