external_services 0.3.1 → 0.4.4
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 +4 -4
- data/.travis.yml +3 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +136 -115
- data/app/models/concerns/external_services/action.rb +18 -4
- data/app/models/external_services/api_action.rb +6 -2
- data/app/models/external_services/service.rb +1 -1
- data/external_services.gemspec +6 -1
- data/lib/external_services/api.rb +6 -0
- data/lib/external_services/version.rb +1 -1
- data/lib/generators/install_generator.rb +7 -1
- data/lib/generators/templates/migrations/create_external_services.rb +1 -1
- data/lib/generators/templates/migrations/create_external_services_api_actions.rb +1 -1
- data/lib/rspec/helpers.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c69a4919cb11efce2424a1b9490cfed1f37ad729c2ab493b563cd2d36566b8b2
|
|
4
|
+
data.tar.gz: 66b9964bc09a0ceb0b88313a8383dd2b6fb89ae642b4a445d0d0ce3f964f5754
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d97f6142f73c0a4aa08906400a33c515a6bdc5714aab9faa2bb11f0eeea2277be76318bf60c7ffbfb6424110ee4cf9fb3d9e8cbb413a5016a0d6a6101fe32e7
|
|
7
|
+
data.tar.gz: f06bdce065196cc64e76601ff3146ec54fc82c90efd093a239a66f41ecad8b493bf4499f3dde463a7e58df92775d189fe1045769d8b4934b8aba40761a1388ee
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,79 +1,96 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
external_services (0.
|
|
4
|
+
external_services (0.4.4)
|
|
5
5
|
faraday (>= 0.9)
|
|
6
6
|
faraday_middleware (>= 0.10)
|
|
7
|
-
rails (>= 4.2.5, <
|
|
7
|
+
rails (>= 4.2.5, < 7)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
actioncable (
|
|
13
|
-
actionpack (=
|
|
12
|
+
actioncable (6.1.3.2)
|
|
13
|
+
actionpack (= 6.1.3.2)
|
|
14
|
+
activesupport (= 6.1.3.2)
|
|
14
15
|
nio4r (~> 2.0)
|
|
15
16
|
websocket-driver (>= 0.6.1)
|
|
16
|
-
|
|
17
|
-
actionpack (=
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
actionmailbox (6.1.3.2)
|
|
18
|
+
actionpack (= 6.1.3.2)
|
|
19
|
+
activejob (= 6.1.3.2)
|
|
20
|
+
activerecord (= 6.1.3.2)
|
|
21
|
+
activestorage (= 6.1.3.2)
|
|
22
|
+
activesupport (= 6.1.3.2)
|
|
23
|
+
mail (>= 2.7.1)
|
|
24
|
+
actionmailer (6.1.3.2)
|
|
25
|
+
actionpack (= 6.1.3.2)
|
|
26
|
+
actionview (= 6.1.3.2)
|
|
27
|
+
activejob (= 6.1.3.2)
|
|
28
|
+
activesupport (= 6.1.3.2)
|
|
20
29
|
mail (~> 2.5, >= 2.5.4)
|
|
21
30
|
rails-dom-testing (~> 2.0)
|
|
22
|
-
actionpack (
|
|
23
|
-
actionview (=
|
|
24
|
-
activesupport (=
|
|
25
|
-
rack (~> 2.0)
|
|
31
|
+
actionpack (6.1.3.2)
|
|
32
|
+
actionview (= 6.1.3.2)
|
|
33
|
+
activesupport (= 6.1.3.2)
|
|
34
|
+
rack (~> 2.0, >= 2.0.9)
|
|
26
35
|
rack-test (>= 0.6.3)
|
|
27
36
|
rails-dom-testing (~> 2.0)
|
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
|
38
|
+
actiontext (6.1.3.2)
|
|
39
|
+
actionpack (= 6.1.3.2)
|
|
40
|
+
activerecord (= 6.1.3.2)
|
|
41
|
+
activestorage (= 6.1.3.2)
|
|
42
|
+
activesupport (= 6.1.3.2)
|
|
43
|
+
nokogiri (>= 1.8.5)
|
|
44
|
+
actionview (6.1.3.2)
|
|
45
|
+
activesupport (= 6.1.3.2)
|
|
31
46
|
builder (~> 3.1)
|
|
32
47
|
erubi (~> 1.4)
|
|
33
48
|
rails-dom-testing (~> 2.0)
|
|
34
|
-
rails-html-sanitizer (~> 1.
|
|
35
|
-
activejob (
|
|
36
|
-
activesupport (=
|
|
49
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
|
50
|
+
activejob (6.1.3.2)
|
|
51
|
+
activesupport (= 6.1.3.2)
|
|
37
52
|
globalid (>= 0.3.6)
|
|
38
|
-
activemodel (
|
|
39
|
-
activesupport (=
|
|
40
|
-
activerecord (
|
|
41
|
-
activemodel (=
|
|
42
|
-
activesupport (=
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
activerecord (=
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
activemodel (6.1.3.2)
|
|
54
|
+
activesupport (= 6.1.3.2)
|
|
55
|
+
activerecord (6.1.3.2)
|
|
56
|
+
activemodel (= 6.1.3.2)
|
|
57
|
+
activesupport (= 6.1.3.2)
|
|
58
|
+
activestorage (6.1.3.2)
|
|
59
|
+
actionpack (= 6.1.3.2)
|
|
60
|
+
activejob (= 6.1.3.2)
|
|
61
|
+
activerecord (= 6.1.3.2)
|
|
62
|
+
activesupport (= 6.1.3.2)
|
|
63
|
+
marcel (~> 1.0.0)
|
|
64
|
+
mini_mime (~> 1.0.2)
|
|
65
|
+
activesupport (6.1.3.2)
|
|
49
66
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
50
|
-
i18n (>=
|
|
51
|
-
minitest (
|
|
52
|
-
tzinfo (~>
|
|
67
|
+
i18n (>= 1.6, < 2)
|
|
68
|
+
minitest (>= 5.1)
|
|
69
|
+
tzinfo (~> 2.0)
|
|
70
|
+
zeitwerk (~> 2.3)
|
|
53
71
|
addressable (2.4.0)
|
|
54
|
-
arel (9.0.0)
|
|
55
72
|
ast (2.4.0)
|
|
56
|
-
backports (3.11.
|
|
57
|
-
builder (3.2.
|
|
73
|
+
backports (3.11.4)
|
|
74
|
+
builder (3.2.4)
|
|
58
75
|
childprocess (0.9.0)
|
|
59
76
|
ffi (~> 1.0, >= 1.0.11)
|
|
60
77
|
coderay (1.1.2)
|
|
61
|
-
concurrent-ruby (1.
|
|
62
|
-
crass (1.0.
|
|
63
|
-
diff-lcs (1.
|
|
64
|
-
erubi (1.
|
|
78
|
+
concurrent-ruby (1.1.9)
|
|
79
|
+
crass (1.0.6)
|
|
80
|
+
diff-lcs (1.4.4)
|
|
81
|
+
erubi (1.10.0)
|
|
65
82
|
ethon (0.11.0)
|
|
66
83
|
ffi (>= 1.3.0)
|
|
67
|
-
factory_bot (4.
|
|
84
|
+
factory_bot (4.11.1)
|
|
68
85
|
activesupport (>= 3.0.0)
|
|
69
|
-
factory_bot_rails (4.
|
|
70
|
-
factory_bot (~> 4.
|
|
86
|
+
factory_bot_rails (4.11.1)
|
|
87
|
+
factory_bot (~> 4.11.1)
|
|
71
88
|
railties (>= 3.0.0)
|
|
72
|
-
faraday (0.15.
|
|
89
|
+
faraday (0.15.3)
|
|
73
90
|
multipart-post (>= 1.2, < 3)
|
|
74
91
|
faraday_middleware (0.12.2)
|
|
75
92
|
faraday (>= 0.7.4, < 1.0)
|
|
76
|
-
ffi (1.9.
|
|
93
|
+
ffi (1.9.25)
|
|
77
94
|
gh (0.15.1)
|
|
78
95
|
addressable (~> 2.4.0)
|
|
79
96
|
backports
|
|
@@ -81,41 +98,41 @@ GEM
|
|
|
81
98
|
multi_json (~> 1.0)
|
|
82
99
|
net-http-persistent (~> 2.9)
|
|
83
100
|
net-http-pipeline
|
|
84
|
-
globalid (0.4.
|
|
101
|
+
globalid (0.4.2)
|
|
85
102
|
activesupport (>= 4.2.0)
|
|
86
103
|
highline (1.7.10)
|
|
87
|
-
i18n (1.
|
|
104
|
+
i18n (1.8.10)
|
|
88
105
|
concurrent-ruby (~> 1.0)
|
|
89
106
|
iniparse (1.4.4)
|
|
90
|
-
|
|
107
|
+
jaro_winkler (1.5.1)
|
|
108
|
+
json (2.3.1)
|
|
91
109
|
launchy (2.4.3)
|
|
92
110
|
addressable (~> 2.3)
|
|
93
|
-
loofah (2.
|
|
111
|
+
loofah (2.10.0)
|
|
94
112
|
crass (~> 1.0.2)
|
|
95
113
|
nokogiri (>= 1.5.9)
|
|
96
|
-
mail (2.7.
|
|
114
|
+
mail (2.7.1)
|
|
97
115
|
mini_mime (>= 0.1.1)
|
|
98
|
-
marcel (0.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
mini_portile2 (2.3.0)
|
|
104
|
-
minitest (5.11.3)
|
|
116
|
+
marcel (1.0.1)
|
|
117
|
+
method_source (0.9.2)
|
|
118
|
+
mini_mime (1.0.3)
|
|
119
|
+
mini_portile2 (2.5.3)
|
|
120
|
+
minitest (5.14.4)
|
|
105
121
|
multi_json (1.13.1)
|
|
106
122
|
multipart-post (2.0.0)
|
|
107
123
|
net-http-persistent (2.9.4)
|
|
108
124
|
net-http-pipeline (1.0.1)
|
|
109
|
-
nio4r (2.
|
|
110
|
-
nokogiri (1.
|
|
111
|
-
mini_portile2 (~> 2.
|
|
112
|
-
|
|
125
|
+
nio4r (2.5.7)
|
|
126
|
+
nokogiri (1.11.7)
|
|
127
|
+
mini_portile2 (~> 2.5.0)
|
|
128
|
+
racc (~> 1.4)
|
|
129
|
+
overcommit (0.46.0)
|
|
113
130
|
childprocess (~> 0.6, >= 0.6.3)
|
|
114
131
|
iniparse (~> 1.4)
|
|
115
132
|
parallel (1.12.1)
|
|
116
|
-
parser (2.5.1.
|
|
133
|
+
parser (2.5.1.2)
|
|
117
134
|
ast (~> 2.4.0)
|
|
118
|
-
powerpack (0.1.
|
|
135
|
+
powerpack (0.1.2)
|
|
119
136
|
pry (0.11.3)
|
|
120
137
|
coderay (~> 1.1.0)
|
|
121
138
|
method_source (~> 0.9.0)
|
|
@@ -124,71 +141,74 @@ GEM
|
|
|
124
141
|
pusher-client (0.6.2)
|
|
125
142
|
json
|
|
126
143
|
websocket (~> 1.0)
|
|
127
|
-
|
|
128
|
-
rack
|
|
144
|
+
racc (1.5.2)
|
|
145
|
+
rack (2.2.3)
|
|
146
|
+
rack-test (1.1.0)
|
|
129
147
|
rack (>= 1.0, < 3)
|
|
130
|
-
rails (
|
|
131
|
-
actioncable (=
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
148
|
+
rails (6.1.3.2)
|
|
149
|
+
actioncable (= 6.1.3.2)
|
|
150
|
+
actionmailbox (= 6.1.3.2)
|
|
151
|
+
actionmailer (= 6.1.3.2)
|
|
152
|
+
actionpack (= 6.1.3.2)
|
|
153
|
+
actiontext (= 6.1.3.2)
|
|
154
|
+
actionview (= 6.1.3.2)
|
|
155
|
+
activejob (= 6.1.3.2)
|
|
156
|
+
activemodel (= 6.1.3.2)
|
|
157
|
+
activerecord (= 6.1.3.2)
|
|
158
|
+
activestorage (= 6.1.3.2)
|
|
159
|
+
activesupport (= 6.1.3.2)
|
|
160
|
+
bundler (>= 1.15.0)
|
|
161
|
+
railties (= 6.1.3.2)
|
|
142
162
|
sprockets-rails (>= 2.0.0)
|
|
143
163
|
rails-dom-testing (2.0.3)
|
|
144
164
|
activesupport (>= 4.2.0)
|
|
145
165
|
nokogiri (>= 1.6)
|
|
146
|
-
rails-html-sanitizer (1.0
|
|
147
|
-
loofah (~> 2.
|
|
148
|
-
railties (
|
|
149
|
-
actionpack (=
|
|
150
|
-
activesupport (=
|
|
166
|
+
rails-html-sanitizer (1.3.0)
|
|
167
|
+
loofah (~> 2.3)
|
|
168
|
+
railties (6.1.3.2)
|
|
169
|
+
actionpack (= 6.1.3.2)
|
|
170
|
+
activesupport (= 6.1.3.2)
|
|
151
171
|
method_source
|
|
152
172
|
rake (>= 0.8.7)
|
|
153
|
-
thor (
|
|
173
|
+
thor (~> 1.0)
|
|
154
174
|
rainbow (3.0.0)
|
|
155
|
-
rake (
|
|
156
|
-
rspec-core (3.
|
|
157
|
-
rspec-support (~> 3.
|
|
158
|
-
rspec-expectations (3.
|
|
175
|
+
rake (13.0.3)
|
|
176
|
+
rspec-core (3.10.1)
|
|
177
|
+
rspec-support (~> 3.10.0)
|
|
178
|
+
rspec-expectations (3.10.1)
|
|
159
179
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
160
|
-
rspec-support (~> 3.
|
|
161
|
-
rspec-mocks (3.
|
|
180
|
+
rspec-support (~> 3.10.0)
|
|
181
|
+
rspec-mocks (3.10.2)
|
|
162
182
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
163
|
-
rspec-support (~> 3.
|
|
164
|
-
rspec-rails (
|
|
165
|
-
actionpack (>=
|
|
166
|
-
activesupport (>=
|
|
167
|
-
railties (>=
|
|
168
|
-
rspec-core (~> 3.
|
|
169
|
-
rspec-expectations (~> 3.
|
|
170
|
-
rspec-mocks (~> 3.
|
|
171
|
-
rspec-support (~> 3.
|
|
172
|
-
rspec-support (3.
|
|
173
|
-
rubocop (0.
|
|
183
|
+
rspec-support (~> 3.10.0)
|
|
184
|
+
rspec-rails (5.0.1)
|
|
185
|
+
actionpack (>= 5.2)
|
|
186
|
+
activesupport (>= 5.2)
|
|
187
|
+
railties (>= 5.2)
|
|
188
|
+
rspec-core (~> 3.10)
|
|
189
|
+
rspec-expectations (~> 3.10)
|
|
190
|
+
rspec-mocks (~> 3.10)
|
|
191
|
+
rspec-support (~> 3.10)
|
|
192
|
+
rspec-support (3.10.2)
|
|
193
|
+
rubocop (0.59.2)
|
|
194
|
+
jaro_winkler (~> 1.5.1)
|
|
174
195
|
parallel (~> 1.10)
|
|
175
|
-
parser (>= 2.5)
|
|
196
|
+
parser (>= 2.5, != 2.5.1.1)
|
|
176
197
|
powerpack (~> 0.1)
|
|
177
198
|
rainbow (>= 2.2.2, < 4.0)
|
|
178
199
|
ruby-progressbar (~> 1.7)
|
|
179
200
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
180
|
-
ruby-progressbar (1.
|
|
181
|
-
sprockets (
|
|
201
|
+
ruby-progressbar (1.10.0)
|
|
202
|
+
sprockets (4.0.2)
|
|
182
203
|
concurrent-ruby (~> 1.0)
|
|
183
204
|
rack (> 1, < 3)
|
|
184
|
-
sprockets-rails (3.2.
|
|
205
|
+
sprockets-rails (3.2.2)
|
|
185
206
|
actionpack (>= 4.0)
|
|
186
207
|
activesupport (>= 4.0)
|
|
187
208
|
sprockets (>= 3.0.0)
|
|
188
|
-
sqlite3 (1.
|
|
189
|
-
thor (
|
|
190
|
-
|
|
191
|
-
travis (1.8.8)
|
|
209
|
+
sqlite3 (1.4.2)
|
|
210
|
+
thor (1.1.0)
|
|
211
|
+
travis (1.8.9)
|
|
192
212
|
backports
|
|
193
213
|
faraday (~> 0.9)
|
|
194
214
|
faraday_middleware (~> 0.9, >= 0.9.1)
|
|
@@ -199,13 +219,14 @@ GEM
|
|
|
199
219
|
typhoeus (~> 0.6, >= 0.6.8)
|
|
200
220
|
typhoeus (0.8.0)
|
|
201
221
|
ethon (>= 0.8.0)
|
|
202
|
-
tzinfo (
|
|
203
|
-
|
|
204
|
-
unicode-display_width (1.
|
|
205
|
-
websocket (1.2.
|
|
206
|
-
websocket-driver (0.7.
|
|
222
|
+
tzinfo (2.0.4)
|
|
223
|
+
concurrent-ruby (~> 1.0)
|
|
224
|
+
unicode-display_width (1.4.0)
|
|
225
|
+
websocket (1.2.8)
|
|
226
|
+
websocket-driver (0.7.4)
|
|
207
227
|
websocket-extensions (>= 0.1.0)
|
|
208
|
-
websocket-extensions (0.1.
|
|
228
|
+
websocket-extensions (0.1.5)
|
|
229
|
+
zeitwerk (2.4.2)
|
|
209
230
|
|
|
210
231
|
PLATFORMS
|
|
211
232
|
ruby
|
|
@@ -216,11 +237,11 @@ DEPENDENCIES
|
|
|
216
237
|
factory_bot_rails
|
|
217
238
|
overcommit
|
|
218
239
|
pry-rails
|
|
219
|
-
rake (~>
|
|
240
|
+
rake (~> 13.0)
|
|
220
241
|
rspec-rails
|
|
221
242
|
rubocop (~> 0.48)
|
|
222
243
|
sqlite3
|
|
223
244
|
travis (~> 1.8, >= 1.8.2)
|
|
224
245
|
|
|
225
246
|
BUNDLED WITH
|
|
226
|
-
1.
|
|
247
|
+
1.17.3
|
|
@@ -2,8 +2,10 @@ module ExternalServices
|
|
|
2
2
|
module Action
|
|
3
3
|
extend ActiveSupport::Concern
|
|
4
4
|
|
|
5
|
+
QUEUE_PREFIX = 'external_services'
|
|
6
|
+
|
|
5
7
|
included do
|
|
6
|
-
scope :processed,
|
|
8
|
+
scope :processed, -> { where.not(processed_at: nil) }
|
|
7
9
|
scope :unprocessed, -> { where(processed_at: nil) }
|
|
8
10
|
|
|
9
11
|
after_commit :kick_active_job
|
|
@@ -14,7 +16,7 @@ module ExternalServices
|
|
|
14
16
|
end
|
|
15
17
|
|
|
16
18
|
def set_processed!
|
|
17
|
-
|
|
19
|
+
update! processed_at: Time.now
|
|
18
20
|
end
|
|
19
21
|
|
|
20
22
|
def execute!
|
|
@@ -22,12 +24,24 @@ module ExternalServices
|
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
def kick_active_job
|
|
25
|
-
return if processed? || api_disabled?
|
|
27
|
+
# return if processed? || api_disabled?
|
|
28
|
+
|
|
29
|
+
job_class.set(queue: prefixed_queue).perform_later(id)
|
|
30
|
+
end
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
def prefixed_queue
|
|
33
|
+
[QUEUE_PREFIX, queue].join('__')
|
|
28
34
|
end
|
|
29
35
|
|
|
30
36
|
module ClassMethods
|
|
37
|
+
def clear_sidekiq_queues
|
|
38
|
+
Sidekiq.redis do |conn|
|
|
39
|
+
conn.keys.select { |k| k.include?(QUEUE_PREFIX) }.each do |k|
|
|
40
|
+
conn.del k
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
31
45
|
def perform_unprocessed
|
|
32
46
|
Rails.logger.info "Running unprocessed #{self.class.name.demodulize} api actions..."
|
|
33
47
|
|
|
@@ -2,6 +2,8 @@ module ExternalServices
|
|
|
2
2
|
class ApiAction < ::ActiveRecord::Base
|
|
3
3
|
include ExternalServices::Action
|
|
4
4
|
|
|
5
|
+
MAX_ACTION_AGE = ENV.fetch('EXTERNAL_SERVICES_MAX_ACTION_AGE') { '90' }.to_i.days
|
|
6
|
+
|
|
5
7
|
attr_accessor :async
|
|
6
8
|
|
|
7
9
|
self.table_name = :external_services_api_actions
|
|
@@ -14,15 +16,17 @@ module ExternalServices
|
|
|
14
16
|
serialize :data, JSON
|
|
15
17
|
serialize :options, JSON
|
|
16
18
|
|
|
17
|
-
scope :unprocessed, -> { where(processed_at: nil) }
|
|
18
19
|
scope :to_create, ->(obj) { where(initiator: obj, method: :post) }
|
|
19
20
|
|
|
20
21
|
before_validation :assign_queue
|
|
21
22
|
before_validation :process_data
|
|
22
|
-
after_commit :kick_active_job
|
|
23
23
|
|
|
24
24
|
before_create :calculate_signature
|
|
25
25
|
|
|
26
|
+
def self.delete_old_processed
|
|
27
|
+
processed.where(arel_table[:created_at].lt(MAX_ACTION_AGE.ago)).delete_all
|
|
28
|
+
end
|
|
29
|
+
|
|
26
30
|
def initiator_class
|
|
27
31
|
# Need to use initiator object for STI in polymorphic.. But still will be bugs with deleted STI object and
|
|
28
32
|
# non-STI inheritance
|
|
@@ -7,7 +7,7 @@ module ExternalServices
|
|
|
7
7
|
|
|
8
8
|
after_update :on_first_sync, if: proc { # Rails 5.1+ support
|
|
9
9
|
(respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed? ) &&
|
|
10
|
-
(respond_to?(:external_id_before_last_save) ? external_id_before_last_save
|
|
10
|
+
(respond_to?(:external_id_before_last_save) ? external_id_before_last_save : external_id_was).nil?
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
def self.to_sym
|
data/external_services.gemspec
CHANGED
|
@@ -18,7 +18,12 @@ Gem::Specification.new do |spec|
|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
19
|
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
+
spec.post_install_message = <<-MSG
|
|
22
|
+
WARNING: since v0.4 active_job queues are prefixed, so you should check sidekiq config.
|
|
23
|
+
And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db.
|
|
24
|
+
MSG
|
|
25
|
+
|
|
21
26
|
spec.add_dependency 'faraday', '>= 0.9'
|
|
22
27
|
spec.add_dependency 'faraday_middleware', '>= 0.10'
|
|
23
|
-
spec.add_dependency 'rails', ['>= 4.2.5', '<
|
|
28
|
+
spec.add_dependency 'rails', ['>= 4.2.5', '< 7']
|
|
24
29
|
end
|
|
@@ -11,6 +11,12 @@ module ExternalServices
|
|
|
11
11
|
|
|
12
12
|
desc 'Generates migrations and directories.'
|
|
13
13
|
|
|
14
|
+
def migration_version
|
|
15
|
+
return unless Rails::VERSION::MAJOR >= 5
|
|
16
|
+
|
|
17
|
+
"[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
def create_migration_files
|
|
15
21
|
add_migration('create_external_services')
|
|
16
22
|
add_migration('create_external_services_api_actions')
|
|
@@ -39,7 +45,7 @@ module ExternalServices
|
|
|
39
45
|
if self.class.migration_exists?(migration_dir, template)
|
|
40
46
|
::Kernel.warn "Migration already exists: #{template}"
|
|
41
47
|
else
|
|
42
|
-
migration_template "migrations/#{template}.rb", "db/migrate/#{template}.rb"
|
|
48
|
+
migration_template "migrations/#{template}.rb", "db/migrate/#{template}.rb", migration_version: migration_version
|
|
43
49
|
end
|
|
44
50
|
end
|
|
45
51
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class CreateExternalServicesApiActions < ActiveRecord::Migration
|
|
1
|
+
class CreateExternalServicesApiActions < ActiveRecord::Migration<%= migration_version %>
|
|
2
2
|
def change
|
|
3
3
|
create_table :external_services_api_actions do |t|
|
|
4
4
|
t.references :initiator, null: false, polymorphic: true, index: { name: 'esaa_on_initiator_type_and_initiator_id' }
|
data/lib/rspec/helpers.rb
CHANGED
|
@@ -76,7 +76,7 @@ module ExternalServices
|
|
|
76
76
|
|
|
77
77
|
if kwargs[:descendants_identifier_check]
|
|
78
78
|
it 'create actions for all descendants on identifier change' do
|
|
79
|
-
@api_object.
|
|
79
|
+
@api_object.update! identifier: "#{@api_object.identifier}1"
|
|
80
80
|
|
|
81
81
|
@api_object.descendants.each do |c|
|
|
82
82
|
expect_api_action_on_update(c)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: external_services
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sergey Gnuskov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -47,7 +47,7 @@ dependencies:
|
|
|
47
47
|
version: 4.2.5
|
|
48
48
|
- - "<"
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: '
|
|
50
|
+
version: '7'
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -57,7 +57,7 @@ dependencies:
|
|
|
57
57
|
version: 4.2.5
|
|
58
58
|
- - "<"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
60
|
+
version: '7'
|
|
61
61
|
description:
|
|
62
62
|
email:
|
|
63
63
|
- sergey.gnuskov@flant.com
|
|
@@ -102,7 +102,9 @@ homepage: https://github.com/flant/external_services
|
|
|
102
102
|
licenses:
|
|
103
103
|
- MIT
|
|
104
104
|
metadata: {}
|
|
105
|
-
post_install_message:
|
|
105
|
+
post_install_message: |2
|
|
106
|
+
WARNING: since v0.4 active_job queues are prefixed, so you should check sidekiq config.
|
|
107
|
+
And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db.
|
|
106
108
|
rdoc_options: []
|
|
107
109
|
require_paths:
|
|
108
110
|
- lib
|
|
@@ -117,8 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
117
119
|
- !ruby/object:Gem::Version
|
|
118
120
|
version: '0'
|
|
119
121
|
requirements: []
|
|
120
|
-
|
|
121
|
-
rubygems_version: 2.7.6
|
|
122
|
+
rubygems_version: 3.0.8
|
|
122
123
|
signing_key:
|
|
123
124
|
specification_version: 4
|
|
124
125
|
summary: Gem helps syncronizing objects to different external services like Gitlab,
|