Sha256: 3da428f96b457e0f3d8a7898e626fff6fa583c21aa56cc88c7b9b6a1f9b704de

Contents?: true

Size: 1.1 KB

Versions: 29

Compression:

Stored size: 1.1 KB

Contents

# To deliver this notification:
#
# SimpleUserNotifier.with(message: "New post").deliver(User.all, enqueue_job: false)

class SimpleUserNotifier < ApplicationNotifier
  # Add your delivery methods
  #
  # deliver_by :email do |config|
  #   config.mailer = "UserMailer"
  #   config.method = "new_post"
  # end
  #
  # bulk_deliver_by :slack do |config|
  #   config.url = -> { Rails.application.credentials.slack_webhook_url }
  # end
  #
  # deliver_by :custom do |config|
  #   config.class = "MyDeliveryMethod"
  # end
  notification_methods do
    def message
      params[:message]
    end

    def tooltip
      params[:tooltip]
    end
  end
  # Add required params
  #
  required_param :message

  attr_accessor :target, :user_ids

  enumerize :target, in: { todos: 0, devs: 1, user_ids: 2 }

  %i[message message_text tooltip subject].each do |field|
    define_method :"#{field}" do
      params[field]
    end
    define_method :"#{field}=" do |value|
      params[field] = value
    end
  end

  def self.policy_class
    ApplicationPolicy
  end

  def self.decorator_class
    PgEngine::BaseRecordDecorator
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
pg_rails-7.6.28 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.27 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.26 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.25 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.24 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.24.pre.5 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.24.pre.4 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.24.pre.3 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.23 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.22 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.22.pre.3 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.22.pre.2 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.22.pre.1 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.11 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.10 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.9 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.8 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.7 pg_engine/app/notifiers/simple_user_notifier.rb
pg_rails-7.6.21.pre.6 pg_engine/app/notifiers/simple_user_notifier.rb