event_sub_events 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +93 -91
- data/README.md +13 -10
- data/app/controllers/event_sub_events/webhook_controller.rb +6 -2
- data/event_sub_events.gemspec +2 -2
- data/lib/event_sub_events/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7917bc9811dbf6632ff3133eea9164676e4825c4062dc86e40ef44281a0669b1
|
4
|
+
data.tar.gz: 9d4b3bc272648e0ad57513ad52433c28e4fc6337124048f905c2d54deec1d2ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b57ce5290473f2271f35b7de4bf16fe4ab828549914af63a48d23f5a3c23a2df8a2906f53ffad7e4b06ac6896cff0ce36eeb1e116f9a0a9be7e4583f79cc19e
|
7
|
+
data.tar.gz: 7351735ab531d2c164f9fac818e440f76eb3b42af783f42cb3a37fd9ef97f10d7e517826c60a52c9be032969cfcaaf88553ddb5b27b6a330fb1a48ba04d5bda1
|
data/Gemfile.lock
CHANGED
@@ -1,76 +1,77 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
event_sub_events (0.1.
|
4
|
+
event_sub_events (0.1.1)
|
5
5
|
activesupport (>= 3.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (7.1.
|
11
|
-
actionpack (= 7.1.
|
12
|
-
activesupport (= 7.1.
|
10
|
+
actioncable (7.1.3.3)
|
11
|
+
actionpack (= 7.1.3.3)
|
12
|
+
activesupport (= 7.1.3.3)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
15
|
zeitwerk (~> 2.6)
|
16
|
-
actionmailbox (7.1.
|
17
|
-
actionpack (= 7.1.
|
18
|
-
activejob (= 7.1.
|
19
|
-
activerecord (= 7.1.
|
20
|
-
activestorage (= 7.1.
|
21
|
-
activesupport (= 7.1.
|
16
|
+
actionmailbox (7.1.3.3)
|
17
|
+
actionpack (= 7.1.3.3)
|
18
|
+
activejob (= 7.1.3.3)
|
19
|
+
activerecord (= 7.1.3.3)
|
20
|
+
activestorage (= 7.1.3.3)
|
21
|
+
activesupport (= 7.1.3.3)
|
22
22
|
mail (>= 2.7.1)
|
23
23
|
net-imap
|
24
24
|
net-pop
|
25
25
|
net-smtp
|
26
|
-
actionmailer (7.1.
|
27
|
-
actionpack (= 7.1.
|
28
|
-
actionview (= 7.1.
|
29
|
-
activejob (= 7.1.
|
30
|
-
activesupport (= 7.1.
|
26
|
+
actionmailer (7.1.3.3)
|
27
|
+
actionpack (= 7.1.3.3)
|
28
|
+
actionview (= 7.1.3.3)
|
29
|
+
activejob (= 7.1.3.3)
|
30
|
+
activesupport (= 7.1.3.3)
|
31
31
|
mail (~> 2.5, >= 2.5.4)
|
32
32
|
net-imap
|
33
33
|
net-pop
|
34
34
|
net-smtp
|
35
35
|
rails-dom-testing (~> 2.2)
|
36
|
-
actionpack (7.1.
|
37
|
-
actionview (= 7.1.
|
38
|
-
activesupport (= 7.1.
|
36
|
+
actionpack (7.1.3.3)
|
37
|
+
actionview (= 7.1.3.3)
|
38
|
+
activesupport (= 7.1.3.3)
|
39
39
|
nokogiri (>= 1.8.5)
|
40
|
+
racc
|
40
41
|
rack (>= 2.2.4)
|
41
42
|
rack-session (>= 1.0.1)
|
42
43
|
rack-test (>= 0.6.3)
|
43
44
|
rails-dom-testing (~> 2.2)
|
44
45
|
rails-html-sanitizer (~> 1.6)
|
45
|
-
actiontext (7.1.
|
46
|
-
actionpack (= 7.1.
|
47
|
-
activerecord (= 7.1.
|
48
|
-
activestorage (= 7.1.
|
49
|
-
activesupport (= 7.1.
|
46
|
+
actiontext (7.1.3.3)
|
47
|
+
actionpack (= 7.1.3.3)
|
48
|
+
activerecord (= 7.1.3.3)
|
49
|
+
activestorage (= 7.1.3.3)
|
50
|
+
activesupport (= 7.1.3.3)
|
50
51
|
globalid (>= 0.6.0)
|
51
52
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.1.
|
53
|
-
activesupport (= 7.1.
|
53
|
+
actionview (7.1.3.3)
|
54
|
+
activesupport (= 7.1.3.3)
|
54
55
|
builder (~> 3.1)
|
55
56
|
erubi (~> 1.11)
|
56
57
|
rails-dom-testing (~> 2.2)
|
57
58
|
rails-html-sanitizer (~> 1.6)
|
58
|
-
activejob (7.1.
|
59
|
-
activesupport (= 7.1.
|
59
|
+
activejob (7.1.3.3)
|
60
|
+
activesupport (= 7.1.3.3)
|
60
61
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.1.
|
62
|
-
activesupport (= 7.1.
|
63
|
-
activerecord (7.1.
|
64
|
-
activemodel (= 7.1.
|
65
|
-
activesupport (= 7.1.
|
62
|
+
activemodel (7.1.3.3)
|
63
|
+
activesupport (= 7.1.3.3)
|
64
|
+
activerecord (7.1.3.3)
|
65
|
+
activemodel (= 7.1.3.3)
|
66
|
+
activesupport (= 7.1.3.3)
|
66
67
|
timeout (>= 0.4.0)
|
67
|
-
activestorage (7.1.
|
68
|
-
actionpack (= 7.1.
|
69
|
-
activejob (= 7.1.
|
70
|
-
activerecord (= 7.1.
|
71
|
-
activesupport (= 7.1.
|
68
|
+
activestorage (7.1.3.3)
|
69
|
+
actionpack (= 7.1.3.3)
|
70
|
+
activejob (= 7.1.3.3)
|
71
|
+
activerecord (= 7.1.3.3)
|
72
|
+
activesupport (= 7.1.3.3)
|
72
73
|
marcel (~> 1.0)
|
73
|
-
activesupport (7.1.
|
74
|
+
activesupport (7.1.3.3)
|
74
75
|
base64
|
75
76
|
bigdecimal
|
76
77
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -80,31 +81,31 @@ GEM
|
|
80
81
|
minitest (>= 5.1)
|
81
82
|
mutex_m
|
82
83
|
tzinfo (~> 2.0)
|
83
|
-
addressable (2.8.
|
84
|
+
addressable (2.8.6)
|
84
85
|
public_suffix (>= 2.0.2, < 6.0)
|
85
|
-
base64 (0.
|
86
|
-
bigdecimal (3.1.
|
86
|
+
base64 (0.2.0)
|
87
|
+
bigdecimal (3.1.8)
|
87
88
|
builder (3.2.4)
|
88
|
-
concurrent-ruby (1.2.
|
89
|
+
concurrent-ruby (1.2.3)
|
89
90
|
connection_pool (2.4.1)
|
90
|
-
crack (0.
|
91
|
+
crack (1.0.0)
|
92
|
+
bigdecimal
|
91
93
|
rexml
|
92
94
|
crass (1.0.6)
|
93
|
-
date (3.3.
|
94
|
-
diff-lcs (1.5.
|
95
|
-
drb (2.
|
96
|
-
ruby2_keywords
|
95
|
+
date (3.3.4)
|
96
|
+
diff-lcs (1.5.1)
|
97
|
+
drb (2.2.1)
|
97
98
|
erubi (1.12.0)
|
98
99
|
globalid (1.2.1)
|
99
100
|
activesupport (>= 6.1)
|
100
|
-
hashdiff (1.0
|
101
|
-
i18n (1.14.
|
101
|
+
hashdiff (1.1.0)
|
102
|
+
i18n (1.14.5)
|
102
103
|
concurrent-ruby (~> 1.0)
|
103
|
-
io-console (0.
|
104
|
-
irb (1.
|
105
|
-
rdoc
|
106
|
-
reline (>= 0.
|
107
|
-
loofah (2.
|
104
|
+
io-console (0.7.2)
|
105
|
+
irb (1.13.1)
|
106
|
+
rdoc (>= 4.0.0)
|
107
|
+
reline (>= 0.4.2)
|
108
|
+
loofah (2.22.0)
|
108
109
|
crass (~> 1.0.2)
|
109
110
|
nokogiri (>= 1.12.0)
|
110
111
|
mail (2.8.1)
|
@@ -112,27 +113,27 @@ GEM
|
|
112
113
|
net-imap
|
113
114
|
net-pop
|
114
115
|
net-smtp
|
115
|
-
marcel (1.0.
|
116
|
+
marcel (1.0.4)
|
116
117
|
mini_mime (1.1.5)
|
117
|
-
minitest (5.
|
118
|
-
mutex_m (0.
|
119
|
-
net-imap (0.4.
|
118
|
+
minitest (5.23.1)
|
119
|
+
mutex_m (0.2.0)
|
120
|
+
net-imap (0.4.11)
|
120
121
|
date
|
121
122
|
net-protocol
|
122
123
|
net-pop (0.1.2)
|
123
124
|
net-protocol
|
124
|
-
net-protocol (0.2.
|
125
|
+
net-protocol (0.2.2)
|
125
126
|
timeout
|
126
|
-
net-smtp (0.
|
127
|
+
net-smtp (0.5.0)
|
127
128
|
net-protocol
|
128
|
-
nio4r (2.
|
129
|
-
nokogiri (1.
|
129
|
+
nio4r (2.7.3)
|
130
|
+
nokogiri (1.16.5-x86_64-linux)
|
130
131
|
racc (~> 1.4)
|
131
|
-
psych (5.1.
|
132
|
+
psych (5.1.2)
|
132
133
|
stringio
|
133
|
-
public_suffix (5.0.
|
134
|
-
racc (1.
|
135
|
-
rack (3.0.
|
134
|
+
public_suffix (5.0.5)
|
135
|
+
racc (1.8.0)
|
136
|
+
rack (3.0.11)
|
136
137
|
rack-session (2.0.0)
|
137
138
|
rack (>= 3.0.0)
|
138
139
|
rack-test (2.1.0)
|
@@ -140,20 +141,20 @@ GEM
|
|
140
141
|
rackup (2.1.0)
|
141
142
|
rack (>= 3)
|
142
143
|
webrick (~> 1.8)
|
143
|
-
rails (7.1.
|
144
|
-
actioncable (= 7.1.
|
145
|
-
actionmailbox (= 7.1.
|
146
|
-
actionmailer (= 7.1.
|
147
|
-
actionpack (= 7.1.
|
148
|
-
actiontext (= 7.1.
|
149
|
-
actionview (= 7.1.
|
150
|
-
activejob (= 7.1.
|
151
|
-
activemodel (= 7.1.
|
152
|
-
activerecord (= 7.1.
|
153
|
-
activestorage (= 7.1.
|
154
|
-
activesupport (= 7.1.
|
144
|
+
rails (7.1.3.3)
|
145
|
+
actioncable (= 7.1.3.3)
|
146
|
+
actionmailbox (= 7.1.3.3)
|
147
|
+
actionmailer (= 7.1.3.3)
|
148
|
+
actionpack (= 7.1.3.3)
|
149
|
+
actiontext (= 7.1.3.3)
|
150
|
+
actionview (= 7.1.3.3)
|
151
|
+
activejob (= 7.1.3.3)
|
152
|
+
activemodel (= 7.1.3.3)
|
153
|
+
activerecord (= 7.1.3.3)
|
154
|
+
activestorage (= 7.1.3.3)
|
155
|
+
activesupport (= 7.1.3.3)
|
155
156
|
bundler (>= 1.15.0)
|
156
|
-
railties (= 7.1.
|
157
|
+
railties (= 7.1.3.3)
|
157
158
|
rails-dom-testing (2.2.0)
|
158
159
|
activesupport (>= 5.0.0)
|
159
160
|
minitest
|
@@ -161,20 +162,21 @@ GEM
|
|
161
162
|
rails-html-sanitizer (1.6.0)
|
162
163
|
loofah (~> 2.21)
|
163
164
|
nokogiri (~> 1.14)
|
164
|
-
railties (7.1.
|
165
|
-
actionpack (= 7.1.
|
166
|
-
activesupport (= 7.1.
|
165
|
+
railties (7.1.3.3)
|
166
|
+
actionpack (= 7.1.3.3)
|
167
|
+
activesupport (= 7.1.3.3)
|
167
168
|
irb
|
168
169
|
rackup (>= 1.0.0)
|
169
170
|
rake (>= 12.2)
|
170
171
|
thor (~> 1.0, >= 1.2.2)
|
171
172
|
zeitwerk (~> 2.6)
|
172
|
-
rake (13.1
|
173
|
-
rdoc (6.
|
173
|
+
rake (13.2.1)
|
174
|
+
rdoc (6.7.0)
|
174
175
|
psych (>= 4.0.0)
|
175
|
-
reline (0.
|
176
|
+
reline (0.5.7)
|
176
177
|
io-console (~> 0.5)
|
177
|
-
rexml (3.2.
|
178
|
+
rexml (3.2.8)
|
179
|
+
strscan (>= 3.0.9)
|
178
180
|
rspec-core (3.9.3)
|
179
181
|
rspec-support (~> 3.9.3)
|
180
182
|
rspec-expectations (3.9.4)
|
@@ -192,10 +194,10 @@ GEM
|
|
192
194
|
rspec-mocks (~> 3.9.0)
|
193
195
|
rspec-support (~> 3.9.0)
|
194
196
|
rspec-support (3.9.4)
|
195
|
-
|
196
|
-
|
197
|
-
thor (1.3.
|
198
|
-
timeout (0.4.
|
197
|
+
stringio (3.1.0)
|
198
|
+
strscan (3.1.0)
|
199
|
+
thor (1.3.1)
|
200
|
+
timeout (0.4.1)
|
199
201
|
tzinfo (2.0.6)
|
200
202
|
concurrent-ruby (~> 1.0)
|
201
203
|
webmock (1.24.6)
|
@@ -206,7 +208,7 @@ GEM
|
|
206
208
|
websocket-driver (0.7.6)
|
207
209
|
websocket-extensions (>= 0.1.0)
|
208
210
|
websocket-extensions (0.1.5)
|
209
|
-
zeitwerk (2.6.
|
211
|
+
zeitwerk (2.6.15)
|
210
212
|
|
211
213
|
PLATFORMS
|
212
214
|
x86_64-linux
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# EventSubEvents
|
2
2
|
|
3
3
|
EventSub is a Ruby library for Twitch EventSub webhooks. It is built on the [ActiveSupport::Notifications API](http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html).
|
4
4
|
|
@@ -8,21 +8,21 @@ This is forked from [stripe_event](https://github.com/integrallis/stripe_event)
|
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
# Gemfile
|
11
|
-
gem "
|
11
|
+
gem "event_sub_events"
|
12
12
|
```
|
13
13
|
|
14
14
|
```ruby
|
15
15
|
# config/routes.rb
|
16
|
-
mount
|
16
|
+
mount EventSubEvents::Engine, at: "/my-chosen-path"
|
17
17
|
```
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
21
|
```ruby
|
22
|
-
# config/initializers/
|
23
|
-
|
22
|
+
# config/initializers/event_sub_events.rb
|
23
|
+
EventSubEvents.signing_secret = ENV['TWITCH_SIGNING_SECRET']
|
24
24
|
|
25
|
-
|
25
|
+
EventSubEvents.configure do |events|
|
26
26
|
events.subscribe "channel.ban" do |event|
|
27
27
|
event.subscription
|
28
28
|
event.event
|
@@ -34,6 +34,9 @@ EventSub.configure do |events|
|
|
34
34
|
end
|
35
35
|
```
|
36
36
|
|
37
|
+
When a `webhook_callback_verification_pending` event is received, the `event_sub_events` engine will return the
|
38
|
+
`challenge` response automatically.
|
39
|
+
|
37
40
|
### Subscriber objects that respond to #call
|
38
41
|
|
39
42
|
```ruby
|
@@ -55,7 +58,7 @@ end
|
|
55
58
|
```
|
56
59
|
|
57
60
|
```ruby
|
58
|
-
|
61
|
+
EventSubEvents.configure do |events|
|
59
62
|
events.all BillingEventLogger.new(Rails.logger)
|
60
63
|
events.subscribe 'customer.created', CustomerCreated.new
|
61
64
|
end
|
@@ -71,7 +74,7 @@ Verifying this signature lets your application properly authenticate the request
|
|
71
74
|
Please set the `signing_secret` configuration value:
|
72
75
|
|
73
76
|
```ruby
|
74
|
-
|
77
|
+
EventSubEvents.signing_secret = "abc123"
|
75
78
|
```
|
76
79
|
|
77
80
|
Please refer to [Twitch's documentation](https://dev.twitch.tv/docs/eventsub/handling-webhook-events/#verifying-the-event-message) for more details
|
@@ -81,7 +84,7 @@ Please refer to [Twitch's documentation](https://dev.twitch.tv/docs/eventsub/han
|
|
81
84
|
You can also supply multiple secrets by sending an array to `signing_secrets` like so:
|
82
85
|
|
83
86
|
```ruby
|
84
|
-
|
87
|
+
EventSubEvents.signing_secrets = [
|
85
88
|
"abc123",
|
86
89
|
"123abc"
|
87
90
|
]
|
@@ -89,7 +92,7 @@ EventSub.signing_secrets = [
|
|
89
92
|
|
90
93
|
## Contributing
|
91
94
|
|
92
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/eventsub-
|
95
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/deanpcmad/eventsub-events.
|
93
96
|
|
94
97
|
## License
|
95
98
|
|
@@ -6,8 +6,12 @@ module EventSubEvents
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def event
|
9
|
-
|
10
|
-
|
9
|
+
if params[:challenge]
|
10
|
+
render plain: params[:challenge]
|
11
|
+
else
|
12
|
+
EventSubEvents.instrument(verified_event)
|
13
|
+
head :ok
|
14
|
+
end
|
11
15
|
rescue EventSubEvents::SignatureVerificationError => e
|
12
16
|
render plain: e, status: :bad_request
|
13
17
|
end
|
data/event_sub_events.gemspec
CHANGED
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.license = "MIT"
|
16
16
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/deanpcmad/eventsub-events"
|
20
20
|
|
21
21
|
# Specify which files should be added to the gem when it is released.
|
22
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_sub_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dean Perry
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.9'
|
83
|
-
description:
|
83
|
+
description:
|
84
84
|
email: dean@deanpcmad.com
|
85
85
|
executables: []
|
86
86
|
extensions: []
|
@@ -107,8 +107,10 @@ files:
|
|
107
107
|
homepage: https://deanpcmad.com
|
108
108
|
licenses:
|
109
109
|
- MIT
|
110
|
-
metadata:
|
111
|
-
|
110
|
+
metadata:
|
111
|
+
homepage_uri: https://deanpcmad.com
|
112
|
+
source_code_uri: https://github.com/deanpcmad/eventsub-events
|
113
|
+
post_install_message:
|
112
114
|
rdoc_options: []
|
113
115
|
require_paths:
|
114
116
|
- lib
|
@@ -123,8 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
125
|
- !ruby/object:Gem::Version
|
124
126
|
version: '0'
|
125
127
|
requirements: []
|
126
|
-
rubygems_version: 3.
|
127
|
-
signing_key:
|
128
|
+
rubygems_version: 3.5.9
|
129
|
+
signing_key:
|
128
130
|
specification_version: 4
|
129
131
|
summary: Twitch EventSub webhook integration for Rails apps
|
130
132
|
test_files: []
|