zaikio-webhooks 0.1.0 → 0.2.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: '008db7504e26ef6d4024f8da17aec260c15fc296db2635bb662b97106f25200f'
4
- data.tar.gz: c38d38522192bf514b623f0873ee845ce5d1b7d2a501491cf18e29caa1df08f0
3
+ metadata.gz: b1041992660107d3cd89e5a14f95251a24163adf6a2933e9cad959f1827e1b06
4
+ data.tar.gz: 73a2c6ad3b1eece070faf9aafe0217991cf4b4bb89284c49c05a02f333c2400c
5
5
  SHA512:
6
- metadata.gz: 7acb6eb1fd4c916108d3ef3f0c63ed4f00f97155d5803f3c8a296ac5232e37dc9b5dc9dcc133331316490547b4c52e11070c1ab5be10529c6cc000f29320806e
7
- data.tar.gz: b1831de6855a06e8abd73137ce0149916eba4abc4c8ed90c7c3454694402c5577026247261ada9e75e219cb7c1216005dc1f6b18e3f9589a36dba98196b1ca30
6
+ metadata.gz: 6c987086f8a0dd42f0fc273646f9519fd1a162816339b0056d25f20246202888afce2ff97cbe8ffd2b2ac086cf65f845d69772641b63801f242e45789ffa69ba
7
+ data.tar.gz: 4ac9e4e65fa8abc15e0860bfc980b625948894e31443d8ff1c5573f8956f559a000e746690d5bf4a9a83e659a4bc7ac7af61731caa6fcc4d4b25180042962521
data/README.md CHANGED
@@ -96,7 +96,7 @@ Rails.application.reloader.to_prepare do
96
96
  perform_now: true
97
97
  # Only for a specific client
98
98
  Zaikio::Webhooks.on "directory.machine_added", AddMachineJob,
99
- client_name: :my_app
99
+ client_name: :my_app, options: { custom_keyword_argument_for_job: "value" }
100
100
  end
101
101
  ```
102
102
 
@@ -8,7 +8,7 @@ module Zaikio
8
8
  Zaikio::Webhooks.webhooks_for(params[:client_name], event_params[:name])
9
9
  .each do |job_klass, options|
10
10
  job_klass.public_send(options[:perform_now] ? :perform_now : :perform_later,
11
- Zaikio::Webhooks::Event.new(event_params))
11
+ Zaikio::Webhooks::Event.new(event_params), **options[:options])
12
12
  end
13
13
 
14
14
  head :ok
@@ -10,6 +10,8 @@ module Zaikio
10
10
  def_delegators :data, :to_h
11
11
 
12
12
  def initialize(event_data)
13
+ event_data = event_data.to_h.stringify_keys
14
+
13
15
  event_data.each do |key, value|
14
16
  instance_variable_set("@#{key}", value)
15
17
  end
@@ -1,5 +1,5 @@
1
1
  module Zaikio
2
2
  module Webhooks
3
- VERSION = "0.1.0".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
@@ -35,7 +35,7 @@ module Zaikio
35
35
  (@webhooks.dig(client_name.to_s, event_name.to_s) || {})
36
36
  end
37
37
 
38
- def on(event_name, job_klass, client_name: nil, perform_now: false)
38
+ def on(event_name, job_klass, client_name: nil, perform_now: false, options: {})
39
39
  @webhooks ||= {}
40
40
 
41
41
  after_configuration do
@@ -44,7 +44,8 @@ module Zaikio
44
44
  @webhooks[name] ||= {}
45
45
  @webhooks[name][event_name.to_s] ||= {}
46
46
  @webhooks[name][event_name.to_s][job_klass] = {
47
- perform_now: perform_now
47
+ perform_now: perform_now,
48
+ options: options
48
49
  }
49
50
  end
50
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zaikio-webhooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zaikio GmbH
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-04 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack