Class: Renalware::Events::CreateEvent

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

Overview

A wrapper around the creation of an Event to allow is to broadcast a Wisper event to the ‘world’ (or rather just whoever has been configured 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.save_by



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

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

Instance Method Details

#callObject



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

def call
  event.save_by(by).tap do |success|
    broadcast(:event_created, event) if success
  end
end