denouncer 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 435f952054638a12c1528c1a3efd126b3e37d932
4
- data.tar.gz: 69e8ea1f3e5fde186106dee702b8d5d798f717d1
3
+ metadata.gz: 0a617e06d207d307b00aef250f2761426e399bf3
4
+ data.tar.gz: 042772019efda8ebba7cb648a8f9bbcb7a4f5e9a
5
5
  SHA512:
6
- metadata.gz: 34984f10a1b5f47d759cc9e5d1d2d112319738967bf08a4b8fbd3bd19bad55c285ee48d31154a0e004beb1fa7f285f7a08a178bfc9ed7957dc61495a1dfdb5e4
7
- data.tar.gz: 1115a5fa4739c36e6b6da776ef9b8d5042cde82a0613821f3906a6709bc7f3e4decf51ab98257969142eb346dddcb361d6315950b648fd3ba99adae72957b896
6
+ metadata.gz: a98e7decc781c4e20672386e356dbcaea28549330adca3b0ea99498f067f11942a11641c97cf3820d2bd0d7216ac52091356bae2c593ec24f0dc4550923f383c
7
+ data.tar.gz: 5f8a801e34736502d7e282744aa72110ce0e9cf97addd445831fbcd6e3094d515516ed7ecba706eb04c6b312c28ecc8dd84ab4a5a42dd157be4bd95d09ce663c
data/README.md CHANGED
@@ -121,6 +121,27 @@ Configuration variables are:
121
121
  message_queue: "my_app.errors"
122
122
  )
123
123
 
124
+ #### HoneybadgerNotifier
125
+
126
+ For more information on honeybadger please refer to their [github repo](https://github.com/honeybadger-io/honeybadger-ruby).
127
+
128
+ #### !!!ATTENTION
129
+
130
+ The honeybadger and rack gems are required for the HoneybadgerNotifier. Please add the gems to your Gemfile as follows:
131
+
132
+ gem 'honeybadger'
133
+ gem 'rack'
134
+
135
+ Honeybadger is automatically configured using environment variables (e.g. HONEYBADGER_API_KEY). For a more detailed documentation please have a look at [their instructions](http://docs.honeybadger.io/collection/7-getting-started).
136
+
137
+ require 'denouncer'
138
+
139
+ Denouncer.configure(
140
+ application_name: "my_app",
141
+ notifier: :honeybadger
142
+ )
143
+
144
+
124
145
  #### Multiple notifier configuration
125
146
 
126
147
  Since version 0.4.0 denouncer supports parallel usage of multiple notifiers.
@@ -26,4 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "pry"
27
27
  spec.add_development_dependency "simplecov"
28
28
  spec.add_development_dependency "bunny"
29
+ spec.add_development_dependency "honeybadger"
30
+ spec.add_development_dependency "rack"
29
31
  end
@@ -137,19 +137,9 @@ module Denouncer
137
137
  end
138
138
 
139
139
  def self.get_notifier_class(notifier_symbol)
140
- notifier_class = nil
141
-
142
- case notifier_symbol
143
- when :smtp then
144
- notifier_class = ::Denouncer::Notifiers::SmtpNotifier
145
- when :console then
146
- notifier_class = ::Denouncer::Notifiers::ConsoleNotifier
147
- when :amqp then
148
- notifier_class = ::Denouncer::Notifiers::AmqpNotifier
149
- else
150
- raise "Invalid notifier configuration: #{options} is not a valid :notifier setting!"
151
- end
152
-
153
- return notifier_class
140
+ class_name = "::Denouncer::Notifiers::#{notifier_symbol.to_s.capitalize}Notifier"
141
+ Kernel.const_get(class_name)
142
+ rescue => err
143
+ raise "Invalid notifier configuration: #{notifier_symbol} is not a valid :notifier setting! Error: #{err.message} !"
154
144
  end
155
145
  end
@@ -4,5 +4,6 @@ module Denouncer
4
4
  autoload :ConsoleNotifier, File.expand_path('../notifiers/console_notifier', __FILE__)
5
5
  autoload :SmtpNotifier, File.expand_path('../notifiers/smtp_notifier', __FILE__)
6
6
  autoload :AmqpNotifier, File.expand_path('../notifiers/amqp_notifier', __FILE__)
7
+ autoload :HoneybadgerNotifier, File.expand_path('../notifiers/honeybadger_notifier', __FILE__)
7
8
  end
8
9
  end
@@ -0,0 +1,33 @@
1
+ require 'socket'
2
+ require 'json'
3
+
4
+ module Denouncer
5
+ module Notifiers
6
+ class HoneybadgerNotifier < BaseNotifier
7
+
8
+ # @return [String]
9
+ def name
10
+ 'honeybadger'
11
+ end
12
+
13
+ def set_configuration!(options)
14
+ require 'honeybadger'
15
+ require 'rack/request'
16
+ Honeybadger.start
17
+ return options
18
+ end
19
+
20
+ # Sends an error notification via amqp.
21
+ #
22
+ # @param error [StandardError]
23
+ # @param metadata [Hash]
24
+ def notify(error, metadata = nil)
25
+ Honeybadger.notify(
26
+ error_class: error.class.name,
27
+ error_message: error.message,
28
+ parameters: metadata
29
+ )
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module Denouncer
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: denouncer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Weber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: honeybadger
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rack
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
97
125
  description: Denouncer allows you to send notifications with error/exception details
98
126
  using a simple interface. New methods of sending error messages can be implemented
99
127
  using a pre-defined class interface. SMTP and AMQP notification are the first implemented
@@ -117,6 +145,7 @@ files:
117
145
  - lib/denouncer/notifiers/amqp_notifier.rb
118
146
  - lib/denouncer/notifiers/base_notifier.rb
119
147
  - lib/denouncer/notifiers/console_notifier.rb
148
+ - lib/denouncer/notifiers/honeybadger_notifier.rb
120
149
  - lib/denouncer/notifiers/smtp_notifier.rb
121
150
  - lib/denouncer/version.rb
122
151
  - spec/lib/denouncer/denouncer_spec.rb