Class: Decidim::Initiatives::ValidateSmsCode
- Inherits:
-
Command
- Object
- Command
- Decidim::Initiatives::ValidateSmsCode
- Defined in:
- 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.
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 'app/commands/decidim/initiatives/validate_sms_code.rb', line 11 def initialize(form, ) @form = form @verification_metadata = end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if verification_metadata is not present or the form code is
invalid.
Returns nothing.
23 24 25 26 27 |
# File 'app/commands/decidim/initiatives/validate_sms_code.rb', line 23 def call return broadcast(:invalid) unless && valid_code? broadcast(:ok) end |