Class: ExceptionNotifier::GoogleChatNotifier

Inherits:
BaseNotifier show all
Defined in:
lib/exception_notifier/google_chat_notifier.rb

Instance Attribute Summary

Attributes inherited from BaseNotifier

#base_options

Instance Method Summary collapse

Methods inherited from BaseNotifier

#_post_callback, #_pre_callback, #initialize, #send_notice

Constructor Details

This class inherits a constructor from ExceptionNotifier::BaseNotifier

Instance Method Details

#call(exception, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/exception_notifier/google_chat_notifier.rb', line 7

def call(exception, opts = {})
  options = base_options.merge(opts)
  formatter = Formatter.new(exception, options)

  HTTParty.post(
    options[:webhook_url],
    body: {text: body(exception, formatter)}.to_json,
    headers: {"Content-Type" => "application/json"}
  )
end