Class: Decidim::Votings::Census::Admin::LaunchAccessCodesExport

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-elections/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb

Overview

A command to launch the access codes export

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dataset, user) ⇒ LaunchAccessCodesExport

Returns a new instance of LaunchAccessCodesExport.


9
10
11
12
# File 'decidim-elections/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb', line 9

def initialize(dataset, user)
  @dataset = dataset
  @user = user
end

Instance Attribute Details

#datasetObject (readonly)

Returns the value of attribute dataset


27
28
29
# File 'decidim-elections/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb', line 27

def dataset
  @dataset
end

#userObject (readonly)

Returns the value of attribute user


27
28
29
# File 'decidim-elections/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb', line 27

def user
  @user
end

Instance Method Details

#callObject

Executes the command. Broadcast this events:

  • :ok when everything is valid

  • :invalid when the user is not present

Returns nothing.


19
20
21
22
23
24
25
# File 'decidim-elections/app/commands/decidim/votings/census/admin/launch_access_codes_export.rb', line 19

def call
  return broadcast(:invalid) unless valid?

  ExportAccessCodesJob.perform_later(dataset, user)

  broadcast(:ok)
end