Class: Decidim::Verifications::PerformAuthorizationStep
- Inherits:
-
Command
- Object
- Command
- Decidim::Verifications::PerformAuthorizationStep
- Defined in:
- app/commands/decidim/verifications/perform_authorization_step.rb
Overview
A command to create a partial authorization for a user.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(authorization, handler) ⇒ PerformAuthorizationStep
constructor
Public: Initializes the command.
Constructor Details
#initialize(authorization, handler) ⇒ PerformAuthorizationStep
Public: Initializes the command.
authorization - An Authorization object. handler - An AuthorizationHandler object.
11 12 13 14 |
# File 'app/commands/decidim/verifications/perform_authorization_step.rb', line 11 def initialize(, handler) @authorization = @handler = handler end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if the handler was not valid and we could not proceed.
Returns nothing.
22 23 24 25 26 27 28 |
# File 'app/commands/decidim/verifications/perform_authorization_step.rb', line 22 def call return broadcast(:invalid) unless handler.valid? update_verification_data broadcast(:ok) end |