allq_rest 1.2.4 → 1.2.7

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: 1d549d56163c4c43d207acc92e7d5b747d8863f6841cebfc5e446335da449755
4
- data.tar.gz: 60f839763817c0faf3c0cf613562d08cdd0b92a373441f80cb56c77ce05dedd7
3
+ metadata.gz: c894f6fe084a132d3a7c91b3950eb33720577989fe902f5b2e932fdd9906f5b1
4
+ data.tar.gz: c223af34965d58659dd116568268ef12dad30c473dba5db0d894a8fbd01958e5
5
5
  SHA512:
6
- metadata.gz: e93e53b383f42d0fc447aa5d03e445c36fd1428ca6a3eb9b1e17196741f9fad948cb7741d63291b571343cda79f6a8a5ecd78dde6b0b83dd20c8f83104ca4e88
7
- data.tar.gz: d5bd05dd99290d7dcac8a11b20d6b8a3b84374d06fe76cd85154ff84e7a6f0bc5e5f70cf24be30c0154891ca9489a8bdd59a7c9d3e5da4fc797e4128d3b085e6
6
+ metadata.gz: da34829fbc9288c6161c74b8f4595608c3e16568e34ae977e41960b2e9b36225af3acbece2b96f49df6245bbcc4c93e3f8aea608e0836a25402b7f73a5466e2d
7
+ data.tar.gz: c69151989a83c5d1bf2344876430254dd88e32fdc9eeeba7e99cb562cde2ff4cc96dca19972231de53e0372d3f4c82db3901a3af82656bf02bc1676dc57a60ff
data/Gemfile.lock CHANGED
@@ -1,31 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allq_rest (1.2.2)
4
+ allq_rest (1.2.7)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- ZenTest (4.12.0)
12
- addressable (2.7.0)
13
- public_suffix (>= 2.0.2, < 5.0)
14
- autotest (4.4.6)
15
- ZenTest (>= 4.4.1)
16
- autotest-fsevent (0.2.17)
17
- sys-uname
18
- autotest-growl (0.2.16)
19
- autotest-rails-pure (4.1.2)
20
- crack (0.4.3)
21
- safe_yaml (~> 1.0.0)
22
11
  diff-lcs (1.4.4)
23
- ethon (0.12.0)
24
- ffi (>= 1.3.0)
25
- ffi (1.13.1)
26
- hashdiff (1.0.1)
27
- json (2.3.1)
28
- public_suffix (4.0.6)
12
+ ethon (0.15.0)
13
+ ffi (>= 1.15.0)
14
+ ffi (1.15.5)
15
+ json (2.6.1)
29
16
  rake (12.0.0)
30
17
  rspec (3.9.0)
31
18
  rspec-core (~> 3.9.0)
@@ -40,28 +27,16 @@ GEM
40
27
  diff-lcs (>= 1.2.0, < 2.0)
41
28
  rspec-support (~> 3.9.0)
42
29
  rspec-support (3.9.3)
43
- safe_yaml (1.0.5)
44
- sys-uname (1.2.1)
45
- ffi (>= 1.0.0)
46
30
  typhoeus (1.4.0)
47
31
  ethon (>= 0.9.0)
48
- vcr (3.0.3)
49
- webmock (1.24.6)
50
- addressable (>= 2.3.6)
51
- crack (>= 0.3.2)
52
- hashdiff
53
32
 
54
33
  PLATFORMS
55
34
  ruby
56
35
 
57
36
  DEPENDENCIES
58
37
  allq_rest!
59
- autotest (~> 4.4, >= 4.4.6)
60
- autotest-fsevent (~> 0.2, >= 0.2.12)
61
- autotest-growl (~> 0.2, >= 0.2.16)
62
- autotest-rails-pure (~> 4.1, >= 4.1.2)
63
38
  rake (~> 12.0.0)
64
39
  rspec (~> 3.6, >= 3.6.0)
65
- vcr (~> 3.0, >= 3.0.1)
66
- webmock (~> 1.24, >= 1.24.3)
67
40
 
