Module: Massive::Notifications

Extended by:
ActiveSupport::Concern
Included in:
Step
Defined in:
lib/massive/notifications.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#notifierObject



17
18
19
# File 'lib/massive/notifications.rb', line 17

def notifier
  @notifier ||= self.class.notifier_class.new(notifier_id, self.class.notifier_options)
end

#notifier_idObject



21
22
23
# File 'lib/massive/notifications.rb', line 21

def notifier_id
  "#{self.class.name.underscore.gsub('/', '-')}-#{id}"
end

#notify(message) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/massive/notifications.rb', line 9

def notify(message)
  if active_model_serializer
    notifier.notify(message) do
      active_model_serializer.new(reload)
    end
  end
end