Sha256: 2f45411d55fb455ea44b5ec39eb3d0fdc8e7ecd6a712aa8fc44e7a095cd5f213

Contents?: true

Size: 618 Bytes

Versions: 2

Compression:

Stored size: 618 Bytes

Contents

module ExceptionNotifier
  class WebhookNotifier

    def initialize(options)
      @default_options = options
    end

    def call(exception, options={})
      options = options.reverse_merge(@default_options)
      url = options.delete(:url)
      http_method = options.delete(:http_method) || :post

      options[:body] ||= {}
      options[:body][:exception] = {:error_class => exception.class.to_s,
                                    :message => exception.message.inspect,
                                    :backtrace => exception.backtrace}

      HTTParty.send(http_method, url, options)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exception_notification-4.0.0 lib/exception_notifier/webhook_notifier.rb
exception_notification-4.0.0.rc1 lib/exception_notifier/webhook_notifier.rb