Module: Sc4ry::Notifiers
- Defined in:
- lib/sc4ry/notifiers/init.rb,
lib/sc4ry/notifiers/mattermost.rb,
lib/sc4ry/notifiers/prometheus.rb
Overview
Note:
namespace
Sc4ry::Notifiers module
Defined Under Namespace
Classes: Mattermost, Prometheus
Constant Summary collapse
- DEFAULT_NOTIFIERS =
default notifiers specifications
{ prometheus: { class: Sc4ry::Notifiers::Prometheus, config: { url: 'http://localhost:9091' } }, mattermost: { class: Sc4ry::Notifiers::Mattermost, config: { url: 'http://localhost:9999', token: '<CHANGE_ME>' } } }
- @@notifiers_list =
DEFAULT_NOTIFIERS.dup
Class Method Summary collapse
-
.config(name:, config:) ⇒ Hash
class method how configure a specific notifier.
-
.display_config(notifier:) ⇒ Hash
class method how display a specific notifier config.
-
.get(name:) ⇒ Hash
class method how return a specific notifier by name.
-
.list ⇒ Array
class method how return the list of known notifiers.
-
.register(name:, definition:) ⇒ Hash
class method how register a specific notifier.
Class Method Details
.config(name:, config:) ⇒ Hash
class method how configure a specific notifier
53 54 55 56 |
# File 'lib/sc4ry/notifiers/init.rb', line 53 def self.config(name:, config:) @@notifiers_list[name][:config] = config config end |
.display_config(notifier:) ⇒ Hash
class method how display a specific notifier config
19 20 21 22 23 24 25 26 |
# File 'lib/sc4ry/notifiers/init.rb', line 19 def self.display_config(notifier:) unless @@notifiers_list.include? notifier raise Sc4ry::Exceptions::Sc4ryNotifierError, "Notifier #{notifier} not found" end @@notifiers_list[notifier][:config] end |
.get(name:) ⇒ Hash
class method how return a specific notifier by name
37 38 39 |
# File 'lib/sc4ry/notifiers/init.rb', line 37 def self.get(name:) @@notifiers_list[name] end |
.list ⇒ Array
class method how return the list of known notifiers
30 31 32 |
# File 'lib/sc4ry/notifiers/init.rb', line 30 def self.list @@notifiers_list.keys end |
.register(name:, definition:) ⇒ Hash
class method how register a specific notifier
45 46 47 |
# File 'lib/sc4ry/notifiers/init.rb', line 45 def self.register(name:, definition:) @@notifiers_list[name] = definition end |