mailgun_catcher 0.6.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0270498476a1593def739a98a0ab51ae7ddd3a0b1a6fd81dd6acfc43a71e6094'
4
- data.tar.gz: 657dda987c902da1ca6adaa8ea4c84fcbb2d54db8dca76d23d746e0ec0b93580
3
+ metadata.gz: dacfa3890b0f1b49041cfcc6d749170d864471977c402a7bf3e8973a8ef287bf
4
+ data.tar.gz: b547f7780d0d99c576197568564cec4dad806bc62c858ee7c7370506b59f5074
5
5
  SHA512:
6
- metadata.gz: 4637dd0b9ef40b94a2239b77188c34968d6b6bad0a7ba071bdf4a7ef5829aaf626dc73debd64902ec6655441c4c00be3f3e66cdc9742047d2e206441b08d53ce
7
- data.tar.gz: a8f5c80ba263cde8932dc32f0a77397758523da0784c8dc3ce3c424f6068404e71e8ab190a4f6ec1edff27e4c4f8134e9cb29c5995437f08d14132e204e7701e
6
+ metadata.gz: 7354b7c497078d2e64cf1b197e6f9a7ba0f95e85ceff64a2be66c8947baf5549b71af32f8abdc4cac69498678f5a45be9197483ba0d0c3150024bff46d43e504
7
+ data.tar.gz: 237dc959296bd08b553f052dce12935c7788be43332c400c590ed00ad2fd835ca6569529f31c3e64c032d185ea34b5df4c1e1754ad10a545809fece5e63e9c55
data/README.md CHANGED
@@ -42,7 +42,7 @@ end
42
42
  register custom notifier implementation through initializer
43
43
  ```ruby
44
44
  MailgunCatcher.setup do |config|
45
- config.notifier = MailgunNotifier.new
45
+ config.notifiers = ["MailgunCatcher::Notifier::Bugsnag", "MailgunNotifier"]
46
46
  end
47
47
  ```
48
48
 
@@ -1,13 +1,12 @@
1
1
  require 'dry-configurable'
2
2
  require 'mailgun_catcher/engine'
3
3
  require 'mailgun_catcher/event'
4
- require 'mailgun_catcher/event_error'
5
4
  require 'mailgun_catcher/notifier/bugsnag'
6
5
 
7
6
  module MailgunCatcher
8
7
  extend Dry::Configurable
9
8
 
10
- setting(:notifier, MailgunCatcher::Notifier::Bugsnag.new)
9
+ setting(:notifiers, ["MailgunCatcher::Notifier::Bugsnag"])
11
10
 
12
11
  def self.setup
13
12
  yield config
@@ -7,7 +7,7 @@ module MailgunCatcher
7
7
  end
8
8
 
9
9
  def notify
10
- MailgunCatcher.config.notifier.notify(EventError.new(self))
10
+ notifiers.each { |notifier| notifier.notify(self) }
11
11
  end
12
12
 
13
13
  def error_message
@@ -24,6 +24,10 @@ module MailgunCatcher
24
24
 
25
25
  private
26
26
 
27
+ def notifiers
28
+ MailgunCatcher.config.notifiers.map { |notifier| notifier.constantize.new }
29
+ end
30
+
27
31
  def delivery_status
28
32
  return delivery_status_message if delivery_status_message.present?
29
33
  return delivery_status_description if delivery_status_description.present?
@@ -2,7 +2,29 @@ module MailgunCatcher
2
2
  module Notifier
3
3
  class Bugsnag
4
4
  def notify(event)
5
- Bugsnag.notify(event)
5
+ error_event = EventError.new(event)
6
+ ::Bugsnag.notify(error_event)
7
+ end
8
+ end
9
+
10
+ class EventError < StandardError
11
+ attr_reader :event
12
+
13
+ def initialize(event)
14
+ @event = event
15
+ super(event.error_message)
16
+ end
17
+
18
+ def bugsnag_meta_data
19
+ { event_details: event.event_data }
20
+ end
21
+
22
+ def bugsnag_context
23
+ 'mailgun'
24
+ end
25
+
26
+ def bugsnag_grouping_hash
27
+ event.grouping_error_message
6
28
  end
7
29
  end
8
30
  end
@@ -1,3 +1,3 @@
1
1
  module MailgunCatcher
2
- VERSION = '0.6.0'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailgun_catcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjić
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2020-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bugsnag
@@ -68,7 +68,6 @@ files:
68
68
  - lib/mailgun_catcher.rb
69
69
  - lib/mailgun_catcher/engine.rb
70
70
  - lib/mailgun_catcher/event.rb
71
- - lib/mailgun_catcher/event_error.rb
72
71
  - lib/mailgun_catcher/notifier/bugsnag.rb
73
72
  - lib/mailgun_catcher/version.rb
74
73
  homepage: https://github.com/infinum/rails-infinum-mailgun_catcher
@@ -76,7 +75,7 @@ licenses:
76
75
  - MIT
77
76
  metadata:
78
77
  allowed_push_host: https://rubygems.org
79
- post_install_message:
78
+ post_install_message:
80
79
  rdoc_options: []
81
80
  require_paths:
82
81
  - lib
@@ -91,9 +90,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
90
  - !ruby/object:Gem::Version
92
91
  version: '0'
93
92
  requirements: []
94
- rubyforge_project:
95
- rubygems_version: 2.7.6
96
- signing_key:
93
+ rubygems_version: 3.0.3
94
+ signing_key:
97
95
  specification_version: 4
98
96
  summary: Engine for mailgun hooks
99
97
  test_files: []
@@ -1,22 +0,0 @@
1
- module MailgunCatcher
2
- class EventError < StandardError
3
- attr_reader :event
4
-
5
- def initialize(event)
6
- @event = event
7
- super(event.error_message)
8
- end
9
-
10
- def bugsnag_meta_data
11
- { event_details: event.event_data }
12
- end
13
-
14
- def bugsnag_context
15
- 'mailgun'
16
- end
17
-
18
- def bugsnag_grouping_hash
19
- event.grouping_error_message
20
- end
21
- end
22
- end