Sha256: 79583f9297d4307348e1a432512a66077fbf567d17ae002c19073b89a21d651b

Contents?: true

Size: 1.92 KB

Versions: 3

Compression:

Stored size: 1.92 KB

Contents

# frozen_string_literal: true

require 'uniform_notifier/base'
require 'uniform_notifier/errors'
require 'uniform_notifier/javascript_alert'
require 'uniform_notifier/javascript_console'
require 'uniform_notifier/growl'
require 'uniform_notifier/honeybadger'
require 'uniform_notifier/xmpp'
require 'uniform_notifier/rails_logger'
require 'uniform_notifier/customized_logger'
require 'uniform_notifier/airbrake'
require 'uniform_notifier/sentry'
require 'uniform_notifier/rollbar'
require 'uniform_notifier/bugsnag'
require 'uniform_notifier/appsignal'
require 'uniform_notifier/slack'
require 'uniform_notifier/raise'
require 'uniform_notifier/terminal_notifier'

class UniformNotifier
  AVAILABLE_NOTIFIERS = %i[
    alert
    console
    growl
    honeybadger
    xmpp
    rails_logger
    customized_logger
    airbrake
    rollbar
    bugsnag
    slack
    raise
    sentry
    appsignal
    terminal_notifier
  ].freeze

  NOTIFIERS = [
    JavascriptAlert,
    JavascriptConsole,
    Growl,
    HoneybadgerNotifier,
    Xmpp,
    RailsLogger,
    CustomizedLogger,
    AirbrakeNotifier,
    RollbarNotifier,
    BugsnagNotifier,
    Raise,
    Slack,
    SentryNotifier,
    AppsignalNotifier,
    TerminalNotifier
  ].freeze

  class NotificationError < StandardError
  end

  class << self
    attr_accessor(*AVAILABLE_NOTIFIERS)

    def active_notifiers
      NOTIFIERS.select(&:active?)
    end

    undef growl=
    def growl=(growl)
      UniformNotifier::Growl.setup_connection(growl)
    end

    undef xmpp=
    def xmpp=(xmpp)
      UniformNotifier::Xmpp.setup_connection(xmpp)
    end

    undef customized_logger=
    def customized_logger=(logdev)
      UniformNotifier::CustomizedLogger.setup(logdev)
    end

    undef slack=
    def slack=(slack)
      UniformNotifier::Slack.setup_connection(slack)
    end

    undef raise=
    def raise=(exception_class)
      UniformNotifier::Raise.setup_connection(exception_class)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uniform_notifier-1.15.0 lib/uniform_notifier.rb
uniform_notifier-1.14.2 lib/uniform_notifier.rb
uniform_notifier-1.14.1 lib/uniform_notifier.rb