webhook_system 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +29 -24
- data/.github/workflows/rubocop-challenger.yml +26 -0
- data/.gitignore +10 -1
- data/.rubocop.hound.yml +10 -32
- data/.rubocop.yml +8 -10
- data/.rubocop_todo.yml +177 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +1 -0
- data/README.md +17 -1
- data/Rakefile +2 -0
- data/gemfiles/rails_4.2.gemfile +2 -0
- data/gemfiles/rails_4.2.gemfile.lock +46 -14
- data/gemfiles/rails_5.0.gemfile +2 -0
- data/gemfiles/rails_5.1.gemfile +2 -0
- data/gemfiles/{rails_5_2.gemfile → rails_5.2.gemfile} +2 -0
- data/gemfiles/rails_6.0.gemfile +2 -0
- data/gemfiles/rails_6.1.gemfile +2 -0
- data/gemfiles/rails_7.0.gemfile +6 -0
- data/lib/webhook_system/base_event.rb +2 -0
- data/lib/webhook_system/encoder.rb +2 -0
- data/lib/webhook_system/event_log.rb +2 -0
- data/lib/webhook_system/job.rb +3 -1
- data/lib/webhook_system/subscription.rb +2 -0
- data/lib/webhook_system/subscription_topic.rb +2 -0
- data/lib/webhook_system/version.rb +3 -1
- data/lib/webhook_system.rb +2 -0
- data/webhook_system.gemspec +22 -4
- metadata +25 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: afdbd7185d9cb4993052c2c5f7435d8b469f2d2623d31b63aadcd6aefd3e3c71
|
4
|
+
data.tar.gz: 05c32f9c6392d3fd9d3d9adf41fa8e21b21dafc8b87a9efd9b4236bf87137fbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66c102424aae48aa1d133abf5cd88c5233227e1c6b3604bf0c89558736d361c376b2c046e73031bdf5f0a3689c128e26188eae4188961ec476b410cf6f4da061
|
7
|
+
data.tar.gz: d03f803f206adcc70022a603b9ef02ba9a634e238924fd2a4b6cdf2c003e21c0783e4182ab09d9c5c326e727b64274eeb48bc9e7fc9b241bcf8e25740492e4bc
|
data/.github/workflows/build.yml
CHANGED
@@ -15,30 +15,35 @@ jobs:
|
|
15
15
|
strategy:
|
16
16
|
fail-fast: false
|
17
17
|
matrix:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
-
|
22
|
-
|
23
|
-
-
|
24
|
-
|
25
|
-
-
|
26
|
-
|
27
|
-
- rails_6.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
18
|
+
gemfile: ["rails_7.0"]
|
19
|
+
ruby: [2.7]
|
20
|
+
include:
|
21
|
+
- gemfile: rails_7.0
|
22
|
+
ruby: '3.1'
|
23
|
+
- gemfile: rails_6.1
|
24
|
+
ruby: '3.1'
|
25
|
+
- gemfile: rails_7.0
|
26
|
+
ruby: '3.0'
|
27
|
+
- gemfile: rails_6.1
|
28
|
+
ruby: '3.0'
|
29
|
+
- gemfile: rails_6.1
|
30
|
+
ruby: 2.7
|
31
|
+
- gemfile: rails_6.1
|
32
|
+
ruby: 2.6
|
33
|
+
- gemfile: rails_6.0
|
34
|
+
ruby: 2.7
|
35
|
+
- gemfile: rails_6.0
|
36
|
+
ruby: 2.6
|
37
|
+
- gemfile: rails_5.2
|
38
|
+
ruby: 2.6
|
39
|
+
- gemfile: rails_5.1
|
40
|
+
ruby: 2.6
|
41
|
+
- gemfile: rails_5.0
|
42
|
+
ruby: 2.6
|
43
|
+
- gemfile: rails_4.2
|
44
|
+
ruby: 2.6
|
45
|
+
- gemfile: rails_4.2
|
46
|
+
ruby: 2.5
|
42
47
|
|
43
48
|
env:
|
44
49
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: "RuboCop Challenge"
|
2
|
+
|
3
|
+
on:
|
4
|
+
schedule:
|
5
|
+
- cron: '30 23 * * 2,3,4' # この設定の場合、火水木のAM8:30に自動でPRが作られます。
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
create-pr:
|
9
|
+
name: Create Pull Request
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2
|
13
|
+
- name: Set up Ruby 2.7
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 2.7.5
|
17
|
+
- name: Install bundler
|
18
|
+
run: gem install bundler
|
19
|
+
- name: Install gems
|
20
|
+
run: bundle install --jobs 4 --retry 3
|
21
|
+
- name: Set git configuration
|
22
|
+
run: git config remote.origin.url "git@github.com:payrollhero/webhook_system.git" # プロジェクトごとに変わる値です。
|
23
|
+
- name: Create RuboCop challenge pull request
|
24
|
+
env:
|
25
|
+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
26
|
+
run: bundle exec rubocop_challenger go --base-branch=master --email=rubocop-challenger@example.com --name="Rubocop Challenger"
|
data/.gitignore
CHANGED
@@ -1,8 +1,17 @@
|
|
1
|
+
# we don't commit .lock files
|
1
2
|
Gemfile.lock
|
3
|
+
gemfiles/*.lock
|
4
|
+
|
2
5
|
doc/
|
3
6
|
pkg/
|
4
7
|
*.db
|
5
8
|
tmp/
|
9
|
+
|
10
|
+
# this is a good file to apps, not for gems
|
6
11
|
.ruby-version
|
7
|
-
|
12
|
+
|
13
|
+
# don't want to be annoyed with gem builds
|
8
14
|
webhook_system-*.gem
|
15
|
+
|
16
|
+
# so rubocop-challenger does not complain about uncommited files
|
17
|
+
.bundle/*
|
data/.rubocop.hound.yml
CHANGED
@@ -13,7 +13,7 @@ Style/CollectionMethods:
|
|
13
13
|
find: detect
|
14
14
|
find_all: select
|
15
15
|
reduce: inject
|
16
|
-
|
16
|
+
Layout/DotPosition:
|
17
17
|
Description: Checks the position of the dot in multi-line method calls.
|
18
18
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
|
19
19
|
Enabled: true
|
@@ -21,11 +21,7 @@ Style/DotPosition:
|
|
21
21
|
SupportedStyles:
|
22
22
|
- leading
|
23
23
|
- trailing
|
24
|
-
|
25
|
-
Description: Use snake_case for source file names.
|
26
|
-
StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
|
27
|
-
Enabled: false
|
28
|
-
Exclude: []
|
24
|
+
|
29
25
|
Style/GuardClause:
|
30
26
|
Description: Check for conditionals that can be replaced with guard clauses
|
31
27
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
|
@@ -35,7 +31,6 @@ Style/IfUnlessModifier:
|
|
35
31
|
Description: Favor modifier if/unless usage when you have a single-line body.
|
36
32
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
|
37
33
|
Enabled: false
|
38
|
-
MaxLineLength: 80
|
39
34
|
Style/OptionHash:
|
40
35
|
Description: Don't use option hashes when you can use keyword arguments.
|
41
36
|
Enabled: false
|
@@ -53,7 +48,7 @@ Style/PercentLiteralDelimiters:
|
|
53
48
|
"%w": "()"
|
54
49
|
"%W": "()"
|
55
50
|
"%x": "()"
|
56
|
-
|
51
|
+
Naming/PredicateName:
|
57
52
|
Description: Check the names of predicate methods.
|
58
53
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
|
59
54
|
Enabled: true
|
@@ -61,7 +56,7 @@ Style/PredicateName:
|
|
61
56
|
- is_
|
62
57
|
- has_
|
63
58
|
- have_
|
64
|
-
|
59
|
+
ForbiddenPrefixes:
|
65
60
|
- is_
|
66
61
|
Exclude:
|
67
62
|
- spec/**/*
|
@@ -114,24 +109,9 @@ Style/StringLiteralsInInterpolation:
|
|
114
109
|
SupportedStyles:
|
115
110
|
- single_quotes
|
116
111
|
- double_quotes
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
Enabled: false
|
121
|
-
EnforcedStyleForMultiline: no_comma
|
122
|
-
SupportedStyles:
|
123
|
-
- comma
|
124
|
-
- consistent_comma
|
125
|
-
- no_comma
|
126
|
-
Style/TrailingCommaInLiteral:
|
127
|
-
Description: 'Checks for trailing comma in array and hash literals.'
|
128
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
129
|
-
Enabled: false
|
130
|
-
EnforcedStyleForMultiline: no_comma
|
131
|
-
SupportedStyles:
|
132
|
-
- comma
|
133
|
-
- consistent_comma
|
134
|
-
- no_comma
|
112
|
+
|
113
|
+
|
114
|
+
|
135
115
|
Metrics/AbcSize:
|
136
116
|
Description: A calculated magnitude based on number of assignments, branches, and
|
137
117
|
conditions.
|
@@ -177,7 +157,7 @@ Lint/AssignmentInCondition:
|
|
177
157
|
Style/InlineComment:
|
178
158
|
Description: Avoid inline comments.
|
179
159
|
Enabled: false
|
180
|
-
|
160
|
+
Naming/AccessorMethodName:
|
181
161
|
Description: Check the naming of accessor methods for get_/set_.
|
182
162
|
Enabled: false
|
183
163
|
Style/Alias:
|
@@ -231,13 +211,11 @@ Style/WhenThen:
|
|
231
211
|
Lint/EachWithObjectArgument:
|
232
212
|
Description: Check for immutable argument given to each_with_object.
|
233
213
|
Enabled: true
|
234
|
-
Lint/
|
214
|
+
Lint/SuppressedException:
|
235
215
|
Description: Don't suppress exception.
|
236
216
|
StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
|
237
217
|
Enabled: false
|
238
|
-
|
239
|
-
Description: Checks of literals used in conditions.
|
240
|
-
Enabled: false
|
218
|
+
|
241
219
|
Lint/LiteralInInterpolation:
|
242
220
|
Description: Checks for literals used in interpolation.
|
243
221
|
Enabled: false
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
inherit_from:
|
2
|
-
|
2
|
+
- .rubocop_todo.yml
|
3
|
+
- .rubocop.hound.yml
|
3
4
|
|
4
5
|
AllCops:
|
6
|
+
NewCops: enable
|
5
7
|
Exclude:
|
6
8
|
- '*.gemspec'
|
7
9
|
- 'Gemfile'
|
@@ -9,13 +11,13 @@ AllCops:
|
|
9
11
|
Style/Lambda:
|
10
12
|
Enabled: false
|
11
13
|
|
12
|
-
|
14
|
+
Layout/EmptyLinesAroundClassBody:
|
13
15
|
Enabled: false
|
14
16
|
|
15
|
-
|
17
|
+
Layout/EmptyLinesAroundModuleBody:
|
16
18
|
Enabled: false
|
17
19
|
|
18
|
-
|
20
|
+
Layout/EmptyLinesAroundMethodBody:
|
19
21
|
Enabled: false
|
20
22
|
|
21
23
|
Style/ClassCheck:
|
@@ -25,7 +27,7 @@ Style/ClassCheck:
|
|
25
27
|
Style/StringLiterals:
|
26
28
|
Enabled: false
|
27
29
|
|
28
|
-
|
30
|
+
Naming/FileName:
|
29
31
|
Enabled: false
|
30
32
|
|
31
33
|
Style/RedundantException:
|
@@ -37,12 +39,8 @@ Style/SignalException:
|
|
37
39
|
Style/BlockDelimiters:
|
38
40
|
Enabled: false
|
39
41
|
|
40
|
-
Style/CollectionMethods:
|
41
|
-
PreferredMethods:
|
42
|
-
detect: find
|
43
|
-
|
44
42
|
# Github's PR width is 120 characters
|
45
|
-
|
43
|
+
Layout/LineLength:
|
46
44
|
Max: 120
|
47
45
|
AllowURI: true
|
48
46
|
Exclude:
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-04-27 12:05:35 UTC using RuboCop version 1.28.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# This cop supports safe auto-correction (--auto-correct).
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
+
# Include: **/*.gemfile, **/Gemfile, **/gems.rb
|
13
|
+
Bundler/OrderedGems:
|
14
|
+
Exclude:
|
15
|
+
- 'gemfiles/rails_6.1.gemfile'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# This cop supports safe auto-correction (--auto-correct).
|
19
|
+
# Configuration parameters: EnforcedStyle.
|
20
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
21
|
+
Layout/EmptyLinesAroundBlockBody:
|
22
|
+
Exclude:
|
23
|
+
- 'spec/encoder_spec.rb'
|
24
|
+
|
25
|
+
# Offense count: 2
|
26
|
+
# This cop supports safe auto-correction (--auto-correct).
|
27
|
+
# Configuration parameters: EnforcedStyle.
|
28
|
+
# SupportedStyles: space, no_space
|
29
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
30
|
+
Exclude:
|
31
|
+
- 'lib/webhook_system/base_event.rb'
|
32
|
+
- 'lib/webhook_system/job.rb'
|
33
|
+
|
34
|
+
# Offense count: 1
|
35
|
+
# This cop supports safe auto-correction (--auto-correct).
|
36
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
37
|
+
# SupportedStylesForExponentOperator: space, no_space
|
38
|
+
Layout/SpaceAroundOperators:
|
39
|
+
Exclude:
|
40
|
+
- 'lib/webhook_system/subscription.rb'
|
41
|
+
|
42
|
+
# Offense count: 2
|
43
|
+
# This cop supports safe auto-correction (--auto-correct).
|
44
|
+
# Configuration parameters: EnforcedStyle.
|
45
|
+
# SupportedStyles: require_no_space, require_space
|
46
|
+
Layout/SpaceInLambdaLiteral:
|
47
|
+
Exclude:
|
48
|
+
- 'lib/webhook_system/subscription.rb'
|
49
|
+
|
50
|
+
# Offense count: 2
|
51
|
+
# This cop supports safe auto-correction (--auto-correct).
|
52
|
+
Lint/DeprecatedOpenSSLConstant:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/webhook_system/encoder.rb'
|
55
|
+
|
56
|
+
# Offense count: 1
|
57
|
+
# This cop supports unsafe auto-correction (--auto-correct-all).
|
58
|
+
Lint/NonDeterministicRequireOrder:
|
59
|
+
Exclude:
|
60
|
+
- 'spec/spec_helper.rb'
|
61
|
+
|
62
|
+
# Offense count: 1
|
63
|
+
Lint/UnreachableCode:
|
64
|
+
Exclude:
|
65
|
+
- 'lib/webhook_system/job.rb'
|
66
|
+
|
67
|
+
# Offense count: 11
|
68
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
69
|
+
# IgnoredMethods: refine
|
70
|
+
Metrics/BlockLength:
|
71
|
+
Max: 112
|
72
|
+
|
73
|
+
# Offense count: 1
|
74
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
75
|
+
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
|
76
|
+
Naming/MethodParameterName:
|
77
|
+
Exclude:
|
78
|
+
- 'lib/webhook_system/encoder.rb'
|
79
|
+
|
80
|
+
# Offense count: 1
|
81
|
+
# This cop supports safe auto-correction (--auto-correct).
|
82
|
+
# Configuration parameters: PreferredName.
|
83
|
+
Naming/RescuedExceptionsVariableName:
|
84
|
+
Exclude:
|
85
|
+
- 'lib/webhook_system/job.rb'
|
86
|
+
|
87
|
+
# Offense count: 2
|
88
|
+
# This cop supports safe auto-correction (--auto-correct).
|
89
|
+
Security/JSONLoad:
|
90
|
+
Exclude:
|
91
|
+
- 'lib/webhook_system/encoder.rb'
|
92
|
+
|
93
|
+
# Offense count: 1
|
94
|
+
# This cop supports safe auto-correction (--auto-correct).
|
95
|
+
Style/FileWrite:
|
96
|
+
Exclude:
|
97
|
+
- 'Rakefile'
|
98
|
+
|
99
|
+
# This cop supports safe auto-correction (--auto-correct).
|
100
|
+
# Configuration parameters: EnforcedStyle.
|
101
|
+
# SupportedStyles: literals, strict
|
102
|
+
Style/MutableConstant:
|
103
|
+
Exclude:
|
104
|
+
- 'lib/webhook_system/subscription.rb'
|
105
|
+
|
106
|
+
# Offense count: 1
|
107
|
+
# This cop supports unsafe auto-correction (--auto-correct-all).
|
108
|
+
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
109
|
+
# SupportedStyles: predicate, comparison
|
110
|
+
Style/NumericPredicate:
|
111
|
+
Exclude:
|
112
|
+
- 'spec/**/*'
|
113
|
+
- 'lib/webhook_system/job.rb'
|
114
|
+
|
115
|
+
# Offense count: 1
|
116
|
+
# This cop supports safe auto-correction (--auto-correct).
|
117
|
+
Style/Proc:
|
118
|
+
Exclude:
|
119
|
+
- 'lib/webhook_system/subscription.rb'
|
120
|
+
|
121
|
+
# Offense count: 1
|
122
|
+
# This cop supports safe auto-correction (--auto-correct).
|
123
|
+
Style/RedundantSelf:
|
124
|
+
Exclude:
|
125
|
+
- 'lib/webhook_system/base_event.rb'
|
126
|
+
|
127
|
+
# Offense count: 1
|
128
|
+
# This cop supports safe auto-correction (--auto-correct).
|
129
|
+
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
130
|
+
# SupportedStyles: slashes, percent_r, mixed
|
131
|
+
Style/RegexpLiteral:
|
132
|
+
Exclude:
|
133
|
+
- 'spec/dispatching_events_spec.rb'
|
134
|
+
|
135
|
+
# Offense count: 2
|
136
|
+
# This cop supports safe auto-correction (--auto-correct).
|
137
|
+
Style/StderrPuts:
|
138
|
+
Exclude:
|
139
|
+
- 'Rakefile'
|
140
|
+
|
141
|
+
# Offense count: 1
|
142
|
+
# This cop supports unsafe auto-correction (--auto-correct-all).
|
143
|
+
# Configuration parameters: Mode.
|
144
|
+
Style/StringConcatenation:
|
145
|
+
Exclude:
|
146
|
+
- 'lib/webhook_system/encoder.rb'
|
147
|
+
|
148
|
+
# Offense count: 4
|
149
|
+
# This cop supports safe auto-correction (--auto-correct).
|
150
|
+
# Configuration parameters: MinSize.
|
151
|
+
# SupportedStyles: percent, brackets
|
152
|
+
Style/SymbolArray:
|
153
|
+
EnforcedStyle: brackets
|
154
|
+
|
155
|
+
# Offense count: 3
|
156
|
+
# This cop supports safe auto-correction (--auto-correct).
|
157
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
158
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
159
|
+
Style/TrailingCommaInArrayLiteral:
|
160
|
+
Exclude:
|
161
|
+
- 'spec/dispatching_events_spec.rb'
|
162
|
+
- 'spec/event_spec.rb'
|
163
|
+
- 'spec/integration_spec.rb'
|
164
|
+
|
165
|
+
# Offense count: 14
|
166
|
+
# This cop supports safe auto-correction (--auto-correct).
|
167
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
168
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
169
|
+
Style/TrailingCommaInHashLiteral:
|
170
|
+
Exclude:
|
171
|
+
- 'lib/webhook_system/base_event.rb'
|
172
|
+
- 'lib/webhook_system/encoder.rb'
|
173
|
+
- 'lib/webhook_system/event_log.rb'
|
174
|
+
- 'lib/webhook_system/subscription.rb'
|
175
|
+
- 'spec/encoder_spec.rb'
|
176
|
+
- 'spec/event_spec.rb'
|
177
|
+
- 'spec/integration_spec.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v2.4.0](https://github.com/payrollhero/webhook_system/tree/v2.4.0) (2022-05-02)
|
4
|
+
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.3.1...v2.4.0)
|
5
|
+
|
6
|
+
* Rails 7.0 Official support.
|
7
|
+
* Please read Upgrade notes, a migration is required to rename encrypt column to encrypted.
|
8
|
+
|
3
9
|
## [v2.3.1](https://github.com/payrollhero/webhook_system/tree/v2.3.1) (2022-04-27)
|
4
10
|
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.3.0...v2.3.1)
|
5
11
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -21,6 +21,22 @@ Few Main points ..
|
|
21
21
|
4. The webhook is delivered to the recipient as a JSON payload with a base64 encoded data component
|
22
22
|
5. The recipient is meant to use their copy of this secret to decode that payload, and then action it as needed.
|
23
23
|
|
24
|
+
## Upgrading
|
25
|
+
|
26
|
+
If you are upgrading from <= 2.3.1 into >= 2.4, then you must run a migration to rename the `encrypt` column.
|
27
|
+
This rename was required for adding support for Rails 7.
|
28
|
+
|
29
|
+
You can use this migration.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# db/migrate/20220427113942_rename_encrypt_on_webhook_subscriptions.rb
|
33
|
+
class RenameEncryptOnWebhookSubscriptions < ActiveRecord::Migration[7.0]
|
34
|
+
def change
|
35
|
+
rename_column :webhook_subscriptions, :encrypt, :encrypted
|
36
|
+
end
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
24
40
|
## Setup
|
25
41
|
|
26
42
|
The webhook integration code runs on two tables. You need to create a new migration that adds these
|
@@ -30,7 +46,7 @@ tables first:
|
|
30
46
|
create_table :webhook_subscriptions do |t|
|
31
47
|
t.string :url, null: false
|
32
48
|
t.boolean :active, null: false, index: true
|
33
|
-
t.boolean :
|
49
|
+
t.boolean :encrypted, null: false, default: false
|
34
50
|
t.text :secret
|
35
51
|
end
|
36
52
|
|
data/Rakefile
CHANGED
data/gemfiles/rails_4.2.gemfile
CHANGED
@@ -2,9 +2,9 @@ PATH
|
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
4
|
webhook_system (2.3.1)
|
5
|
-
activejob (> 4.2, < 7.
|
6
|
-
activerecord (> 4.2, < 7.
|
7
|
-
activesupport (> 4.2, < 7.
|
5
|
+
activejob (> 4.2, < 7.1)
|
6
|
+
activerecord (> 4.2, < 7.1)
|
7
|
+
activesupport (> 4.2, < 7.1)
|
8
8
|
faraday (> 0.9)
|
9
9
|
faraday-encoding (>= 0.0.2, < 1.0)
|
10
10
|
ph_model
|
@@ -146,13 +146,16 @@ GEM
|
|
146
146
|
octokit (4.22.0)
|
147
147
|
faraday (>= 0.9)
|
148
148
|
sawyer (~> 0.8.0, >= 0.5.3)
|
149
|
-
|
149
|
+
parallel (1.22.1)
|
150
|
+
parser (3.1.2.0)
|
150
151
|
ast (~> 2.4.1)
|
151
152
|
ph_model (1.1.3)
|
152
153
|
active_attr (~> 0.8)
|
153
154
|
activemodel (> 3.2)
|
154
155
|
activesupport (> 3.2)
|
155
|
-
|
156
|
+
pr_comet (0.5.1)
|
157
|
+
octokit
|
158
|
+
rainbow
|
156
159
|
protocol-hpack (1.4.2)
|
157
160
|
protocol-http (0.22.5)
|
158
161
|
protocol-http1 (0.14.2)
|
@@ -189,9 +192,9 @@ GEM
|
|
189
192
|
activesupport (= 4.2.11.3)
|
190
193
|
rake (>= 0.8.7)
|
191
194
|
thor (>= 0.18.1, < 2.0)
|
192
|
-
rainbow (
|
193
|
-
rake
|
195
|
+
rainbow (3.1.1)
|
194
196
|
rake (13.0.6)
|
197
|
+
regexp_parser (2.3.1)
|
195
198
|
reline (0.3.1)
|
196
199
|
io-console (~> 0.5)
|
197
200
|
rexml (3.2.5)
|
@@ -208,12 +211,38 @@ GEM
|
|
208
211
|
diff-lcs (>= 1.2.0, < 2.0)
|
209
212
|
rspec-support (~> 3.11.0)
|
210
213
|
rspec-support (3.11.0)
|
211
|
-
rubocop (
|
212
|
-
|
213
|
-
|
214
|
-
rainbow (>=
|
214
|
+
rubocop (1.28.2)
|
215
|
+
parallel (~> 1.10)
|
216
|
+
parser (>= 3.1.0.0)
|
217
|
+
rainbow (>= 2.2.2, < 4.0)
|
218
|
+
regexp_parser (>= 1.8, < 3.0)
|
219
|
+
rexml
|
220
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
215
221
|
ruby-progressbar (~> 1.7)
|
216
|
-
unicode-display_width (
|
222
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
223
|
+
rubocop-ast (1.17.0)
|
224
|
+
parser (>= 3.1.1.0)
|
225
|
+
rubocop-performance (1.13.3)
|
226
|
+
rubocop (>= 1.7.0, < 2.0)
|
227
|
+
rubocop-ast (>= 0.4.0)
|
228
|
+
rubocop-rails (2.14.2)
|
229
|
+
activesupport (>= 4.2.0)
|
230
|
+
rack (>= 1.1)
|
231
|
+
rubocop (>= 1.7.0, < 2.0)
|
232
|
+
rubocop-rake (0.6.0)
|
233
|
+
rubocop (~> 1.0)
|
234
|
+
rubocop-rspec (2.10.0)
|
235
|
+
rubocop (~> 1.19)
|
236
|
+
rubocop_challenger (2.3.0)
|
237
|
+
pr_comet (~> 0.5.1)
|
238
|
+
rainbow
|
239
|
+
rubocop (>= 0.87)
|
240
|
+
rubocop-performance
|
241
|
+
rubocop-rails
|
242
|
+
rubocop-rake
|
243
|
+
rubocop-rspec
|
244
|
+
thor
|
245
|
+
yard
|
217
246
|
ruby-progressbar (1.11.0)
|
218
247
|
ruby2_keywords (0.0.5)
|
219
248
|
rubygems-tasks (0.2.5)
|
@@ -234,7 +263,7 @@ GEM
|
|
234
263
|
timers (4.3.3)
|
235
264
|
tzinfo (1.2.9)
|
236
265
|
thread_safe (~> 0.1)
|
237
|
-
unicode-display_width (1.
|
266
|
+
unicode-display_width (2.1.0)
|
238
267
|
validate_url (1.0.13)
|
239
268
|
activemodel (>= 3.0.0)
|
240
269
|
public_suffix
|
@@ -242,6 +271,9 @@ GEM
|
|
242
271
|
addressable (>= 2.8.0)
|
243
272
|
crack (>= 0.3.2)
|
244
273
|
hashdiff (>= 0.4.0, < 2.0.0)
|
274
|
+
webrick (1.7.0)
|
275
|
+
yard (0.9.27)
|
276
|
+
webrick (~> 1.7.0)
|
245
277
|
|
246
278
|
PLATFORMS
|
247
279
|
ruby
|
@@ -253,7 +285,7 @@ DEPENDENCIES
|
|
253
285
|
rails (~> 4.2.11)
|
254
286
|
rake
|
255
287
|
rspec (~> 3.0)
|
256
|
-
|
288
|
+
rubocop_challenger
|
257
289
|
rubygems-tasks (~> 0.2)
|
258
290
|
sqlite3 (~> 1.3.6)
|
259
291
|
webhook_system!
|
data/gemfiles/rails_5.0.gemfile
CHANGED
data/gemfiles/rails_5.1.gemfile
CHANGED
data/gemfiles/rails_6.0.gemfile
CHANGED
data/gemfiles/rails_6.1.gemfile
CHANGED
data/lib/webhook_system/job.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module WebhookSystem
|
2
4
|
|
3
5
|
# This is the ActiveJob in charge of actually sending each event
|
@@ -90,7 +92,7 @@ module WebhookSystem
|
|
90
92
|
end
|
91
93
|
|
92
94
|
def self.format_for_subscription(subscription)
|
93
|
-
subscription.
|
95
|
+
subscription.encrypted ? 'base64+aes256' : 'json'
|
94
96
|
end
|
95
97
|
|
96
98
|
def self.log_response(subscription, event, request, response)
|
data/lib/webhook_system.rb
CHANGED
data/webhook_system.gemspec
CHANGED
@@ -18,9 +18,27 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
19
19
|
gem.require_paths = ['lib']
|
20
20
|
|
21
|
-
gem.
|
22
|
-
|
23
|
-
|
21
|
+
gem.post_install_message = %q{
|
22
|
+
## Upgrading
|
23
|
+
|
24
|
+
If you are upgrading from <= 2.3.1 into >= 2.4, then you must run a migration to rename the `encrypt` column.
|
25
|
+
This rename was required for adding support for Rails 7.
|
26
|
+
|
27
|
+
You can use this migration.
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# db/migrate/20220427113942_rename_encrypt_on_webhook_subscriptions.rb
|
31
|
+
class RenameEncryptOnWebhookSubscriptions < ActiveRecord::Migration[7.0]
|
32
|
+
def change
|
33
|
+
rename_column :webhook_subscriptions, :encrypt, :encrypted
|
34
|
+
end
|
35
|
+
end
|
36
|
+
```
|
37
|
+
}
|
38
|
+
|
39
|
+
gem.add_runtime_dependency 'activesupport', '> 4.2', '< 7.1'
|
40
|
+
gem.add_runtime_dependency 'activerecord', '> 4.2', '< 7.1'
|
41
|
+
gem.add_runtime_dependency 'activejob', '> 4.2', '< 7.1'
|
24
42
|
gem.add_runtime_dependency 'faraday', '> 0.9'
|
25
43
|
gem.add_runtime_dependency 'faraday-encoding', '>= 0.0.2', '< 1.0'
|
26
44
|
gem.add_runtime_dependency 'ph_model'
|
@@ -36,5 +54,5 @@ Gem::Specification.new do |gem|
|
|
36
54
|
gem.add_development_dependency 'webmock'
|
37
55
|
|
38
56
|
# static analysis gems
|
39
|
-
gem.add_development_dependency '
|
57
|
+
gem.add_development_dependency 'rubocop_challenger'
|
40
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhook_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Banasik
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '4.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '7.
|
23
|
+
version: '7.1'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '4.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
33
|
+
version: '7.1'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: activerecord
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
version: '4.2'
|
41
41
|
- - "<"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '7.
|
43
|
+
version: '7.1'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: '4.2'
|
51
51
|
- - "<"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '7.
|
53
|
+
version: '7.1'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
55
|
name: activejob
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
version: '4.2'
|
61
61
|
- - "<"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: '7.
|
63
|
+
version: '7.1'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -70,7 +70,7 @@ dependencies:
|
|
70
70
|
version: '4.2'
|
71
71
|
- - "<"
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '7.
|
73
|
+
version: '7.1'
|
74
74
|
- !ruby/object:Gem::Dependency
|
75
75
|
name: faraday
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,19 +252,19 @@ dependencies:
|
|
252
252
|
- !ruby/object:Gem::Version
|
253
253
|
version: '0'
|
254
254
|
- !ruby/object:Gem::Dependency
|
255
|
-
name:
|
255
|
+
name: rubocop_challenger
|
256
256
|
requirement: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
|
-
- - "
|
258
|
+
- - ">="
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version: 0
|
260
|
+
version: '0'
|
261
261
|
type: :development
|
262
262
|
prerelease: false
|
263
263
|
version_requirements: !ruby/object:Gem::Requirement
|
264
264
|
requirements:
|
265
|
-
- - "
|
265
|
+
- - ">="
|
266
266
|
- !ruby/object:Gem::Version
|
267
|
-
version: 0
|
267
|
+
version: '0'
|
268
268
|
description: A pluggable webhook subscription system
|
269
269
|
email: dev@payrollhero.com
|
270
270
|
executables: []
|
@@ -273,9 +273,11 @@ extra_rdoc_files: []
|
|
273
273
|
files:
|
274
274
|
- ".codeclimate.yml"
|
275
275
|
- ".github/workflows/build.yml"
|
276
|
+
- ".github/workflows/rubocop-challenger.yml"
|
276
277
|
- ".gitignore"
|
277
278
|
- ".rubocop.hound.yml"
|
278
279
|
- ".rubocop.yml"
|
280
|
+
- ".rubocop_todo.yml"
|
279
281
|
- CHANGELOG.md
|
280
282
|
- DEPLOYING.md
|
281
283
|
- Gemfile
|
@@ -287,9 +289,10 @@ files:
|
|
287
289
|
- gemfiles/rails_4.2.gemfile.lock
|
288
290
|
- gemfiles/rails_5.0.gemfile
|
289
291
|
- gemfiles/rails_5.1.gemfile
|
290
|
-
- gemfiles/
|
292
|
+
- gemfiles/rails_5.2.gemfile
|
291
293
|
- gemfiles/rails_6.0.gemfile
|
292
294
|
- gemfiles/rails_6.1.gemfile
|
295
|
+
- gemfiles/rails_7.0.gemfile
|
293
296
|
- lib/webhook_system.rb
|
294
297
|
- lib/webhook_system/base_event.rb
|
295
298
|
- lib/webhook_system/encoder.rb
|
@@ -303,7 +306,13 @@ homepage: https://github.com/payrollhero/webhook_system
|
|
303
306
|
licenses:
|
304
307
|
- MIT
|
305
308
|
metadata: {}
|
306
|
-
post_install_message:
|
309
|
+
post_install_message: "\n ## Upgrading\n\n If you are upgrading from <= 2.3.1
|
310
|
+
into >= 2.4, then you must run a migration to rename the `encrypt` column.\n This
|
311
|
+
rename was required for adding support for Rails 7.\n\n You can use this migration.\n\n
|
312
|
+
\ ```ruby\n # db/migrate/20220427113942_rename_encrypt_on_webhook_subscriptions.rb\n
|
313
|
+
\ class RenameEncryptOnWebhookSubscriptions < ActiveRecord::Migration[7.0]\n def
|
314
|
+
change\n rename_column :webhook_subscriptions, :encrypt, :encrypted\n end\n
|
315
|
+
\ end\n ```\n "
|
307
316
|
rdoc_options: []
|
308
317
|
require_paths:
|
309
318
|
- lib
|
@@ -318,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
327
|
- !ruby/object:Gem::Version
|
319
328
|
version: '0'
|
320
329
|
requirements: []
|
321
|
-
rubygems_version: 3.
|
330
|
+
rubygems_version: 3.1.6
|
322
331
|
signing_key:
|
323
332
|
specification_version: 4
|
324
333
|
summary: Webhook system
|