Class: Decidim::Votings::SendAccessCode

Inherits:
Command
  • Object
show all
Defined in:
decidim-elections/app/commands/decidim/votings/send_access_code.rb

Overview

A command to send the access code

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

#initialize(datum, medium) ⇒ SendAccessCode

Returns a new instance of SendAccessCode.



7
8
9
10
# File 'decidim-elections/app/commands/decidim/votings/send_access_code.rb', line 7

def initialize(datum, medium)
  @datum = datum
  @medium = medium
end

Dynamic Method Handling

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

Instance Method Details

#callObject

Executes the command. Broadcast this events:

  • :invalid when params are missing

Returns nothing.



16
17
18
19
20
21
22
# File 'decidim-elections/app/commands/decidim/votings/send_access_code.rb', line 16

def call
  return broadcast(:invalid) unless datum

  send_access_code

  broadcast(:ok)
end