external_services 0.3.1 → 0.4.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: 255b4da146ba0b683ed63958932c09d6c724c8656798b6dee862bbf96eccd572
4
- data.tar.gz: 3c04d0ac36c607e4d8c28995dff4a388ecef60785018a8f8afb3d15a4a11d15e
3
+ metadata.gz: 92c1be5018af4ae557172d9356067a060ed1a5815f776ee0b88c8267cbde8c25
4
+ data.tar.gz: 80c51c26e32976717e96c114260a165914fada0b4a4106aaf1835fe20798988d
5
5
  SHA512:
6
- metadata.gz: 6931c8a6581ab4008652f870f4bf79d0b484b97af99302e3e49ab98a7de23e13479692b953b434b754222d49ef378aca10fd182c3d902cc26201b57db599a9f7
7
- data.tar.gz: 7e962eaa3711edd494073526789fe7356cfa5381daba2c4228c541cc5a4e30668bdffe06ce64bf9d3d9f72399bd3081ef8a7c4ce306fa57606ae97cfa999ba98
6
+ metadata.gz: 1f908bc5a978f9db391ec8dc89dc9fd3164a945204c91f1f83db0876381190646df3e3b9b582d8631c1bd63f2bea958df76cb1e61cf813c9a9b32260d37cfa1a
7
+ data.tar.gz: 707d673a53707fad53ea4e683a22f4d2e674f2a442518b281c20f8fd4a5f28f481502e2778f8a402c0c02246c4fbea837f4f2ebc1cfab3897f80464c975eb1e3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- external_services (0.3.1)
4
+ external_services (0.4.0)
5
5
  faraday (>= 0.9)
6
6
  faraday_middleware (>= 0.10)
7
7
  rails (>= 4.2.5, < 6.0)
@@ -9,43 +9,43 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actioncable (5.2.0)
13
- actionpack (= 5.2.0)
12
+ actioncable (5.2.1)
13
+ actionpack (= 5.2.1)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
- actionmailer (5.2.0)
17
- actionpack (= 5.2.0)
18
- actionview (= 5.2.0)
19
- activejob (= 5.2.0)
16
+ actionmailer (5.2.1)
17
+ actionpack (= 5.2.1)
18
+ actionview (= 5.2.1)
19
+ activejob (= 5.2.1)
20
20
  mail (~> 2.5, >= 2.5.4)
21
21
  rails-dom-testing (~> 2.0)
22
- actionpack (5.2.0)
23
- actionview (= 5.2.0)
24
- activesupport (= 5.2.0)
22
+ actionpack (5.2.1)
23
+ actionview (= 5.2.1)
24
+ activesupport (= 5.2.1)
25
25
  rack (~> 2.0)
26
26
  rack-test (>= 0.6.3)
27
27
  rails-dom-testing (~> 2.0)
28
28
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
29
- actionview (5.2.0)
30
- activesupport (= 5.2.0)
29
+ actionview (5.2.1)
30
+ activesupport (= 5.2.1)
31
31
  builder (~> 3.1)
32
32
  erubi (~> 1.4)
33
33
  rails-dom-testing (~> 2.0)
34
34
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
35
- activejob (5.2.0)
36
- activesupport (= 5.2.0)
35
+ activejob (5.2.1)
36
+ activesupport (= 5.2.1)
37
37
  globalid (>= 0.3.6)
38
- activemodel (5.2.0)
39
- activesupport (= 5.2.0)
40
- activerecord (5.2.0)
41
- activemodel (= 5.2.0)
42
- activesupport (= 5.2.0)
38
+ activemodel (5.2.1)
39
+ activesupport (= 5.2.1)
40
+ activerecord (5.2.1)
41
+ activemodel (= 5.2.1)
42
+ activesupport (= 5.2.1)
43
43
  arel (>= 9.0)
44
- activestorage (5.2.0)
45
- actionpack (= 5.2.0)
46
- activerecord (= 5.2.0)
44
+ activestorage (5.2.1)
45
+ actionpack (= 5.2.1)
46
+ activerecord (= 5.2.1)
47
47
  marcel (~> 0.3.1)
48
- activesupport (5.2.0)
48
+ activesupport (5.2.1)
49
49
  concurrent-ruby (~> 1.0, >= 1.0.2)
50
50
  i18n (>= 0.7, < 2)
51
51
  minitest (~> 5.1)
@@ -53,7 +53,7 @@ GEM
53
53
  addressable (2.4.0)
54
54
  arel (9.0.0)
55
55
  ast (2.4.0)
56
- backports (3.11.3)
56
+ backports (3.11.4)
57
57
  builder (3.2.3)
58
58
  childprocess (0.9.0)
59
59
  ffi (~> 1.0, >= 1.0.11)
@@ -64,16 +64,16 @@ GEM
64
64
  erubi (1.7.1)
