Class: Decidim::Budgets::OrderReminderGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/services/decidim/budgets/order_reminder_generator.rb

Overview

This class is the generator class which creates and updates order related reminders, after reminder is generated it is send to user who have not checked out his/her/their vote.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeOrderReminderGenerator

Returns a new instance of OrderReminderGenerator.



10
11
12
13
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 10

def initialize
  @reminder_manifest = Decidim.reminders_registry.for(:orders)
  @reminder_jobs_queued = 0
end

Instance Attribute Details

#reminder_jobs_queuedObject (readonly)

Returns the value of attribute reminder_jobs_queued.



8
9
10
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 8

def reminder_jobs_queued
  @reminder_jobs_queued
end

Instance Method Details

#generateObject

Creates reminders and updates them if they already exists.



16
17
18
19
20
21
22
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 16

def generate
  Decidim::Component.where(manifest_name: "budgets").each do |component|
    next if component.current_settings.votes != "enabled"

    send_reminders(component)
  end
end

#generate_for(component, &block) ⇒ Object



24
25
26
27
# File 'app/services/decidim/budgets/order_reminder_generator.rb', line 24

def generate_for(component, &block)
  @alternative_refresh_state = block
  send_reminders(component)
end