Class: Decidim::Budgets::Admin::CreateOrderReminders

Inherits:
Command
  • Object
show all
Defined in:
decidim-budgets/app/commands/decidim/budgets/admin/create_order_reminders.rb

Overview

This command is executed when admin sends vote reminders.

Instance Method Summary collapse

Methods inherited from Command

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

Constructor Details

#initialize(form) ⇒ CreateOrderReminders

Returns a new instance of CreateOrderReminders.



8
9
10
# File 'decidim-budgets/app/commands/decidim/budgets/admin/create_order_reminders.rb', line 8

def initialize(form)
  @form = form
end

Dynamic Method Handling

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

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'decidim-budgets/app/commands/decidim/budgets/admin/create_order_reminders.rb', line 12

def call
  return broadcast(:invalid) if form.invalid?
  return broadcast(:invalid) unless voting_enabled?
  return broadcast(:invalid) if voting_ends_soon?

  generator.generate_for(current_component, &alternative_refresh_state)

  broadcast(:ok, generator.reminder_jobs_queued)
end