65
65
  ethon (0.11.0)
66
66
  ffi (>= 1.3.0)
67
- factory_bot (4.8.2)
67
+ factory_bot (4.11.1)
68
68
  activesupport (>= 3.0.0)
69
- factory_bot_rails (4.8.2)
70
- factory_bot (~> 4.8.2)
69
+ factory_bot_rails (4.11.1)
70
+ factory_bot (~> 4.11.1)
71
71
  railties (>= 3.0.0)
72
- faraday (0.15.0)
72
+ faraday (0.15.3)
73
73
  multipart-post (>= 1.2, < 3)
74
74
  faraday_middleware (0.12.2)
75
75
  faraday (>= 0.7.4, < 1.0)
76
- ffi (1.9.23)
76
+ ffi (1.9.25)
77
77
  gh (0.15.1)
78
78
  addressable (~> 2.4.0)
79
79
  backports
@@ -84,38 +84,39 @@ GEM
84
84
  globalid (0.4.1)
85
85
  activesupport (>= 4.2.0)
86
86
  highline (1.7.10)
87
- i18n (1.0.1)
87
+ i18n (1.1.1)
88
88
  concurrent-ruby (~> 1.0)
89
89
  iniparse (1.4.4)
90
+ jaro_winkler (1.5.1)
90
91
  json (2.1.0)
91
92
  launchy (2.4.3)
92
93
  addressable (~> 2.3)
93
94
  loofah (2.2.2)
94
95
  crass (~> 1.0.2)
95
96
  nokogiri (>= 1.5.9)
96
- mail (2.7.0)
97
+ mail (2.7.1)
97
98
  mini_mime (>= 0.1.1)
98
- marcel (0.3.2)
99
+ marcel (0.3.3)
99
100
  mimemagic (~> 0.3.2)
100
101
  method_source (0.9.0)
101
102
  mimemagic (0.3.2)
102
- mini_mime (1.0.0)
103
+ mini_mime (1.0.1)
103
104
  mini_portile2 (2.3.0)
104
105
  minitest (5.11.3)
105
106
  multi_json (1.13.1)
106
107
  multipart-post (2.0.0)
107
108
  net-http-persistent (2.9.4)
108
109
  net-http-pipeline (1.0.1)
109
- nio4r (2.3.0)
110
- nokogiri (1.8.2)
110
+ nio4r (2.3.1)
111
+ nokogiri (1.8.5)
111
112
  mini_portile2 (~> 2.3.0)
112
- overcommit (0.45.0)
113
+ overcommit (0.46.0)
113
114
  childprocess (~> 0.6, >= 0.6.3)
114
115
  iniparse (~> 1.4)
115
116
  parallel (1.12.1)
116
- parser (2.5.1.0)
117
+ parser (2.5.1.2)
117
118
  ast (~> 2.4.0)
118
- powerpack (0.1.1)
119
+ powerpack (0.1.2)
119
120
  pry (0.11.3)
120
121
  coderay (~> 1.1.0)
121
122
  method_source (~> 0.9.0)
@@ -125,60 +126,61 @@ GEM
125
126
  json
126
127
  websocket (~> 1.0)
127
128
  rack (2.0.5)
128
- rack-test (1.0.0)
129
+ rack-test (1.1.0)
129
130
  rack (>= 1.0, < 3)
130
- rails (5.2.0)
131
- actioncable (= 5.2.0)
132
- actionmailer (= 5.2.0)
133
- actionpack (= 5.2.0)
134
- actionview (= 5.2.0)
135
- activejob (= 5.2.0)
136
- activemodel (= 5.2.0)
137
- activerecord (= 5.2.0)
138
- activestorage (= 5.2.0)
139
- activesupport (= 5.2.0)
131
+ rails (5.2.1)
132
+ actioncable (= 5.2.1)
133
+ actionmailer (= 5.2.1)
134
+ actionpack (= 5.2.1)
135
+ actionview (= 5.2.1)
136
+ activejob (= 5.2.1)
137
+ activemodel (= 5.2.1)
138
+ activerecord (= 5.2.1)
139
+ activestorage (= 5.2.1)
140
+ activesupport (= 5.2.1)
140
141
  bundler (>= 1.3.0)
141
- railties (= 5.2.0)
142
+ railties (= 5.2.1)
142
143
  sprockets-rails (>= 2.0.0)
143
144
  rails-dom-testing (2.0.3)
144
145
  activesupport (>= 4.2.0)
145
146
  nokogiri (>= 1.6)
146
147
  rails-html-sanitizer (1.0.4)
147
148
  loofah (~> 2.2, >= 2.2.2)
148
- railties (5.2.0)
149
- actionpack (= 5.2.0)
150
- activesupport (= 5.2.0)
149
+ railties (5.2.1)
150
+ actionpack (= 5.2.1)
151
+ activesupport (= 5.2.1)
151
152
  method_source