41
+ BUNDLED WITH
42
+ 2.2.3
Binary file
Binary file
data/allq_rest.gemspec CHANGED
@@ -13,20 +13,14 @@ Gem::Specification.new do |s|
13
13
  s.summary = "Ruby REST client for Allq platform"
14
14
  s.description = "Allq API Client"
15
15
  # TODO uncommnet and update below with a proper license
16
- #s.license = "Apache 2.0"
16
+ s.license = "Apache 2.0"
17
17
  s.required_ruby_version = "> 2.3"
18
18
 
19
19
  s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
20
20
  s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
21
21
 
22
22
  s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
23
- s.add_development_dependency 'vcr', '~> 3.0', '>= 3.0.1'
24
- s.add_development_dependency 'webmock', '~> 1.24', '>= 1.24.3'
25
- s.add_development_dependency 'autotest', '~> 4.4', '>= 4.4.6'
26
- s.add_development_dependency 'autotest-rails-pure', '~> 4.1', '>= 4.1.2'
27
- s.add_development_dependency 'autotest-growl', '~> 0.2', '>= 0.2.16'
28
- s.add_development_dependency 'autotest-fsevent', '~> 0.2', '>= 0.2.12'
29
-
23
+
30
24
  s.files = `find *`.split("\n").uniq.sort.select{|f| !f.empty? }
31
25
  s.test_files = `find spec/*`.split("\n")
32
26
  s.executables = []
data/deploy.sh CHANGED
@@ -1,3 +1,3 @@
1
1
  echo "Did you update the version?"
2
2
  gem build allq_rest.gemspec
3
- gem push allq_rest-1.2.4.gem
3
+ gem push allq_rest-1.2.7.gem
@@ -30,6 +30,7 @@ module Allq
30
30
  # Initializes the ApiClient
31
31
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
32
  def initialize(config = Configuration.default)
33
+ Ethon.logger = Logger.new(nil)
33
34
  @config = config
34
35
  @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
35
36
  @default_headers = {
@@ -142,7 +142,6 @@ module Allq
142
142
  @inject_format = false
143
143
  @force_ending_format = false
144
144
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
145
-
146
145
  yield(self) if block_given?
147
146
  end
148
147
 
@@ -6,7 +6,7 @@
6
6
  OpenAPI spec version: 1.0
7
7
 
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.2
9
+ Swagger Codegen version: 2.4.21
10
10
 
11
11
  =end
12
12
 
@@ -33,6 +33,12 @@ module Allq
33
33
  # TPS of throttle
34
34
  attr_accessor :throttle_size
35
35
 
36
+ # Average duration of job
37
+ attr_accessor :avg
38
+
39
+ # Average duration of job
40
+ attr_accessor :tps
41
+
36
42
  # Name of tube
37
43
  attr_accessor :tube
38
44
 
@@ -45,6 +51,8 @@ module Allq
45
51
  :'buried' => :'buried',
46
52
  :'parents' => :'parents',
47
53
  :'throttle_size' => :'throttle_size',
54
+ :'avg' => :'avg',
55
+ :'tps' => :'tps',
48
56
  :'tube' => :'tube'
49
57
  }
50
58
  end
@@ -58,6 +66,8 @@ module Allq
58
66
  :'buried' => :'Integer',
59
67
  :'parents' => :'Integer',
60
68
  :'throttle_size' => :'Integer',
69
+ :'avg' => :'Integer',
70
+ :'tps' => :'tps',
61
71
  :'tube' => :'String'
62
72
  }
63
73
  end
@@ -104,6 +114,14 @@ module Allq
104
114
  self.throttle_size = attributes[:'throttle_size']
105
115
  end
106
116
 
117
+ if attributes.has_key?(:'avg')
118
+ self.avg = attributes[:'avg']
119
+ end
120
+
121
+ if attributes.has_key?(:'tps')
122
+ self.tps = attributes[:'tps']
123
+ end
124
+
107
125
  if attributes.has_key?(:'tube')
108
126
  self.tube = attributes[:'tube']
109
127
  end
@@ -163,6 +181,8 @@ module Allq
163
181
  buried == o.buried &&
164
182
  parents == o.parents &&
165
183
  throttle_size == o.throttle_size &&
