Class: Babysitter::ExceptionNotifiers::SimpleNotificationService
- Inherits:
-
Object
- Object
- Babysitter::ExceptionNotifiers::SimpleNotificationService
- Defined in:
- lib/babysitter/exception_notifiers/simple_notification_service.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ SimpleNotificationService
constructor
A new instance of SimpleNotificationService.
- #notify(subject, msg) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ SimpleNotificationService
Returns a new instance of SimpleNotificationService.
6 7 8 9 10 11 12 13 |
# File 'lib/babysitter/exception_notifiers/simple_notification_service.rb', line 6 def initialize(opts = {}) @topic_arn = opts.delete(:topic_arn) @get_credentials = opts.delete(:credentials) raise ArgumentError, "topic_arn is required." if @topic_arn.nil? raise ArgumentError, "credentials is required and must be a Proc." if @get_credentials.nil? || !@get_credentials.is_a?(Proc) validate_topic end |
Instance Method Details
#notify(subject, msg) ⇒ Object
15 16 17 |
# File 'lib/babysitter/exception_notifiers/simple_notification_service.rb', line 15 def notify(subject, msg) topic.publish(msg, subject: sanitise_subject(subject)) end |