152
153
  rake (>= 0.8.7)
153
- thor (>= 0.18.1, < 2.0)
154
+ thor (>= 0.19.0, < 2.0)
154
155
  rainbow (3.0.0)
155
156
  rake (10.5.0)
156
- rspec-core (3.7.1)
157
- rspec-support (~> 3.7.0)
158
- rspec-expectations (3.7.0)
157
+ rspec-core (3.8.0)
158
+ rspec-support (~> 3.8.0)
159
+ rspec-expectations (3.8.2)
159
160
  diff-lcs (>= 1.2.0, < 2.0)
160
- rspec-support (~> 3.7.0)
161
- rspec-mocks (3.7.0)
161
+ rspec-support (~> 3.8.0)
162
+ rspec-mocks (3.8.0)
162
163
  diff-lcs (>= 1.2.0, < 2.0)
163
- rspec-support (~> 3.7.0)
164
- rspec-rails (3.7.2)
164
+ rspec-support (~> 3.8.0)
165
+ rspec-rails (3.8.0)
165
166
  actionpack (>= 3.0)
166
167
  activesupport (>= 3.0)
167
168
  railties (>= 3.0)
168
- rspec-core (~> 3.7.0)
169
- rspec-expectations (~> 3.7.0)
170
- rspec-mocks (~> 3.7.0)
171
- rspec-support (~> 3.7.0)
172
- rspec-support (3.7.1)
173
- rubocop (0.55.0)
169
+ rspec-core (~> 3.8.0)
170
+ rspec-expectations (~> 3.8.0)
171
+ rspec-mocks (~> 3.8.0)
172
+ rspec-support (~> 3.8.0)
173
+ rspec-support (3.8.0)
174
+ rubocop (0.59.2)
175
+ jaro_winkler (~> 1.5.1)
174
176
  parallel (~> 1.10)
175
- parser (>= 2.5)
177
+ parser (>= 2.5, != 2.5.1.1)
176
178
  powerpack (~> 0.1)
177
179
  rainbow (>= 2.2.2, < 4.0)
178
180
  ruby-progressbar (~> 1.7)
179
181
  unicode-display_width (~> 1.0, >= 1.0.1)
180
- ruby-progressbar (1.9.0)
181
- sprockets (3.7.1)
182
+ ruby-progressbar (1.10.0)
183
+ sprockets (3.7.2)
182
184
  concurrent-ruby (~> 1.0)
183
185
  rack (> 1, < 3)
184
186
  sprockets-rails (3.2.1)
@@ -188,7 +190,7 @@ GEM
188
190
  sqlite3 (1.3.13)
189
191
  thor (0.20.0)
190
192
  thread_safe (0.3.6)
191
- travis (1.8.8)
193
+ travis (1.8.9)
192
194
  backports
193
195
  faraday (~> 0.9)
194
196
  faraday_middleware (~> 0.9, >= 0.9.1)
@@ -201,8 +203,8 @@ GEM
201
203
  ethon (>= 0.8.0)
202
204
  tzinfo (1.2.5)
203
205
  thread_safe (~> 0.1)
204
- unicode-display_width (1.3.2)
205
- websocket (1.2.5)
206
+ unicode-display_width (1.4.0)
207
+ websocket (1.2.8)
206
208
  websocket-driver (0.7.0)
207
209
  websocket-extensions (>= 0.1.0)
208
210
  websocket-extensions (0.1.3)
@@ -2,6 +2,8 @@ module ExternalServices
2
2
  module Action
3
3
  extend ActiveSupport::Concern
4
4
 
5
+ QUEUE_PREFIX = 'external_services'
6
+
5
7
  included do
6
8
  scope :processed, -> { where.not(processed_at: nil) }
7
9
  scope :unprocessed, -> { where(processed_at: nil) }
@@ -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
- job_class.set(queue: queue).perform_later(id)
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
 
@@ -19,7 +19,6 @@ module ExternalServices
19
19
 
20
20
  before_validation :assign_queue
21
21
  before_validation :process_data
22
- after_commit :kick_active_job
23
22
 
24
23
  before_create :calculate_signature
25
24
 
@@ -18,6 +18,11 @@ 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
28
  spec.add_dependency 'rails', ['>= 4.2.5', '< 6.0']
@@ -1,3 +1,3 @@
1
1
  module ExternalServices
2
- VERSION = '0.3.1'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
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.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Gnuskov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-28 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -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
@@ -118,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
120
  version: '0'
119
121
  requirements: []
120
122
  rubyforge_project:
121
- rubygems_version: 2.7.6
123
+ rubygems_version: 2.7.7
122
124
  signing_key:
123
125
  specification_version: 4
124
126
  summary: Gem helps syncronizing objects to different external services like Gitlab,