Class: ExceptionNotifier::SnsNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- ExceptionNotifier::SnsNotifier
- Defined in:
- lib/exception_notifier/sns_notifier.rb
Instance Attribute Summary
Attributes inherited from BaseNotifier
Instance Method Summary collapse
- #call(exception, custom_opts = {}) ⇒ Object
-
#initialize(options) ⇒ SnsNotifier
constructor
A new instance of SnsNotifier.
Methods inherited from BaseNotifier
#_post_callback, #_pre_callback, #send_notice
Constructor Details
#initialize(options) ⇒ SnsNotifier
Returns a new instance of SnsNotifier.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/exception_notifier/sns_notifier.rb', line 5 def initialize() super raise ArgumentError, "You must provide 'region' option" unless [:region] raise ArgumentError, "You must provide 'access_key_id' option" unless [:access_key_id] raise ArgumentError, "You must provide 'secret_access_key' option" unless [:secret_access_key] @notifier = Aws::SNS::Client.new( region: [:region], access_key_id: [:access_key_id], secret_access_key: [:secret_access_key] ) @options = .merge() end |
Instance Method Details
#call(exception, custom_opts = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/exception_notifier/sns_notifier.rb', line 20 def call(exception, custom_opts = {}) = .merge(custom_opts) subject = build_subject(exception, ) = (exception, ) notifier.publish( topic_arn: [:topic_arn], message: , subject: subject ) end |