Module: ActiveNotifier::Notifiable::ClassMethods
- Defined in:
- lib/active_notifier/notifiable.rb
Overview
Core functions for Notifiable
Instance Method Summary collapse
-
#exec(channel = nil, **options) ⇒ Object
Message execute.
Instance Method Details
#exec(channel = nil, **options) ⇒ Object
Message execute.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/active_notifier/notifiable.rb', line 43 def exec(channel = nil, **) channel = channel&.to_sym token = [:token]&.to_s = [:message]&.to_s token_channel = [:token_channel]&.to_sym template = [:template]&.to_sym adapter = [:adapter]&.to_sym type = [:type]&.to_sym data = [:data].to_h token = fetch_token(token, token_channel, channel) template ||= channel type ||= get_type_by_template(template) || :text ||= (template, type, data) = .except(:token, :message, :token_channel, :template, :adapter, :type, :data) adapter ||= ActiveNotifier.config.adapter.to_sym notify(adapter, token, type, , ) end |