Class: Bugwatch::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/bugwatch/notification.rb

Constant Summary collapse

TIMEOUT =
3

Instance Method Summary collapse

Constructor Details

#initialize(payload, config: Bugwatch.configuration) ⇒ Notification

Returns a new instance of Notification.



9
10
11
12
# File 'lib/bugwatch/notification.rb', line 9

def initialize(payload, config: Bugwatch.configuration)
  @payload = payload
  @config  = config
end

Instance Method Details

#deliverObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bugwatch/notification.rb', line 14

def deliver
  return unless @config.api_key
  return unless @config.endpoint
  return unless @config.notify_for_release_stage?

  Thread.new do
    post_to_api
  rescue StandardError
    # Fire-and-forget: swallow all errors so the gem never affects the app
  end
end