Class: Decidim::Odoo::SyncUser
- Inherits:
-
Command
- Object
- Command
- Decidim::Odoo::SyncUser
- Defined in:
- app/commands/decidim/odoo/sync_user.rb
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(user) ⇒ SyncUser
constructor
Public: Initializes the command.
Constructor Details
#initialize(user) ⇒ SyncUser
Public: Initializes the command.
user - A decidim user
9 10 11 |
# File 'app/commands/decidim/odoo/sync_user.rb', line 9 def initialize(user) @user = user end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if we couldn’t proceed.
Returns nothing.
19 20 21 22 23 24 25 26 27 28 |
# File 'app/commands/decidim/odoo/sync_user.rb', line 19 def call update_user! create_user! ActiveSupport::Notifications.publish("decidim.odoo.user.updated", odoo_user.id) broadcast(:ok, odoo_user) rescue StandardError => e broadcast(:invalid, e.) end |