zaikio-webhooks 0.0.1 → 0.0.2

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: 5bb848ff135992c72aa0b2a6d51478644a2d75540ea64844b971f9008c8d6a77
4
- data.tar.gz: ce31b188140afc2fd67a8abf661198ef6653ca8effd9f83f6881da052d74e7ff
3
+ metadata.gz: b0ee2ef247126427165c340256d3cfba655163fb972af0ca7432325b458dc66c
4
+ data.tar.gz: c46971db7afb01ad0737eb944b8c3436fe1a06428663a0ffb5443fc270743582
5
5
  SHA512:
6
- metadata.gz: 55f9724010b083168d0673dac2a7e5260ac942ab137d2e7e30a7ca5c0cf85a1c1828d778a8495f63558e98315006069472f6c9ad8c11792c545174b8f58fce00
7
- data.tar.gz: d38e8ca4638c8cd650a2c6e69340cbe928170582b5ac028a03f0f0cd9da7fb20a8156c6adbd3b2cfdd57292cc16d42b81b6609ac086e55fbf4796d4546858a66
6
+ metadata.gz: 7aba2a560667865fbc588bc096fa042db1a5f7436ff962d34f63ece00ca7ac98798346f390b0fc03ea5f7f59cfc9fb8fc741807d6ef0f6fe9a9549bc7874b415
7
+ data.tar.gz: b970e85c1793d09f67e6fa6b691aae310e1d6f17f9fc8c5c14903321d22d8e2484ec22ab9d321d123814f638cfbfb57596ab821f8c0e5e80e541ddf29d94d95a
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module Webhooks
3
- VERSION = "0.0.1".freeze
3
+ VERSION = "0.0.2".freeze
4
4
  end
5
5
  end
@@ -6,10 +6,23 @@ module Zaikio
6
6
  module Webhooks
7
7
  class << self
8
8
  attr_accessor :configuration
9
+ attr_reader :webhooks
9
10
 
10
11
  def configure
11
12
  self.configuration ||= Configuration.new
12
13
  yield(configuration)
14
+ @after_configuration_callbacks ||= []
15
+ (@after_configuration_callbacks || []).each(&:call)
16
+ @after_configuration_callbacks = []
17
+ end
18
+
19
+ def after_configuration(&block)
20
+ if configuration
21
+ yield
22
+ else
23
+ @after_configuration_callbacks ||= []
24
+ @after_configuration_callbacks << block
25
+ end
13
26
  end
14
27
 
15
28
  def reset
@@ -23,14 +36,16 @@ module Zaikio
23
36
  def on(event_name, job_klass, client_name: nil, perform_now: false)
24
37
  @webhooks ||= {}
25
38
 
26
- client_names = Array(client_name || configuration.all_client_names).map(&:to_s)
27
- client_names.each do |name|
28
- @webhooks[name] ||= {}
29
- @webhooks[name][event_name.to_s] ||= []
30
- @webhooks[name][event_name.to_s] << {
31
- perform_now: perform_now,
32
- job_klass: job_klass
33
- }
39
+ after_configuration do
40
+ client_names = Array(client_name || configuration.all_client_names).map(&:to_s)
41
+ client_names.each do |name|
42
+ @webhooks[name] ||= {}
43
+ @webhooks[name][event_name.to_s] ||= []
44
+ @webhooks[name][event_name.to_s] << {
45
+ perform_now: perform_now,
46
+ job_klass: job_klass
47
+ }
48
+ end
34
49
  end
35
50
  end
36
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GmbH