Module: Sc4ry::Notifiers

Defined in:
lib/sc4ry/notifiers/init.rb,
lib/sc4ry/notifiers/mattermost.rb,
lib/sc4ry/notifiers/prometheus.rb

Defined Under Namespace

Classes: Mattermost, Prometheus

Constant Summary collapse

@@notifiers_list =
{:prometheus => {:class => Sc4ry::Notifiers::Prometheus, :config => {:url => 'http://localhost:9091'}},
 :mattermost => {:class => Sc4ry::Notifiers::Mattermost, :config => {:url => 'http://localhost:9999', :token => "<CHANGE_ME>"}}                            
}

Class Method Summary collapse

Class Method Details

.config(options) ⇒ Object



23
24
25
26
27
# File 'lib/sc4ry/notifiers/init.rb', line 23

def Notifiers.config(options)
  raise ":name is mandatory" unless options[:name]
  raise ":config is mandatory" unless options[:config]
  @@notifiers_list[options[:name]][:config] = options[:config]
end

.get(options = {}) ⇒ Object



13
14
15
# File 'lib/sc4ry/notifiers/init.rb', line 13

def Notifiers.get(options ={})
  return @@notifiers_list[options[:name]]
end

.listObject



9
10
11
# File 'lib/sc4ry/notifiers/init.rb', line 9

def Notifiers.list
  return @@notifiers_list.keys
end

.register(options) ⇒ Object



17
18
19
20
21
# File 'lib/sc4ry/notifiers/init.rb', line 17

def Notifiers.register(options)
  raise ":name is mandatory" unless options[:name]
  raise ":definition is mandatory" unless options[:definition]
  @@notifiers_list[options[:name]] = options[:definition]
end