184
+ avg == o.avg &&
185
+ tps == o.tps &&
166
186
  tube == o.tube
167
187
  end
168
188
 
@@ -175,7 +195,7 @@ module Allq
175
195
  # Calculates hash code according to all attributes.
176
196
  # @return [Fixnum] Hash code
177
197
  def hash
178
- [ready, delayed, reserved, buried, parents, throttle_size, tube].hash
198
+ [ready, delayed, reserved, buried, parents, throttle_size, avg, tube].hash
179
199
  end
180
200
 
181
201
  # Builds the object from hash
@@ -185,7 +205,7 @@ module Allq
185
205
  return nil unless attributes.is_a?(Hash)
186
206
  self.class.swagger_types.each_pair do |key, type|
187
207
  if type =~ /\AArray<(.*)>/i
188
- # check to ensure the input is an array given that the the attribute
208
+ # check to ensure the input is an array given that the attribute
189
209
  # is documented as an array but the input is not
190
210
  if attributes[self.class.attribute_map[key]].is_a?(Array)
191
211
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -281,5 +301,6 @@ module Allq
281
301
  value
282
302
  end
283
303
  end
304
+
284
305
  end
285
306
  end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.2
11
11
  =end
12
12
 
13
13
  module Allq
14
- VERSION = '1.2.4'
14
+ VERSION = '1.2.7'
15
15
  end
@@ -24,10 +24,13 @@ describe 'ActionsApi' do
24
24
  allq_conf = Allq::Configuration.new do |config|
25
25
  config.host = ENV['ALLQ_CLIENT_LOCATION'] || 'localhost:8091'
26
26
  end
27
-
28
27
  raw_client = Allq::ApiClient.new(allq_conf)
29
28
  @instance = Allq::ActionsApi.new(raw_client)
30
- stats_result = AllQTools::get_stats[0]
29
+ @admin_tools = Allq::AdminApi.new(raw_client)
30
+
31
+ @allq_tool = AllQTools.new(@instance, @admin_tools)
32
+
33
+ stats_result = @allq_tool.get_stats[0]
31
34
  stats_result.stats.each do |stat|
32
35
  @instance.tube_delete(stat.tube)
33
36
  end
@@ -51,12 +54,12 @@ describe 'ActionsApi' do
51
54
  # @return [BasicResponse]
52
55
  describe 'bury_put test' do
53
56
  it "should work" do
54
- AllQTools::add_job
55
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
57
+ @allq_tool.add_job
58
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
56
59
  job = @instance.job_get(DEFAULT_TUBE)
57
60
  @instance.bury_put(job.id)
58
- expect(AllQTools::get_buried(DEFAULT_TUBE)).to eq(1)
59
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
61
+ expect(@allq_tool.get_buried(DEFAULT_TUBE)).to eq(1)
62
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
60
63
  end
61
64
  end
62
65
 
@@ -69,11 +72,11 @@ describe 'ActionsApi' do
69
72
  # @return [BasicResponse]
70
73
  describe 'job_delete test' do
71
74
  it "should work" do
72
- AllQTools::add_job
73
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
75
+ @allq_tool.add_job
76
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
74
77
  job = @instance.peek_get(DEFAULT_TUBE)
75
78
  @instance.job_delete(job.id, tube: DEFAULT_TUBE)
76
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
79
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
77
80
  end
78
81
  end
79
82
 
@@ -85,9 +88,9 @@ describe 'ActionsApi' do
85
88
  # @return [JobResponse]
86
89
  describe 'job_get test' do
87
90
  it "should work" do
88
- AllQTools::add_job
91
+ @allq_tool.add_job
89
92
  job = @instance.job_get(DEFAULT_TUBE)
90
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
93
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
91
94
  expect(job.id).to be_truthy
92
95
  end
93
96
  end
@@ -101,19 +104,19 @@ describe 'ActionsApi' do
101
104
  describe 'mulitple_job_get test' do
102
105
  it "should work" do
103
106
  1.upto(6) do
104
- AllQTools::add_job
107
+ @allq_tool.add_job
105
108
  end
106
109
  multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
107
110
  expect(multiple_jobs.jobs.length).to eq(4)
