Class: Decidim::Conferences::Admin::SendConferenceDiplomas

Inherits:
Decidim::Command show all
Defined in:
decidim-conferences/app/commands/decidim/conferences/admin/send_conference_diplomas.rb

Overview

A command with all the business logic to send diplomas to registered conference users.

Instance Method Summary collapse

Methods inherited from Decidim::Command

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

Constructor Details

#initialize(conference, current_user) ⇒ SendConferenceDiplomas

Public: Initializes the command.

conference - The conference which the user is invited to.



12
13
14
15
# File 'decidim-conferences/app/commands/decidim/conferences/admin/send_conference_diplomas.rb', line 12

def initialize(conference, current_user)
  @conference = conference
  @current_user = current_user
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. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if the form was not valid and we could not proceed.

Returns nothing.



23
24
25
26
27
28
# File 'decidim-conferences/app/commands/decidim/conferences/admin/send_conference_diplomas.rb', line 23

def call
  return broadcast(:invalid) if conference.diploma_sent?

  send_diplomas
  broadcast(:ok)
end