Class: SolidQueueGuard::Notifier Private
- Inherits:
-
Object
- Object
- SolidQueueGuard::Notifier
- Defined in:
- lib/solid_queue_guard/notifier.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .deliver(adapter, report) ⇒ Object private
- .deliver_all(report, adapters: SolidQueueGuard.config.notify_with) ⇒ Object private
- .post_json(url, payload, headers: {}) ⇒ Object private
Class Method Details
.deliver(adapter, report) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 17 18 19 20 |
# File 'lib/solid_queue_guard/notifier.rb', line 13 def deliver(adapter, report) case adapter.to_sym when :slack then deliver_slack(report) when :datadog then deliver_datadog(report) when :webhook then deliver_webhook(report) else deliver_rails_logger(report) end end |
.deliver_all(report, adapters: SolidQueueGuard.config.notify_with) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 10 11 |
# File 'lib/solid_queue_guard/notifier.rb', line 7 def deliver_all(report, adapters: SolidQueueGuard.config.notify_with) Array(adapters).each do |adapter| deliver(adapter, report) end end |
.post_json(url, payload, headers: {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/solid_queue_guard/notifier.rb', line 22 def post_json(url, payload, headers: {}) require 'net/http' uri = URI(url) request = Net::HTTP::Post.new(uri) request['Content-Type'] = 'application/json' headers.each { |key, value| request[key] = value } request.body = JSON.generate(payload) Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http| http.request(request) end end |