108
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
111
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
109
112
  multiple_jobs.jobs.each do |job|
110
113
  @instance.job_delete(job.id)
111
114
  end
112
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(0)
115
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(0)
113
116
 
114
117
  multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
115
118
  expect(multiple_jobs.jobs.length).to eq(2)
116
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
119
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
117
120
  end
118
121
  end
119
122
 
@@ -125,8 +128,8 @@ describe 'ActionsApi' do
125
128
  # @return [JobRef]
126
129
  describe 'job_post test' do
127
130
  it "should work" do
128
- AllQTools::add_job
129
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
131
+ @allq_tool.add_job
132
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
130
133
  job = @instance.job_get(DEFAULT_TUBE)
131
134
  expect(job.id).to be_truthy
132
135
  end
@@ -149,18 +152,18 @@ describe 'ActionsApi' do
149
152
  run_on_timeout: false,
150
153
  limit: 2)
151
154
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
152
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
153
- job = AllQTools::new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
155
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
156
+ job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
154
157
  @instance.job_post(job)
155
- job = AllQTools::new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
158
+ job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
156
159
  @instance.job_post(job)
157
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
158
- AllQTools::get_finish(DEFAULT_TUBE)
159
- AllQTools::get_finish(DEFAULT_TUBE)
160
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
161
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
162
- AllQTools::get_finish(DEFAULT_TUBE)
163
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
160
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
161
+ @allq_tool.get_finish(DEFAULT_TUBE)
162
+ @allq_tool.get_finish(DEFAULT_TUBE)
163
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
164
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
165
+ @allq_tool.get_finish(DEFAULT_TUBE)
166
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
164
167
  end
165
168
  end
166
169
 
@@ -181,19 +184,19 @@ describe 'ActionsApi' do
181
184
  run_on_timeout: false,
182
185
  limit: 2)
183
186
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
184
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
187
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
185
188
 
186
- job = AllQTools::new_job('foo', nil, new_parent_job_response.job_id)
189
+ job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
187
190
  @instance.job_post(job)
188
- job = AllQTools::new_job('foo', nil, new_parent_job_response.job_id)
191
+ job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
189
192
  @instance.job_post(job)
190
- expect(AllQTools::get_ready('foo')).to eq(2)
191
- AllQTools::get_finish('foo')
192
- AllQTools::get_finish('foo')
193
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
194
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
195
- AllQTools::get_finish(DEFAULT_TUBE)
196
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
193
+ expect(@allq_tool.get_ready('foo')).to eq(2)
194
+ @allq_tool.get_finish('foo')
195
+ @allq_tool.get_finish('foo')
196
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
197
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
198
+ @allq_tool.get_finish(DEFAULT_TUBE)
199
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
197
200
  end
198
201
  end
199
202
 
@@ -214,16 +217,16 @@ describe 'ActionsApi' do
214
217
  run_on_timeout: true,
215
218
  limit: 2)
216
219
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
217
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
220
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
218
221
 
219
- job = AllQTools::new_job('foo', nil, new_parent_job_response.job_id)
222
+ job = @allq_tool.new_job('foo', nil, new_parent_job_response.job_id)
220
223
  @instance.job_post(job)
221
- expect(AllQTools::get_ready('foo')).to eq(1)
222
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
224
+ expect(@allq_tool.get_ready('foo')).to eq(1)
225
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
223
226
 
224
227
  sleep(7)
225
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
226
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
228
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
229
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
227
230
  end
228
231
  end
229
232
 
@@ -236,7 +239,7 @@ describe 'ActionsApi' do
236
239
  # @return [JobResponse]
237
240
  describe 'peek_get test' do
238
241
  it "should work" do
239
- AllQTools::add_job
242
+ @allq_tool.add_job
240
243
  job = @instance.peek_get(DEFAULT_TUBE)
241
244
  expect(job.id).to be_truthy
242
245
  end
@@ -244,7 +247,7 @@ describe 'ActionsApi' do
244
247
 
245
248
  describe 'peek_get buried test' do
246
249
  it "should work" do
