mailgun_catcher 0.5.0 → 0.6.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
  SHA256:
3
- metadata.gz: 72996a9954d2d973e56fe1572535207f150fe23a4f69fa92edd9d72c4d81c866
4
- data.tar.gz: a71ee0b5c51e276d045370510caa1ffb967e68538ed31636fca5f4f27c0b74c0
3
+ metadata.gz: '0270498476a1593def739a98a0ab51ae7ddd3a0b1a6fd81dd6acfc43a71e6094'
4
+ data.tar.gz: 657dda987c902da1ca6adaa8ea4c84fcbb2d54db8dca76d23d746e0ec0b93580
5
5
  SHA512:
6
- metadata.gz: 182ddabb4857b6223b360b2b03d92f1888a723bef5dcf198b97ce30f4281dd02cb6d832ffa2287e4b720482b2e04c58684dd3a762e249b1bed61d2f8bf4171c6
7
- data.tar.gz: 14ede4ceb20f545d54461faff56fb3162a23958ee81e8e5dc7cde95970b1c8f2d98b6d4f701fa769e8792ae3f6268d517779226c509d715b4d0c39b424dd7e94
6
+ metadata.gz: 4637dd0b9ef40b94a2239b77188c34968d6b6bad0a7ba071bdf4a7ef5829aaf626dc73debd64902ec6655441c4c00be3f3e66cdc9742047d2e206441b08d53ce
7
+ data.tar.gz: a8f5c80ba263cde8932dc32f0a77397758523da0784c8dc3ce3c424f6068404e71e8ab190a4f6ec1edff27e4c4f8134e9cb29c5995437f08d14132e204e7701e
data/README.md CHANGED
@@ -27,6 +27,24 @@ This will allow you change the default webhook route from `/webhooks` to `/custo
27
27
  Configure webhook on mailgun:
28
28
  ![](http://take.ms/HZRmm)
29
29
 
30
+ ## Notifiers
31
+ Library supports event dispatching via notifier. Notifier is any object that responds to `notify` message. By default, events are notified on Bugsnag service, but you can provide your own notifier implementation by configuring `MailgunCatcher.config.notifier`.
32
+
33
+ ### Configuring custom notifier
34
+ ```ruby
35
+ class MailgunNotifier
36
+ def notify(event)
37
+ puts event
38
+ end
39
+ end
40
+ ```
41
+
42
+ register custom notifier implementation through initializer
43
+ ```ruby
44
+ MailgunCatcher.setup do |config|
45
+ config.notifier = MailgunNotifier.new
46
+ end
47
+ ```
30
48
 
31
49
  ## Contributing
32
50
  Contribution directions go here.
@@ -1,7 +1,7 @@
1
1
  module MailgunCatcher
2
2
  class WebhooksController < MailgunCatcher::ApplicationController
3
3
  def create
4
- MailgunCatcher::Event.new(params).notify_bugsnag
4
+ MailgunCatcher::Event.new(params).notify
5
5
  head :ok
6
6
  end
7
7
  end
@@ -2,7 +2,14 @@ require 'dry-configurable'
2
2
  require 'mailgun_catcher/engine'
3
3
  require 'mailgun_catcher/event'
4
4
  require 'mailgun_catcher/event_error'
5
+ require 'mailgun_catcher/notifier/bugsnag'
5
6
 
6
7
  module MailgunCatcher
7
- # Your code goes here...
8
+ extend Dry::Configurable
9
+
10
+ setting(:notifier, MailgunCatcher::Notifier::Bugsnag.new)
11
+
12
+ def self.setup
13
+ yield config
14
+ end
8
15
  end
@@ -6,8 +6,8 @@ module MailgunCatcher
6
6
  @params = params.to_unsafe_h
7
7
  end
8
8
 
9
- def notify_bugsnag
10
- Bugsnag.notify(EventError.new(self))
9
+ def notify
10
+ MailgunCatcher.config.notifier.notify(EventError.new(self))
11
11
  end
12
12
 
13
13
  def error_message
@@ -0,0 +1,9 @@
1
+ module MailgunCatcher
2
+ module Notifier
3
+ class Bugsnag
4
+ def notify(event)
5
+ Bugsnag.notify(event)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module MailgunCatcher
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.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.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stjepan Hadjić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-07 00:00:00.000000000 Z
11
+ date: 2019-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bugsnag
@@ -69,6 +69,7 @@ files:
69
69
  - lib/mailgun_catcher/engine.rb
70
70
  - lib/mailgun_catcher/event.rb
71
71
  - lib/mailgun_catcher/event_error.rb
72
+ - lib/mailgun_catcher/notifier/bugsnag.rb
72
73
  - lib/mailgun_catcher/version.rb
73
74
  homepage: https://github.com/infinum/rails-infinum-mailgun_catcher
74
75
  licenses: