class Martilla::Notifier
Attributes
options[R]
Public Class Methods
create(config = {})
click to toggle source
When a new Notifier
is supported it needs to go here
# File lib/martilla/notifier.rb, line 35 def self.create(config = {}) case config['type'].downcase when 'sendmail' Sendmail.new(config['options']) when 'smtp' Smtp.new(config['options']) when 'ses' Ses.new(config['options']) when 'slack' Slack.new(config['options']) when 'none' nil else raise Error.new("Invalid Notifier type: #{config['type']}") end end
new(config)
click to toggle source
# File lib/martilla/notifier.rb, line 5 def initialize(config) @options = config raise Error.new(invalid_options_msg) if @options.nil? end
Public Instance Methods
error(msg, data)
click to toggle source
# File lib/martilla/notifier.rb, line 14 def error(msg, data) raise NotImplementedError, 'You must implement the error method' end
invalid_options_msg()
click to toggle source
# File lib/martilla/notifier.rb, line 18 def invalid_options_msg 'Notifier configuration is invalid. Details here: https://github.com/fdoxyz/martilla' end
send_failure?()
click to toggle source
# File lib/martilla/notifier.rb, line 28 def send_failure? value = @options['send_failure'] return true if value.nil? value end
send_success?()
click to toggle source
# File lib/martilla/notifier.rb, line 22 def send_success? value = @options['send_success'] return true if value.nil? value end
success(data)
click to toggle source
# File lib/martilla/notifier.rb, line 10 def success(data) raise NotImplementedError, 'You must implement the success method' end