Sha256: 54088e681a34c55a28249654432613c8ba30ebe17096ba52643139a0b97d9d93

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

require 'net/http'
require 'uri'
require 'base64'
require 'json'
require 'cgi'

class Bullhorn
  autoload :Plugin, "bullhorn/plugin"
  autoload :Sender, "bullhorn/sender"

  VERSION = "0.0.1"

  URL = "http://bullhorn.it/api/v1/exception"

  FILTERING = %(['"]?\[?%s\]?['"]?=>?([^&\s]*))

  attr :filters
  attr :api_key
  attr :url

  include Sender

  def initialize(app, options = {})
    @app     = app
    @api_key = options[:api_key] || raise(ArgumentError, ":api_key is required")
    @filters = Array(options[:filters])
    @url     = options[:url] || URL
  end

  def call(env)
    status, headers, body =
      begin
        @app.call(env)
      rescue Exception => ex
        notify ex, env
        raise ex
      end

    [status, headers, body]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bullhorn-0.0.1 lib/bullhorn.rb