Class: Decidim::Voca::Organization::UpdateFileUploadCommand

Inherits:
OrganizationCommand show all
Defined in:
app/commands/decidim/voca/organization/update_file_upload_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OrganizationCommand

#command_name, command_name, #organization

Constructor Details

#initialize(file_upload_settings) ⇒ UpdateFileUploadCommand

Returns a new instance of UpdateFileUploadCommand.



6
7
8
9
10
# File 'app/commands/decidim/voca/organization/update_file_upload_command.rb', line 6

def initialize(file_upload_settings)
  @file_upload_settings = with_defaults(
    file_upload_settings.to_h.with_indifferent_access
  )
end

Instance Attribute Details

#file_upload_settingsObject (readonly)

Returns the value of attribute file_upload_settings.



5
6
7
# File 'app/commands/decidim/voca/organization/update_file_upload_command.rb', line 5

def file_upload_settings
  @file_upload_settings
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'app/commands/decidim/voca/organization/update_file_upload_command.rb', line 12

def call
  organization.update!(
    file_upload_settings: file_upload_settings
  )
  broadcast(:ok)
rescue e
  Rails.logger.error(e)
  broadcast(:fail)
end