247
- AllQTools::add_job
250
+ @allq_tool.add_job
248
251
  job = @instance.peek_get(DEFAULT_TUBE, buried: true)
249
252
  expect(job.id).to be_falsey
250
253
  job = @instance.job_get(DEFAULT_TUBE)
@@ -277,20 +280,20 @@ describe 'ActionsApi' do
277
280
  # @return [BasicResponse]
278
281
  describe 'release_put test' do
279
282
  it "should work" do
280
- AllQTools::add_job
281
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
283
+ @allq_tool.add_job
284
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
282
285
  job = @instance.job_get(DEFAULT_TUBE)
283
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
286
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
284
287
  expect(job.id).to be_truthy
285
288
  @instance.release_put(job.id)
286
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
289
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
287
290
  end
288
291
  end
289
292
 
290
293
  describe 'release should increment release' do
291
294
  it "should work" do
292
- AllQTools::add_job
293
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
295
+ @allq_tool.add_job
296
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
294
297
  job = @instance.job_get(DEFAULT_TUBE)
295
298
  expect(job.releases).to eq(0)
296
299
  @instance.release_put(job.id)
@@ -322,25 +325,25 @@ describe 'ActionsApi' do
322
325
  run_on_timeout: false,
323
326
  limit: nil)
324
327
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
325
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
326
- job = AllQTools::new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
328
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
329
+ job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
327
330
  @instance.job_post(job)
328
- job = AllQTools::new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
331
+ job = @allq_tool.new_job(DEFAULT_TUBE, nil, new_parent_job_response.job_id)
329
332
  @instance.job_post(job)
330
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
331
- AllQTools::get_finish(DEFAULT_TUBE)
332
- AllQTools::get_finish(DEFAULT_TUBE)
333
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
334
+ @allq_tool.get_finish(DEFAULT_TUBE)
335
+ @allq_tool.get_finish(DEFAULT_TUBE)
333
336
  # After jobs have already finished
334
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
337
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
335
338
  # Parent still waiting
336
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
339
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
337
340
  # Set limit on parent
338
341
  @instance.set_children_started_put(new_parent_job_response.job_id)
339
342
  # Now parent gets moved to ready
340
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
341
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
342
- AllQTools::get_finish(DEFAULT_TUBE)
343
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
343
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
344
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(0)
345
+ @allq_tool.get_finish(DEFAULT_TUBE)
346
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
344
347
  end
345
348
  end
346
349
 
@@ -365,10 +368,10 @@ describe 'ActionsApi' do
365
368
  # @return [TubeRef]
366
369
  describe 'throttle_post test' do
367
370
  it "should work" do
368
- AllQTools::add_job
369
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
371
+ @allq_tool.add_job
372
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
370
373
  @instance.job_get(DEFAULT_TUBE)
371
- stats_result = AllQTools::get_stats[0]
374
+ stats_result = @allq_tool.get_stats[0]
372
375
  expect(stats_result.action_count > 1).to eq(true)
373
376
  end
374
377
  end
@@ -381,8 +384,8 @@ describe 'ActionsApi' do
381
384
  # @return [BasicResponse]
382
385
  describe 'touch_put test' do
383
386
  it "should work" do
384
- AllQTools::add_job
385
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
387
+ @allq_tool.add_job
388
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
386
389
  job = @instance.job_get(DEFAULT_TUBE)
387
390
  @instance.touch_put(job.id)
388
391
  end
@@ -432,31 +435,31 @@ describe 'ActionsApi' do
432
435
  priority: 5,
433
436
  parent_id: nil)
434
437
  @instance.job_post(new_job)
435
- expect(AllQTools::get_ready("alt_tube2")).to eq(2) # OK..it's there
438
+ expect(@allq_tool.get_ready("alt_tube2")).to eq(2) # OK..it's there
436
439
  reserved_job = @instance.job_get("alt_tube2")
437
440
 
438
441
  # Other tube has 1 ready, 1 reserved
439
- expect(AllQTools::get_ready("alt_tube2")).to eq(1)
440
- expect(AllQTools::get_reserved("alt_tube2")).to eq(1)
442
+ expect(@allq_tool.get_ready("alt_tube2")).to eq(1)
443
+ expect(@allq_tool.get_reserved("alt_tube2")).to eq(1)
441
444
 
