Class: Decidim::Voca::Organization::UpdateSmtpCommand
- Inherits:
-
OrganizationCommand
- Object
- Command
- OrganizationCommand
- Decidim::Voca::Organization::UpdateSmtpCommand
- Defined in:
- app/commands/decidim/voca/organization/update_smtp_command.rb
Instance Attribute Summary collapse
-
#smtp_settings ⇒ Object
readonly
Returns the value of attribute smtp_settings.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(smtp_settings) ⇒ UpdateSmtpCommand
constructor
A new instance of UpdateSmtpCommand.
Methods inherited from OrganizationCommand
#command_name, command_name, #organization
Constructor Details
#initialize(smtp_settings) ⇒ UpdateSmtpCommand
Returns a new instance of UpdateSmtpCommand.
6 7 8 |
# File 'app/commands/decidim/voca/organization/update_smtp_command.rb', line 6 def initialize(smtp_settings) @smtp_settings = transform_settings(smtp_settings.to_h.with_indifferent_access) end |
Instance Attribute Details
#smtp_settings ⇒ Object (readonly)
Returns the value of attribute smtp_settings.
5 6 7 |
# File 'app/commands/decidim/voca/organization/update_smtp_command.rb', line 5 def smtp_settings @smtp_settings end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/commands/decidim/voca/organization/update_smtp_command.rb', line 10 def call organization.update!( smtp_settings: smtp_settings.delete_if { |_k, v| v.blank? } ) broadcast(:ok) rescue => e Rails.logger.error(e) broadcast(:fail) end |