Class: Bullhorn
- Inherits:
-
Object
- Object
- Bullhorn
- Includes:
- Sender
- Defined in:
- lib/bullhorn.rb,
lib/bullhorn/plugin.rb,
lib/bullhorn/sender.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.0.5"
- URL =
"http://www.bullhorn.it/api/v1/exception"
- FILTERING =
%(['"]?\[?%s\]?['"]?=>?([^&\s]*))
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#ignore_exceptions ⇒ Object
readonly
Returns the value of attribute ignore_exceptions.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Bullhorn
constructor
A new instance of Bullhorn.
Methods included from Sender
Constructor Details
#initialize(app, options = {}) ⇒ Bullhorn
Returns a new instance of Bullhorn.
25 26 27 28 29 30 31 |
# File 'lib/bullhorn.rb', line 25 def initialize(app, = {}) @app = app @api_key = [:api_key] || raise(ArgumentError, ":api_key is required") @filters = Array([:filters]) @url = [:url] || URL @ignore_exceptions = Array([:ignore_exceptions] || default_ignore_exceptions) end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
19 20 21 |
# File 'lib/bullhorn.rb', line 19 def api_key @api_key end |
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
18 19 20 |
# File 'lib/bullhorn.rb', line 18 def filters @filters end |
#ignore_exceptions ⇒ Object (readonly)
Returns the value of attribute ignore_exceptions.
21 22 23 |
# File 'lib/bullhorn.rb', line 21 def ignore_exceptions @ignore_exceptions end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
20 21 22 |
# File 'lib/bullhorn.rb', line 20 def url @url end |
Instance Method Details
#call(env) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bullhorn.rb', line 33 def call(env) status, headers, body = begin @app.call(env) rescue Exception => ex unless ignore_exceptions.include?(ex.class) notify ex, env end raise ex end [status, headers, body] end |