442
445
  # Get 1 into buried, 1 into reserved, and 1 in ready so we can clear it
443
- expect(AllQTools::get_ready(alt_tube_name)).to eq(3) # OK..it's there
446
+ expect(@allq_tool.get_ready(alt_tube_name)).to eq(3) # OK..it's there
444
447
  reserved_job = @instance.job_get(alt_tube_name)
445
- expect(AllQTools::get_reserved(alt_tube_name)).to eq(1) # OK..it's there
448
+ expect(@allq_tool.get_reserved(alt_tube_name)).to eq(1) # OK..it's there
446
449
  reserved_job = @instance.job_get(alt_tube_name)
447
- expect(AllQTools::get_reserved(alt_tube_name)).to eq(2) # OK..it's there
450
+ expect(@allq_tool.get_reserved(alt_tube_name)).to eq(2) # OK..it's there
448
451
  @instance.bury_put(reserved_job.id)
449
- expect(AllQTools::get_buried(alt_tube_name)).to eq(1)
452
+ expect(@allq_tool.get_buried(alt_tube_name)).to eq(1)
450
453
 
451
454
  # Now check that first tube is empty
452
455
  @instance.tube_delete(alt_tube_name)
453
- expect(AllQTools::get_buried(alt_tube_name)).to eq(0)
454
- expect(AllQTools::get_reserved(alt_tube_name)).to eq(0) # OK..it's there
455
- expect(AllQTools::get_ready(alt_tube_name)).to eq(0)
456
+ expect(@allq_tool.get_buried(alt_tube_name)).to eq(0)
457
+ expect(@allq_tool.get_reserved(alt_tube_name)).to eq(0) # OK..it's there
458
+ expect(@allq_tool.get_ready(alt_tube_name)).to eq(0)
456
459
 
457
460
  # ..and other tubes are fine
458
- expect(AllQTools::get_ready("alt_tube2")).to eq(1)
459
- expect(AllQTools::get_reserved("alt_tube2")).to eq(1)
461
+ expect(@allq_tool.get_ready("alt_tube2")).to eq(1)
462
+ expect(@allq_tool.get_reserved("alt_tube2")).to eq(1)
460
463
  end
461
464
  end
462
465
 
@@ -471,9 +474,9 @@ describe 'ActionsApi' do
471
474
  priority: 5,
472
475
  parent_id: nil)
473
476
  @instance.job_post(new_job)
474
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0) # Too soon to show up
477
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0) # Too soon to show up
475
478
  sleep(4)
476
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1) # OK..it's there
479
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1) # OK..it's there
477
480
  end
478
481
  end
479
482
 
@@ -490,18 +493,21 @@ describe 'ActionsApi' do
490
493
  @instance.job_post(new_job)
491
494
  sleep(1)
492
495
  @instance.job_get(DEFAULT_TUBE)
493
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
496
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
494
497
  sleep(5)
495
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(0) # Should expire
496
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1) # ..and be back in ready
498
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(0) # Should expire
499
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1) # ..and be back in ready
497
500
  end
498
501
  end
499
502
 
500
503
  end
501
504
 
502
505
 
503
- module AllQTools
504
- class << self
506
+ class AllQTools
507
+ def initialize(action_client, admin_client)
508
+ @action_client = action_client
509
+ @admin_client = admin_client
510
+ end
505
511
 
506
512
  def new_job(tube = 'default', body = nil, parent_id = nil)
507
513
  body = (0...8).map { (65 + rand(26)).chr }.join unless body
@@ -516,20 +522,20 @@ module AllQTools
516
522
  end
517
523
 
518
524
  def add_job(tube = DEFAULT_TUBE)
519
- client = Allq::ActionsApi.new
525
+ client = @action_client
520
526
  job = new_job(tube)
521
527
  job = client.job_post(new_job)
522
528
  return job
523
529
  end
524
530
 
525
531
  def get_finish(tube)
526
- client = Allq::ActionsApi.new
532
+ client = @action_client
527
533
  job = client.job_get(tube)
528
534
  client.job_delete(job.id)
