external_services 0.4.3 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6938fe87148bdc3e5c98d4daa7b690e4d91ad9716fff2df713538d18b52deee7
4
- data.tar.gz: 51a0ea8c848fff9378699c8c636562e9df8f5dc9bb4d22b2aa3e40b2f463871a
3
+ metadata.gz: 696239dd2a5f6a780daf507059a77dc5542b41bb51d6a9b761694fd8decee742
4
+ data.tar.gz: c38e40e9575e4a1a0ffa2ee6f9b3a9996a5ea29876ce9fa1f5ac7d2d669653f4
5
5
  SHA512:
6
- metadata.gz: 2c20e20632ff2eb4e1c66123d0d1497ecab6b8f016a4db63013383c2bcd134c460a4f328e7e5885b1bd638993fc8752e2b5392d5094537e87c0655fe4ebcd969
7
- data.tar.gz: 0d3a5973de76cafe378ded0b37ccbb34a347f6943103ffa394def739bead110a3fa55900c90bb74a488102ccee3a3eff9838d03c89cb2795523f209e7f544109
6
+ metadata.gz: 0f9a225769174988072d1853afa51332ec96e75ec8cb8d0c6269d113efeeb7c20d55c68b5fe5b8fcd29b405d697568d708fae4c91ac0bc54b9d8b9da718eb2ce
7
+ data.tar.gz: bca745948cf48325cba15d5edf9e5635346e06af0bfe62e0050a665f2c7128c69bc5256807573b7256b03cf3d98a59d5a8682635a32049de202f9131f7549010
@@ -0,0 +1,25 @@
1
+ name: Build + publish
2
+
3
+ on:
4
+ push:
5
+ tags: [ v* ]
6
+ jobs:
7
+ build:
8
+ name: Build + Publish
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v1
12
+
13
+ - name: Release Gem
14
+ if: contains(github.ref, 'refs/tags/v')
15
+ uses: cadwallion/publish-rubygems-action@master
16
+ env:
17
+ RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
18
+ RELEASE_COMMAND: bundle exec rake release
19
+ # steps:
20
+ # - uses: actions/checkout@v3
21
+ # - name: Set up Ruby
22
+ # uses: ruby/setup-ruby@v1
23
+ # with:
24
+ # ruby-version: .ruby-version
25
+ # bundler-cache: true
@@ -0,0 +1,37 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Test
9
+
10
+ on:
11
+ push:
12
+ branches: [ '*' ]
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ${{ matrix.os }}-latest
20
+ strategy:
21
+ matrix:
22
+ os: [ubuntu, macos]
23
+ ruby-version: ['2.6', '2.7', '3.0', '3.1']
24
+
25
+ steps:
26
+ - uses: actions/checkout@v3
27
+ - name: Set up Ruby
28
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
29
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
30
+ uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Prepare DB
35
+ run: bundle exec rake db:create --trace && bundle exec rake db:migrate --trace
36
+ - name: Run tests
37
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
  /spec/dummy/tmp/
