class Denouncer::Notifiers::BaseNotifier
Attributes
config[R]
Public Class Methods
new(options)
click to toggle source
# File lib/denouncer/notifiers/base_notifier.rb, line 8 def initialize(options) if options[:application_name].nil? || !options[:application_name].is_a?(String) raise "Invalid configuration hash: No valid :application_name given" end opts = set_configuration!(options).dup @config = opts end
Public Instance Methods
get_current_timestamp()
click to toggle source
Returns the current timestamp in utc is8601 format
# File lib/denouncer/notifiers/base_notifier.rb, line 17 def get_current_timestamp Time.now.utc end
get_error_cause(error)
click to toggle source
returns the given error's cause if available
# File lib/denouncer/notifiers/base_notifier.rb, line 22 def get_error_cause(error) if error.respond_to? :cause error.cause else nil end end
info(info_message, metadata = nil)
click to toggle source
Sends a info notification.
@param info_message [String] @param metadata [Hash]
# File lib/denouncer/notifiers/base_notifier.rb, line 51 def info(info_message, metadata = nil) raise NotImplementedException("This method needs to be implemented in a sub-class!") end
name()
click to toggle source
@return [String] the name for the notifier
# File lib/denouncer/notifiers/base_notifier.rb, line 31 def name raise NotImplementedException("This method needs to be implemented in a sub-class!") end
notify(error, metadata = nil)
click to toggle source
Sends an error notification.
@param error [StandardError] @param metadata [Hash]
# File lib/denouncer/notifiers/base_notifier.rb, line 43 def notify(error, metadata = nil) raise NotImplementedException("This method needs to be implemented in a sub-class!") end
set_configuration!(options)
click to toggle source
# File lib/denouncer/notifiers/base_notifier.rb, line 35 def set_configuration!(options) raise NotImplementedException("This method needs to be implemented in a sub-class!") end