zaikio-webhooks 0.0.8 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '008db7504e26ef6d4024f8da17aec260c15fc296db2635bb662b97106f25200f'
|
4
|
+
data.tar.gz: c38d38522192bf514b623f0873ee845ce5d1b7d2a501491cf18e29caa1df08f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7acb6eb1fd4c916108d3ef3f0c63ed4f00f97155d5803f3c8a296ac5232e37dc9b5dc9dcc133331316490547b4c52e11070c1ab5be10529c6cc000f29320806e
|
7
|
+
data.tar.gz: b1831de6855a06e8abd73137ce0149916eba4abc4c8ed90c7c3454694402c5577026247261ada9e75e219cb7c1216005dc1f6b18e3f9589a36dba98196b1ca30
|
data/README.md
CHANGED
@@ -82,7 +82,7 @@ Now you should receive all events you subscribed to.
|
|
82
82
|
When everything is set up you can register events with custom jobs, using the
|
83
83
|
`Zaikio::Webhooks.on` function. This is idempotent and can be safely re-executed.
|
84
84
|
|
85
|
-
|
85
|
+
We can setup an initializer like so:
|
86
86
|
|
87
87
|
```rb
|
88
88
|
# config/initializers/zaikio_webhooks.rb
|
@@ -100,9 +100,6 @@ Rails.application.reloader.to_prepare do
|
|
100
100
|
end
|
101
101
|
```
|
102
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
103
|
## Contributing
|
107
104
|
|
108
105
|
- Make your changes and submit a pull request for them
|
@@ -4,28 +4,33 @@ module Zaikio
|
|
4
4
|
module Webhooks
|
5
5
|
class Event
|
6
6
|
extend Forwardable
|
7
|
-
attr_reader :data
|
8
7
|
|
9
|
-
|
8
|
+
attr_reader :id, :name, :version, :payload, :link, :client_name, :data
|
9
|
+
|
10
|
+
def_delegators :data, :to_h
|
10
11
|
|
11
12
|
def initialize(event_data)
|
12
|
-
|
13
|
+
event_data.each do |key, value|
|
14
|
+
instance_variable_set("@#{key}", value)
|
15
|
+
end
|
16
|
+
|
17
|
+
@data = event_data
|
13
18
|
end
|
14
19
|
|
15
20
|
def created_at
|
16
|
-
DateTime.parse(data
|
21
|
+
DateTime.parse(data["timestamp"])
|
17
22
|
end
|
18
23
|
|
19
24
|
def received_at
|
20
|
-
DateTime.parse(data
|
25
|
+
DateTime.parse(data["received_at"])
|
21
26
|
end
|
22
27
|
|
23
28
|
def subject_id
|
24
|
-
data
|
29
|
+
data["subject"].split("/").last
|
25
30
|
end
|
26
31
|
|
27
32
|
def subject_type
|
28
|
-
data
|
33
|
+
data["subject"].split("/").first == "Org" ? "Organization" : "Person"
|
29
34
|
end
|
30
35
|
|
31
36
|
def ==(other)
|
metadata
CHANGED
@@ -1,29 +1,75 @@
|
|
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.1.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:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actionpack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.2.2
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 6.0.2.2
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activejob
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 6.0.2.2
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '8'
|
20
43
|
type: :runtime
|
21
44
|
prerelease: false
|
22
45
|
version_requirements: !ruby/object:Gem::Requirement
|
23
46
|
requirements:
|
24
47
|
- - ">="
|
25
48
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
49
|
+
version: 6.0.2.2
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '8'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: railties
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 6.0.2.2
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '8'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 6.0.2.2
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '8'
|
27
73
|
description: Handle incoming Zaikio loom webhooks
|
28
74
|
email:
|
29
75
|
- js@crispymtn.com
|
@@ -66,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
112
|
- !ruby/object:Gem::Version
|
67
113
|
version: '0'
|
68
114
|
requirements: []
|
69
|
-
rubygems_version: 3.
|
115
|
+
rubygems_version: 3.2.32
|
70
116
|
signing_key:
|
71
117
|
specification_version: 4
|
72
118
|
summary: Handle incoming Zaikio loom webhooks
|