Class: Denouncer::Notifiers::BaseNotifier
- Inherits:
-
Object
- Object
- Denouncer::Notifiers::BaseNotifier
- Defined in:
- lib/denouncer/notifiers/base_notifier.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#get_current_timestamp ⇒ Object
Returns the current timestamp in utc is8601 format.
-
#initialize(options) ⇒ BaseNotifier
constructor
A new instance of BaseNotifier.
-
#notify(error, metadata = nil) ⇒ Object
Sends a notification.
- #set_configuration!(options) ⇒ Object
Constructor Details
#initialize(options) ⇒ BaseNotifier
Returns a new instance of BaseNotifier.
8 9 10 11 12 13 14 |
# File 'lib/denouncer/notifiers/base_notifier.rb', line 8 def initialize() if [:application_name].nil? || ![:application_name].is_a?(String) raise "Invalid configuration hash: No valid :application_name given" end opts = set_configuration!().dup @config = opts end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/denouncer/notifiers/base_notifier.rb', line 6 def config @config end |
Instance Method Details
#get_current_timestamp ⇒ Object
Returns the current timestamp in utc is8601 format
17 18 19 |
# File 'lib/denouncer/notifiers/base_notifier.rb', line 17 def Time.now.utc.iso8601 end |
#notify(error, metadata = nil) ⇒ Object
Sends a notification.
29 30 31 |
# File 'lib/denouncer/notifiers/base_notifier.rb', line 29 def notify(error, = nil) raise NotImplementedException("This method needs to be implemented in a sub-class!") end |
#set_configuration!(options) ⇒ Object
21 22 23 |
# File 'lib/denouncer/notifiers/base_notifier.rb', line 21 def set_configuration!() raise NotImplementedException("This method needs to be implemented in a sub-class!") end |