Class: Renalware::Events::UpdateEvent

Inherits:
Object
  • Object
show all
Includes:
Broadcasting
Defined in:
app/models/renalware/events/update_event.rb

Overview

A wrapper around the updating of an Event to allow is to broadcast a Wisper event to anyone configure to listen in the broadcast subscription map.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Broadcasting

#broadcasting_to_configured_subscribers

Class Method Details

.call(**args) ⇒ Object

Returns the boolean result of event.update_by



14
15
16
17
18
# File 'app/models/renalware/events/update_event.rb', line 14

def self.call(**args)
  new(**args)
    .broadcasting_to_configured_subscribers
    .call
end

Instance Method Details

#callObject



20
21
22
23
24
# File 'app/models/renalware/events/update_event.rb', line 20

def call
  event.update_by(by, params).tap do |success|
    broadcast(:event_updated, event) if success
  end
end