zaikio-webhooks 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +38 -7
- data/lib/zaikio/webhooks.rb +1 -0
- data/lib/zaikio/webhooks/configuration.rb +1 -1
- data/lib/zaikio/webhooks/event.rb +1 -0
- data/lib/zaikio/webhooks/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e420117c2009934fc5c4ee8281ee573524049248150d8736f186873058f285ea
|
4
|
+
data.tar.gz: fca8d5cce41d584140ee826923f0bf953964dc9c391d5fc15859260943ae8f13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ac964b2e38bf3545881626c30ba5b5832e2fb0183ab45a90d8e839b7d36533537337085fe5622388529e97e9ef529c6d38bdd3c6ac7deb10ac639f717c0b70f
|
7
|
+
data.tar.gz: 8cbbb481eafb8d6e853351fde476ec0db1b7716013a49d7aa106be96eefee3630743f0e30a7fe16cf3f7fd0865a3eaf0d81cecdf8efc0c2a0230a8fd4edd69d5
|
data/README.md
CHANGED
@@ -34,13 +34,6 @@ Zaikio::Webhooks.configure do |config|
|
|
34
34
|
my_other_app.shared_secret = "test-secret"
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
38
|
-
# Perform job immediately, for all clients
|
39
|
-
Zaikio::Webhooks.on "directory.revoked_access_token", RevokeAccessTokenJob,
|
40
|
-
perform_now: true
|
41
|
-
# Only for a specific client
|
42
|
-
Zaikio::Webhooks.on "directory.machine_added", AddMachineJob,
|
43
|
-
client_name: :my_app
|
44
37
|
```
|
45
38
|
|
46
39
|
### 3. Mount Engine
|
@@ -83,3 +76,41 @@ end
|
|
83
76
|
Login to [Zaikio Hub](https://directory.zaikio.com/) and go to your Apps and go to Edit App and add your webhook URL e.g. `https://mydomain.de/zaikio/webhook/my_app_name`.
|
84
77
|
|
85
78
|
Now you should receive all events you subscribed to.
|
79
|
+
|
80
|
+
### 7. Usage
|
81
|
+
|
82
|
+
When everything is set up you can register events with custom jobs, using the
|
83
|
+
`Zaikio::Webhooks.on` function. This is idempotent and can be safely re-executed.
|
84
|
+
|
85
|
+
For Rails 6.0 and above, we can setup an initializer like so:
|
86
|
+
|
87
|
+
```rb
|
88
|
+
# config/initializers/zaikio_webhooks.rb
|
89
|
+
|
90
|
+
# We need to add this special wrapper here because we're referencing autoloaded constants
|
91
|
+
# (RevokeAccessTokenJob, AddMachineJob) at boot time. For more information, see:
|
92
|
+
# https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots
|
93
|
+
Rails.application.reloader.to_prepare do
|
94
|
+
# Perform job immediately, for all clients
|
95
|
+
Zaikio::Webhooks.on "directory.revoked_access_token", RevokeAccessTokenJob,
|
96
|
+
perform_now: true
|
97
|
+
# Only for a specific client
|
98
|
+
Zaikio::Webhooks.on "directory.machine_added", AddMachineJob,
|
99
|
+
client_name: :my_app
|
100
|
+
end
|
101
|
+
```
|
102
|
+
|
103
|
+
If you're using a Rails v5.2 or less, you can skip the outer `Rails.application.reloader`
|
104
|
+
block and just use the inner section directly.
|
105
|
+
|
106
|
+
## Contributing
|
107
|
+
|
108
|
+
- Make your changes and submit a pull request for them
|
109
|
+
- Make sure to update `CHANGELOG.md`
|
110
|
+
|
111
|
+
To release a new version of the gem:
|
112
|
+
- Update the version in `lib/zaikio/webhooks/version.rb`
|
113
|
+
- Update `CHANGELOG.md` to include the new version and its release date
|
114
|
+
- Commit and push your changes
|
115
|
+
- Create a [new release on GitHub](https://github.com/zaikio/zaikio-webhooks/releases/new)
|
116
|
+
- CircleCI will build the Gem package and push it Rubygems for you
|
data/lib/zaikio/webhooks.rb
CHANGED
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.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zaikio GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -51,10 +51,12 @@ files:
|
|
51
51
|
- lib/zaikio/webhooks/event.rb
|
52
52
|
- lib/zaikio/webhooks/event_serializer.rb
|
53
53
|
- lib/zaikio/webhooks/version.rb
|
54
|
-
homepage: https://
|
54
|
+
homepage: https://github.com/zaikio/zaikio-webhooks
|
55
55
|
licenses:
|
56
56
|
- MIT
|
57
|
-
metadata:
|
57
|
+
metadata:
|
58
|
+
changelog_uri: https://github.com/zaikio/zaikio-webhooks/blob/main/CHANGELOG.md
|
59
|
+
source_code_uri: https://github.com/zaikio/zaikio-webhooks
|
58
60
|
post_install_message:
|
59
61
|
rdoc_options: []
|
60
62
|
require_paths:
|
@@ -63,14 +65,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
63
65
|
requirements:
|
64
66
|
- - ">="
|
65
67
|
- !ruby/object:Gem::Version
|
66
|
-
version:
|
68
|
+
version: 2.6.5
|
67
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
70
|
requirements:
|
69
71
|
- - ">="
|
70
72
|
- !ruby/object:Gem::Version
|
71
73
|
version: '0'
|
72
74
|
requirements: []
|
73
|
-
rubygems_version: 3.1.
|
75
|
+
rubygems_version: 3.1.4
|
74
76
|
signing_key:
|
75
77
|
specification_version: 4
|
76
78
|
summary: Handle incoming Zaikio loom webhooks
|