11
11
  /spec/dummy/db/*.sqlite3
12
12
  /spec/dummy/db/schema.rb
13
+
14
+ /.history/
data/Gemfile CHANGED
@@ -3,13 +3,13 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in external_services.gemspec
4
4
  gemspec
5
5
 
6
- gem 'bundler', '~> 1.12'
7
6
  gem 'rake', '~> 13.0'
8
7
  gem 'sqlite3'
9
- gem 'travis', '~> 1.8', '>= 1.8.2'
10
8
 
11
9
  gem 'overcommit'
12
- gem 'rubocop', '~> 0.48', require: false
10
+ gem 'rubocop', '~> 1.0', require: false
11
+ gem 'rubocop-rspec'
12
+ gem 'net-smtp', require: false # hack for pre 7.0.1 rails and 3.1 ruby
13
13
 
14
14
  gem 'pry-rails'
15
15
 
data/Gemfile.lock CHANGED
@@ -1,244 +1,249 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- external_services (0.4.3)
5
- faraday (>= 0.9)
6
- faraday_middleware (>= 0.10)
7
- rails (>= 4.2.5, < 6.1)
4
+ external_services (0.5.1)
5
+ faraday (>= 1.4, < 2)
6
+ faraday_middleware (>= 1.0, < 2)
7
+ rails (>= 4.2.5, < 7)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (6.0.3.4)
13
- actionpack (= 6.0.3.4)
12
+ actioncable (6.1.6.1)
13
+ actionpack (= 6.1.6.1)
14
+ activesupport (= 6.1.6.1)
14
15
  nio4r (~> 2.0)
15
16
  websocket-driver (>= 0.6.1)
16
- actionmailbox (6.0.3.4)
17
- actionpack (= 6.0.3.4)
18
- activejob (= 6.0.3.4)
19
- activerecord (= 6.0.3.4)
20
- activestorage (= 6.0.3.4)
21
- activesupport (= 6.0.3.4)
17
+ actionmailbox (6.1.6.1)
18
+ actionpack (= 6.1.6.1)
19
+ activejob (= 6.1.6.1)
20
+ activerecord (= 6.1.6.1)
21
+ activestorage (= 6.1.6.1)
22
+ activesupport (= 6.1.6.1)
22
23
  mail (>= 2.7.1)
23
- actionmailer (6.0.3.4)
24
- actionpack (= 6.0.3.4)
25
- actionview (= 6.0.3.4)
26
- activejob (= 6.0.3.4)
24
+ actionmailer (6.1.6.1)
25
+ actionpack (= 6.1.6.1)
26
+ actionview (= 6.1.6.1)
27
+ activejob (= 6.1.6.1)
28
+ activesupport (= 6.1.6.1)
27
29
  mail (~> 2.5, >= 2.5.4)
28
30
  rails-dom-testing (~> 2.0)
29
- actionpack (6.0.3.4)
30
- actionview (= 6.0.3.4)
31
- activesupport (= 6.0.3.4)
32
- rack (~> 2.0, >= 2.0.8)
31
+ actionpack (6.1.6.1)
32
+ actionview (= 6.1.6.1)
33
+ activesupport (= 6.1.6.1)
34
+ rack (~> 2.0, >= 2.0.9)
33
35
  rack-test (>= 0.6.3)
34
36
  rails-dom-testing (~> 2.0)
35
37
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
- actiontext (6.0.3.4)
37
- actionpack (= 6.0.3.4)
38
- activerecord (= 6.0.3.4)
39
- activestorage (= 6.0.3.4)
40
- activesupport (= 6.0.3.4)
38
+ actiontext (6.1.6.1)
39
+ actionpack (= 6.1.6.1)
40
+ activerecord (= 6.1.6.1)
41
+ activestorage (= 6.1.6.1)
42
+ activesupport (= 6.1.6.1)
41
43
  nokogiri (>= 1.8.5)
42
- actionview (6.0.3.4)
43
- activesupport (= 6.0.3.4)
44
+ actionview (6.1.6.1)
45
+ activesupport (= 6.1.6.1)
44
46
  builder (~> 3.1)
45
47
  erubi (~> 1.4)
46
48
  rails-dom-testing (~> 2.0)
47
49
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
- activejob (6.0.3.4)
49
- activesupport (= 6.0.3.4)
50
+ activejob (6.1.6.1)
51
+ activesupport (= 6.1.6.1)
50
52
  globalid (>= 0.3.6)
51
- activemodel (6.0.3.4)
52
- activesupport (= 6.0.3.4)
53
- activerecord (6.0.3.4)
54
- activemodel (= 6.0.3.4)
55
- activesupport (= 6.0.3.4)
56
- activestorage (6.0.3.4)
57
- actionpack (= 6.0.3.4)
58
- activejob (= 6.0.3.4)
59
- activerecord (= 6.0.3.4)
60
- marcel (~> 0.3.1)
61
- activesupport (6.0.3.4)
53
+ activemodel (6.1.6.1)
54
+ activesupport (= 6.1.6.1)
55
+ activerecord (6.1.6.1)
56
+ activemodel (= 6.1.6.1)
57
+ activesupport (= 6.1.6.1)
58
+ activestorage (6.1.6.1)
59
+ actionpack (= 6.1.6.1)
60
+ activejob (= 6.1.6.1)
61
+ activerecord (= 6.1.6.1)
62
+ activesupport (= 6.1.6.1)
63
+ marcel (~> 1.0)
64
+ mini_mime (>= 1.1.0)
65
+ activesupport (6.1.6.1)
62
66
  concurrent-ruby (~> 1.0, >= 1.0.2)
63
- i18n (>= 0.7, < 2)
64
- minitest (~> 5.1)
65
- tzinfo (~> 1.1)
66
- zeitwerk (~> 2.2, >= 2.2.2)
67
- addressable (2.4.0)
68
- ast (2.4.0)
69
- backports (3.11.4)
67
+ i18n (>= 1.6, < 2)
68
+ minitest (>= 5.1)
69
+ tzinfo (~> 2.0)
70
+ zeitwerk (~> 2.3)
71
+ ast (2.4.2)
70
72
  builder (3.2.4)
71
73
  childprocess (0.9.0)
72
74
  ffi (~> 1.0, >= 1.0.11)
73
75
  coderay (1.1.2)
74
- concurrent-ruby (1.1.7)
76
+ concurrent-ruby (1.1.10)
75
77
  crass (1.0.6)
76
- diff-lcs (1.3)
78
+ diff-lcs (1.4.4)
79
+ digest (3.1.0)
77
80
  erubi (1.10.0)
78
- ethon (0.11.0)
79
- ffi (>= 1.3.0)
80
81
  factory_bot (4.11.1)
81
82
  activesupport (>= 3.0.0)
82
83
  factory_bot_rails (4.11.1)
83
84
  factory_bot (~> 4.11.1)
84
85
  railties (>= 3.0.0)
85
- faraday (0.15.3)
86
- multipart-post (>= 1.2, < 3)
87
- faraday_middleware (0.12.2)
88
- faraday (>= 0.7.4, < 1.0)
89
- ffi (1.9.25)
90
- gh (0.15.1)
91
- addressable (~> 2.4.0)
92
- backports
93
- faraday (~> 0.8)
94
- multi_json (~> 1.0)
95
- net-http-persistent (~> 2.9)
96
- net-http-pipeline
97
- globalid (0.4.2)
98
- activesupport (>= 4.2.0)
99
- highline (1.7.10)
100
- i18n (1.8.5)
86
+ faraday (1.10.2)
87
+ faraday-em_http (~> 1.0)
88
+ faraday-em_synchrony (~> 1.0)
89
+ faraday-excon (~> 1.1)
90
+ faraday-httpclient (~> 1.0)
91
+ faraday-multipart (~> 1.0)
92
+ faraday-net_http (~> 1.0)
93
+ faraday-net_http_persistent (~> 1.0)
94
+ faraday-patron (~> 1.0)
95
+ faraday-rack (~> 1.0)
96
+ faraday-retry (~> 1.0)
97
+ ruby2_keywords (>= 0.0.4)
98
+ faraday-em_http (1.0.0)
99
+ faraday-em_synchrony (1.0.0)
100
+ faraday-excon (1.1.0)
101
+ faraday-httpclient (1.0.1)
102
+ faraday-multipart (1.0.4)
103
+ multipart-post (~> 2)
104
+ faraday-net_http (1.0.1)
105
+ faraday-net_http_persistent (1.2.0)
106
+ faraday-patron (1.0.0)
107
+ faraday-rack (1.0.0)
108
+ faraday-retry (1.0.3)
109
+ faraday_middleware (1.2.0)
110
+ faraday (~> 1.0)
111
+ ffi (1.15.5)
112
+ globalid (1.0.0)
113
+ activesupport (>= 5.0)
114
+ i18n (1.11.0)
101
115
  concurrent-ruby (~> 1.0)
102
116
  iniparse (1.4.4)
103
- jaro_winkler (1.5.1)
104
- json (2.3.1)
105
- launchy (2.4.3)
106
- addressable (~> 2.3)
107
- loofah (2.7.0)
117
+ loofah (2.18.0)
108
118
  crass (~> 1.0.2)
109
119
  nokogiri (>= 1.5.9)
110
120
  mail (2.7.1)
111
121
  mini_mime (>= 0.1.1)
112
- marcel (0.3.3)
113
- mimemagic (~> 0.3.2)
122
+ marcel (1.0.2)
114
123
  method_source (0.9.2)
115
- mimemagic (0.3.5)
116
- mini_mime (1.0.2)
117
- mini_portile2 (2.4.0)
118
- minitest (5.14.2)
119
- multi_json (1.13.1)
120
- multipart-post (2.0.0)
121
- net-http-persistent (2.9.4)
122
- net-http-pipeline (1.0.1)
123
- nio4r (2.5.4)
124
- nokogiri (1.10.10)
125
- mini_portile2 (~> 2.4.0)
124
+ mini_mime (1.1.2)
125
+ mini_portile2 (2.8.0)
126
+ minitest (5.16.2)
127
+ multipart-post (2.2.3)
128
+ net-protocol (0.1.3)
129
+ timeout
130
+ net-smtp (0.3.1)
131
+ digest
132
+ net-protocol
133
+ timeout
134
+ nio4r (2.5.8)
135
+ nokogiri (1.13.7)
136
+ mini_portile2 (~> 2.8.0)
137
+ racc (~> 1.4)
126
138
  overcommit (0.46.0)
127
139
  childprocess (~> 0.6, >= 0.6.3)
128
140
  iniparse (~> 1.4)
129
- parallel (1.12.1)
130
- parser (2.5.1.2)
131
- ast (~> 2.4.0)
132
- powerpack (0.1.2)
141
+ parallel (1.22.1)
142
+ parser (3.1.2.0)
143
+ ast (~> 2.4.1)
133
144
  pry (0.11.3)
134
145
  coderay (~> 1.1.0)
135
146
  method_source (~> 0.9.0)
136
147
  pry-rails (0.3.6)
137
148
  pry (>= 0.10.4)
138
- pusher-client (0.6.2)
139
- json
140
- websocket (~> 1.0)
141
- rack (2.2.3)
142
- rack-test (1.1.0)
143
- rack (>= 1.0, < 3)
144
- rails (6.0.3.4)
145
- actioncable (= 6.0.3.4)
146
- actionmailbox (= 6.0.3.4)
147
- actionmailer (= 6.0.3.4)
148
- actionpack (= 6.0.3.4)
149
- actiontext (= 6.0.3.4)
150
- actionview (= 6.0.3.4)
151
- activejob (= 6.0.3.4)
152
- activemodel (= 6.0.3.4)
153
- activerecord (= 6.0.3.4)
154
- activestorage (= 6.0.3.4)
155
- activesupport (= 6.0.3.4)
156
- bundler (>= 1.3.0)
157
- railties (= 6.0.3.4)
149
+ racc (1.6.0)
150
+ rack (2.2.4)
151
+ rack-test (2.0.2)
152
+ rack (>= 1.3)
153
+ rails (6.1.6.1)
154
+ actioncable (= 6.1.6.1)
155
+ actionmailbox (= 6.1.6.1)
156
+ actionmailer (= 6.1.6.1)
157
+ actionpack (= 6.1.6.1)
158
+ actiontext (= 6.1.6.1)
159
+ actionview (= 6.1.6.1)
160
+ activejob (= 6.1.6.1)
161
+ activemodel (= 6.1.6.1)
162
+ activerecord (= 6.1.6.1)
163
+ activestorage (= 6.1.6.1)
164
+ activesupport (= 6.1.6.1)
165
+ bundler (>= 1.15.0)
166
+ railties (= 6.1.6.1)
158
167
  sprockets-rails (>= 2.0.0)
159
168
  rails-dom-testing (2.0.3)
160
169
  activesupport (>= 4.2.0)
161
170
  nokogiri (>= 1.6)
162
- rails-html-sanitizer (1.3.0)
171
+ rails-html-sanitizer (1.4.3)
163
172
  loofah (~> 2.3)
164
- railties (6.0.3.4)
165
- actionpack (= 6.0.3.4)
166
- activesupport (= 6.0.3.4)
173
+ railties (6.1.6.1)
174
+ actionpack (= 6.1.6.1)
175
+ activesupport (= 6.1.6.1)
167
176
  method_source
168
- rake (>= 0.8.7)
169
- thor (>= 0.20.3, < 2.0)
170
- rainbow (3.0.0)
171
- rake (13.0.1)
172
- rspec-core (3.8.0)
173
- rspec-support (~> 3.8.0)
174
- rspec-expectations (3.8.2)
177
+ rake (>= 12.2)
178
+ thor (~> 1.0)
179
+ rainbow (3.1.1)
180
+ rake (13.0.3)
181
+ regexp_parser (2.4.0)
182
+ rexml (3.2.5)
183
+ rspec-core (3.10.1)
184
+ rspec-support (~> 3.10.0)
185
+ rspec-expectations (3.10.1)
175
186
  diff-lcs (>= 1.2.0, < 2.0)
176
- rspec-support (~> 3.8.0)
177
- rspec-mocks (3.8.0)
187
+ rspec-support (~> 3.10.0)
188
+ rspec-mocks (3.10.2)
178
189
  diff-lcs (>= 1.2.0, < 2.0)
179
- rspec-support (~> 3.8.0)
180
- rspec-rails (3.8.0)
181
- actionpack (>= 3.0)
182
- activesupport (>= 3.0)
183
- railties (>= 3.0)
184
- rspec-core (~> 3.8.0)
185
- rspec-expectations (~> 3.8.0)
186
- rspec-mocks (~> 3.8.0)
187
- rspec-support (~> 3.8.0)
188
- rspec-support (3.8.0)
189
- rubocop (0.59.2)
190
- jaro_winkler (~> 1.5.1)
190
+ rspec-support (~> 3.10.0)
191
+ rspec-rails (5.0.1)
192
+ actionpack (>= 5.2)
193
+ activesupport (>= 5.2)
194
+ railties (>= 5.2)
195
+ rspec-core (~> 3.10)
196
+ rspec-expectations (~> 3.10)
197
+ rspec-mocks (~> 3.10)
198
+ rspec-support (~> 3.10)
199
+ rspec-support (3.10.2)
200
+ rubocop (1.29.1)
191
201
  parallel (~> 1.10)
192
- parser (>= 2.5, != 2.5.1.1)
193
- powerpack (~> 0.1)
202
+ parser (>= 3.1.0.0)
194
203
  rainbow (>= 2.2.2, < 4.0)
204
+ regexp_parser (>= 1.8, < 3.0)
205
+ rexml (>= 3.2.5, < 4.0)
206
+ rubocop-ast (>= 1.17.0, < 2.0)
195
207
  ruby-progressbar (~> 1.7)
196
- unicode-display_width (~> 1.0, >= 1.0.1)
197
- ruby-progressbar (1.10.0)
198
- sprockets (4.0.2)
208
+ unicode-display_width (>= 1.4.0, < 3.0)
209
+ rubocop-ast (1.18.0)
210
+ parser (>= 3.1.1.0)
211
+ rubocop-rspec (1.30.0)
212
+ rubocop (>= 0.58.0)
213
+ ruby-progressbar (1.11.0)
214
+ ruby2_keywords (0.0.5)
215
+ sprockets (4.1.1)
199
216
  concurrent-ruby (~> 1.0)
200
217
  rack (> 1, < 3)
201
- sprockets-rails (3.2.2)
202
- actionpack (>= 4.0)
203
- activesupport (>= 4.0)
218
+ sprockets-rails (3.4.2)
219
+ actionpack (>= 5.2)
220
+ activesupport (>= 5.2)
204
221
  sprockets (>= 3.0.0)
205
222
  sqlite3 (1.4.2)
206
- thor (1.0.1)
207
- thread_safe (0.3.6)
208
- travis (1.8.9)
209
- backports
210
- faraday (~> 0.9)
211
- faraday_middleware (~> 0.9, >= 0.9.1)
212
- gh (~> 0.13)
213
- highline (~> 1.6)
214
- launchy (~> 2.1)
215
- pusher-client (~> 0.4)
216
- typhoeus (~> 0.6, >= 0.6.8)
217
- typhoeus (0.8.0)
218
- ethon (>= 0.8.0)
219
- tzinfo (1.2.8)
220
- thread_safe (~> 0.1)
221
- unicode-display_width (1.4.0)
222
- websocket (1.2.8)
223
- websocket-driver (0.7.3)
223
+ thor (1.2.1)
224
+ timeout (0.2.0)
225
+ tzinfo (2.0.4)
226
+ concurrent-ruby (~> 1.0)
227
+ unicode-display_width (2.1.0)
228
+ websocket-driver (0.7.5)
224
229
  websocket-extensions (>= 0.1.0)
225
230
  websocket-extensions (0.1.5)
226
- zeitwerk (2.4.1)
231
+ zeitwerk (2.6.0)
227
232
 
228
233
  PLATFORMS
229
234
  ruby
230
235
 
231
236
  DEPENDENCIES
232
- bundler (~> 1.12)
233
237
  external_services!
234
238
  factory_bot_rails
239
+ net-smtp
235
240
  overcommit
236
241
  pry-rails
237
242
  rake (~> 13.0)
238
243
  rspec-rails
239
- rubocop (~> 0.48)
244
+ rubocop (~> 1.0)
245
+ rubocop-rspec
240
246
  sqlite3
241
- travis (~> 1.8, >= 1.8.2)
242
247
 
243
248
  BUNDLED WITH
244
- 1.17.3
249
+ 2.3.14
data/README.md CHANGED
@@ -1,7 +1,11 @@
1
- # ExternalServices [![Build Status](https://travis-ci.org/flant/external_services.svg?branch=master)](https://travis-ci.org/flant/external_services)
1
+ # ExternalServices
2
+
3
+ [![Test](https://github.com/flant/external_services/actions/workflows/ruby.yml/badge.svg)](https://github.com/flant/external_services/actions/workflows/ruby.yml) [![Gem Version](https://badge.fury.io/rb/external_services.svg)](https://badge.fury.io/rb/external_services)
4
+
2
5
 
3
6
  Gem helps syncronizing objects to different external services like Gitlab, Redmine and any other.
4
7
 
8
+
5
9
  ## Installation
6
10
 
7
11
  Add this line to your application's Gemfile:
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
17
+ APP_RAKEFILE = File.expand_path('spec/dummy/Rakefile', __dir__)
18
18
 
19
19
  load 'rails/tasks/engine.rake'
20
20
 
@@ -2,6 +2,8 @@ module ExternalServices
2
2
  class ApiJob < ActiveJob::Base
3
3
  queue_as :default
4
4
 
5
+ retry_on ExternalServices::Api::Error, attempts: 5, wait: ->(executions) { (Math.gamma(executions) * 60).seconds } # (n-1)! * 60
6
+
5
7
  def action_class
6
8
  "ExternalServices::ApiActions::#{self.class.to_s.demodulize.gsub(/ApiJob/, '')}".constantize
7
9
  end
@@ -16,7 +16,7 @@ module ExternalServices
16
16
  end
17
17
 
18
18
  def set_processed!
19
- update_attributes! processed_at: Time.now
19
+ update! processed_at: Time.now
20
20
  end
21
21
 
22
22
  def execute!
@@ -25,6 +25,7 @@ module ExternalServices
25
25
 
26
26
  def kick_active_job
27
27
  # return if processed? || api_disabled?
28
+ return if saved_changes.size == 1 && saved_change_to_options.present?
28
29
 
29
30
  job_class.set(queue: prefixed_queue).perform_later(id)
30
31
  end
@@ -35,10 +36,8 @@ module ExternalServices
35
36
 
36
37
  module ClassMethods
37
38
  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
39
+ Sidekiq::Queue.all.each do |queue|
40
+ queue.clear if queue.name.include?(QUEUE_PREFIX)
42
41
  end
43
42
  end
44
43
 
@@ -53,6 +53,12 @@ module ExternalServices
53
53
  !async && (method.to_sym == :delete) ? nil : super
54
54
  end
55
55
 
56
+ def set_processed!
57
+ return true unless async
58
+
59
+ super
60
+ end
61
+
56
62
  protected
57
63
 
58
64
  def assign_queue
@@ -1,5 +1,4 @@
1
-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'external_services/version'
5
4
 
@@ -23,7 +22,7 @@ Gem::Specification.new do |spec|
23
22
  And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db.
24
23
  MSG
25
24
 
26
- spec.add_dependency 'faraday', '>= 0.9'
27
- spec.add_dependency 'faraday_middleware', '>= 0.10'
28
- spec.add_dependency 'rails', ['>= 4.2.5', '< 6.1']
25
+ spec.add_dependency 'faraday', '>= 1.4', '< 2'
26
+ spec.add_dependency 'faraday_middleware', '>= 1.0', '< 2'
27
+ spec.add_dependency 'rails', ['>= 4.2.5', '< 7']
29
28
  end
@@ -110,7 +110,7 @@ module ExternalServices
110
110
  respond_to?(:saved_change_to_id?) ? saved_change_to_id? : id_changed?
111
111
  }
112
112
 
113
- after_save :"#{name}_on_update", if: proc {# Rails 5.1+ support
113
+ after_save :"#{name}_on_update", if: proc { # Rails 5.1+ support
114
114
  !(respond_to?(:saved_change_to_id?) ? saved_change_to_id? : id_changed?)
115
115
  }
116
116
 
@@ -142,7 +142,7 @@ module ExternalServices
142
142
  end
143
143
  end
144
144
  end
145
- # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
145
+ # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity
146
146
 
147
147
  include callbacks_module
148
148
  end
@@ -14,10 +14,10 @@ module ExternalServices
14
14
  @response.inspect
15
15
  end
16
16
 
17
- alias :to_s :message
17
+ alias to_s message
18
18
 
19
19
  def inspect
20
- "#{self.class}: #{to_s}"
20
+ "#{self.class}: #{self}"
21
21
  end
22
22
  end
23
23
 
@@ -1,3 +1,3 @@
1
1
  module ExternalServices
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.5.1'.freeze
3
3
  end
@@ -7,14 +7,14 @@ module ExternalServices
7
7
  class InstallGenerator < ::Rails::Generators::Base
8
8
  include ::Rails::Generators::Migration
9
9
 
10
- source_root File.expand_path('../templates', __FILE__)
10
+ source_root File.expand_path('templates', __dir__)
11
11
 
12
12
  desc 'Generates migrations and directories.'
13
13
 
14
14
  def migration_version
15
- return unless Rails::VERSION::MAJOR >= 5
15
+ return unless Rails::VERSION::MAJOR >= 5
16
16
 
17
- "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
17
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
18
18
  end
19
19
 
20
20
  def create_migration_files
@@ -5,7 +5,7 @@ module ExternalServices
5
5
  module Generators
6
6
  # Installs ExternalServices in a rails app.
7
7
  class ServiceGenerator < ::Rails::Generators::NamedBase
8
- source_root File.expand_path('../templates/services', __FILE__)
8
+ source_root File.expand_path('templates/services', __dir__)
9
9
 
10
10
  class_option(
11
11
  :only_api_actions,
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.update_attributes! identifier: "#{@api_object.identifier}1"
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.3
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-23 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.9'
19
+ version: '1.4'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0.9'
29
+ version: '1.4'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: faraday_middleware
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '0.10'
39
+ version: '1.0'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2'
34
43
  type: :runtime
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
37
46
  requirements:
38
47
  - - ">="
39
48
  - !ruby/object:Gem::Version
40
- version: '0.10'
49
+ version: '1.0'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rails
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -47,7 +59,7 @@ dependencies:
47
59
  version: 4.2.5
48
60
  - - "<"
49
61
  - !ruby/object:Gem::Version
50
- version: '6.1'
62
+ version: '7'
51
63
  type: :runtime
52
64
  prerelease: false
53
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +69,7 @@ dependencies:
57
69
  version: 4.2.5
58
70
  - - "<"
59
71
  - !ruby/object:Gem::Version
60
- version: '6.1'
72
+ version: '7'
61
73
  description:
62
74
  email:
63
75
  - sergey.gnuskov@flant.com
@@ -65,11 +77,12 @@ executables: []
65
77
  extensions: []
66
78
  extra_rdoc_files: []
67
79
  files:
80
+ - ".github/workflows/gem-push.yml"
81
+ - ".github/workflows/ruby.yml"
68
82
  - ".gitignore"
69
83
  - ".overcommit.yml"
70
84
  - ".rspec"
71
85
  - ".rubocop.yml"
72
- - ".travis.yml"
73
86
  - Gemfile
74
87
  - Gemfile.lock
75
88
  - LICENSE.txt
@@ -119,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
132
  - !ruby/object:Gem::Version
120
133
  version: '0'
121
134
  requirements: []
122
- rubygems_version: 3.0.8
135
+ rubygems_version: 3.3.7
123
136
  signing_key:
124
137
  specification_version: 4
125
138
  summary: Gem helps syncronizing objects to different external services like Gitlab,
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- - 2.7.1
6
- before_install: gem install bundler -v 1.17.3
7
- env:
8
- - RAILS_ENV=test
9
- script:
10
- - bundle exec rake db:create --trace
11
- - bundle exec rake db:migrate --trace
12
- - bundle exec rake
13
- deploy:
14
- provider: rubygems
15
- api_key:
16
- secure: rgni1lDjNhUTL8NUdJA4oSYu+vzB1Fp8TJ5wVhJfW8E0NUD5YItodmc52RLv3Hwt2501Dqx4pt4WaIP3E71OAG3KzsPUY1NPoCqP4KpXo6c7T1qqFieKztDa8aGOCqjkQ/1to9yt6qdKg6PtjsSWtKu8f3ROhLpBmd4r2phnb1GucKRnH5yaQQtcoNb8AmnE0VBEF2wzALsMg2QdZRk/1qJInbgUldc10FG/33DW71h5IKR8/n2L0Ggm+/ZYe2Rg0aGUE3VHHSkHJFvoHIjwfYaNHu7FrUjYywM4XfZBdl+bdL3a6Op8p+2VRAPMb4Wdb6K0O+f5vGQyvntvR3pMuqFVLC0mL9mkz8RYK7VXVxBfxZk3LQvA15oN52uvN523iKTjM+VvzmEIhZ1+oozN5W9XxT6VSqZTo7rj4lQto0g6+9Ev4kVP92JGMT0GlJcPcZ8PlW7j9phvEXgy89IvLLvF63nVlWw7xAY4pZUlTd185sfSWWPFSyqX4W/djqHq963MB0H8k6lGNnwLf+xFCMScaM52hZ+TEvtapX7nCn7dzgWv8s6kwYqWPa9J0Tegxr364RL7pq0mXEf7JwNivAYv7aAR8PHAg7y15Qw/MXRzoUWG5G5AfZii+GY6cp0Cyo2am0ut05OudYcuohifP4DWkn0wlwDT/QYLv8bMhaE=
17
- gem: external_services
18
- on:
19
- tags: true
20
- repo: flant/external_services