Class: Decidim::Initiatives::ValidateSmsCode
- Defined in:
- decidim-initiatives/app/commands/decidim/initiatives/validate_sms_code.rb
Overview
Command to check if sms code provided by user is valid
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(form, verification_metadata) ⇒ ValidateSmsCode
constructor
Public: Initializes the command.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
Constructor Details
#initialize(form, verification_metadata) ⇒ ValidateSmsCode
Public: Initializes the command.
form - form containing confirmation_code. verification_metadata - metadata containing the required code.
11 12 13 14 |
# File 'decidim-initiatives/app/commands/decidim/initiatives/validate_sms_code.rb', line 11 def initialize(form, ) @form = form @verification_metadata = end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everithing is valid.
-
:invalid if verification_metadata is not present or the form code is
invalid.
Returns nothing.
23 24 25 26 27 |
# File 'decidim-initiatives/app/commands/decidim/initiatives/validate_sms_code.rb', line 23 def call return broadcast(:invalid) unless && valid_code? broadcast(:ok) end |