529
535
  end
530
536
 
531
537
  def get_stats
532
- client = Allq::AdminApi.new
538
+ client = @admin_client
533
539
  client.stats_get
534
540
  end
535
541
 
@@ -576,5 +582,4 @@ module AllQTools
576
582
  end
577
583
  end
578
584
  end
579
- end
580
585
  end
data/spec/spec_helper.rb CHANGED
@@ -55,6 +55,8 @@ RSpec.configure do |config|
55
55
  mocks.verify_partial_doubles = true
56
56
  end
57
57
 
58
+ config.warnings = true
59
+
58
60
  # The settings below are suggested to provide a good initial experience
59
61
  # with RSpec, but feel free to customize to your heart's content.
60
62
  =begin
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allq_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - support@blitline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -70,126 +70,6 @@ dependencies:
70
70
  - - "~>"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '3.6'
73
- - !ruby/object:Gem::Dependency
74
- name: vcr
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '3.0'
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: 3.0.1
83
- type: :development
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.0'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 3.0.1
93
- - !ruby/object:Gem::Dependency
94
- name: webmock
95
- requirement: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '1.24'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 1.24.3
103
- type: :development
104
- prerelease: false
105
- version_requirements: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '1.24'
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: 1.24.3
113
- - !ruby/object:Gem::Dependency
114
- name: autotest
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '4.4'
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: 4.4.6
123
- type: :development
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: '4.4'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: 4.4.6
133
- - !ruby/object:Gem::Dependency
134
- name: autotest-rails-pure
135
- requirement: !ruby/object:Gem::Requirement
136
- requirements:
137
- - - "~>"
138
- - !ruby/object:Gem::Version
139
- version: '4.1'
140
- - - ">="
141
- - !ruby/object:Gem::Version
142
- version: 4.1.2
143
- type: :development
144
- prerelease: false
145
- version_requirements: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - "~>"
148
- - !ruby/object:Gem::Version
149
- version: '4.1'
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: 4.1.2
153
- - !ruby/object:Gem::Dependency
154
- name: autotest-growl
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.2'
160
- - - ">="
161
- - !ruby/object:Gem::Version
162
- version: 0.2.16
163
- type: :development
164
- prerelease: false
165
- version_requirements: !ruby/object:Gem::Requirement
166
- requirements:
167
- - - "~>"
168
- - !ruby/object:Gem::Version
169
- version: '0.2'
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: 0.2.16
173
- - !ruby/object:Gem::Dependency
174
- name: autotest-fsevent
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '0.2'
180
- - - ">="
181
- - !ruby/object:Gem::Version
182
- version: 0.2.12
183
- type: :development
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - "~>"
188
- - !ruby/object:Gem::Version
189
- version: '0.2'
190
- - - ">="
191
- - !ruby/object:Gem::Version
192
- version: 0.2.12
193
73
  description: Allq API Client
194
74
  email:
195
75
  - support@blitline.com
@@ -201,7 +81,8 @@ files:
201
81
  - Gemfile.lock
202
82
  - README.md
203
83
  - Rakefile
204
- - allq_rest-1.2.3.gem
84
+ - allq_rest-1.2.5.gem
85
+ - allq_rest-1.2.6.gem
205
86
  - allq_rest.gemspec
206
87
  - deploy.sh
207
88
  - docs/ActionsApi.md
@@ -257,7 +138,8 @@ files:
257
138
  - spec/models/tube_ref_spec.rb
258
139
  - spec/spec_helper.rb
259
140
  homepage: http://www.blitline.com
260
- licenses: []
141
+ licenses:
142
+ - Apache 2.0
261
143
  metadata: {}
262
144
  post_install_message:
263
145
  rdoc_options: []
@@ -274,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
156
  - !ruby/object:Gem::Version
275
157
  version: '0'
276
158
  requirements: []
277
- rubyforge_project:
278
- rubygems_version: 2.7.9
159
+ rubygems_version: 3.0.9
279
160
  signing_key:
280
161
  specification_version: 4
281
162
  summary: Ruby REST client for Allq platform
data/allq_rest-1.2.3.gem DELETED
Binary file