allq_rest 1.2.4 → 1.2.5

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: edfdc643e9c8a7043876f6c202be451cb23513ed35555c70f28974acc2252b60
4
+ data.tar.gz: ea9ebce349d569b9b2d57d4fee5b0daee69dae2335d9d06208b4118ab4731bb5
5
5
  SHA512:
6
- metadata.gz: e93e53b383f42d0fc447aa5d03e445c36fd1428ca6a3eb9b1e17196741f9fad948cb7741d63291b571343cda79f6a8a5ecd78dde6b0b83dd20c8f83104ca4e88
7
- data.tar.gz: d5bd05dd99290d7dcac8a11b20d6b8a3b84374d06fe76cd85154ff84e7a6f0bc5e5f70cf24be30c0154891ca9489a8bdd59a7c9d3e5da4fc797e4128d3b085e6
6
+ metadata.gz: 70691e5b359e0a440e442e0babd7680c1ce1d40643d8d4343af890230f1c3b456c0dab8b16ec94f1b7c406df1cbfaee51c9fb672019bcc5039a33da1a0875176
7
+ data.tar.gz: 18785fea81c30649ddda7a1d31703caf63b80d3b4c980a50c125cd2a82a9c2258046ed2959e2ad704581a7631cafce4bd7a3d80e0432601ee64c67a4345a07a8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allq_rest (1.2.2)
4
+ allq_rest (1.2.5)
5
5
  json (~> 2.1, >= 2.1.0)
6
6
  typhoeus (~> 1.0, >= 1.0.1)
7
7
 
@@ -20,11 +20,11 @@ GEM
20
20
  crack (0.4.3)
21
21
  safe_yaml (~> 1.0.0)
22
22
  diff-lcs (1.4.4)
23
- ethon (0.12.0)
24
- ffi (>= 1.3.0)
25
- ffi (1.13.1)
23
+ ethon (0.14.0)
24
+ ffi (>= 1.15.0)
25
+ ffi (1.15.1)
26
26
  hashdiff (1.0.1)
27
- json (2.3.1)
27
+ json (2.5.1)
28
28
  public_suffix (4.0.6)
29
29
  rake (12.0.0)
30
30
  rspec (3.9.0)
@@ -65,3 +65,5 @@ DEPENDENCIES
65
65
  vcr (~> 3.0, >= 3.0.1)
66
66
  webmock (~> 1.24, >= 1.24.3)
67
67
 
68
+ BUNDLED WITH
69
+ 2.2.3
data/allq_rest.gemspec CHANGED
@@ -13,7 +13,7 @@ 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'
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.5.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
 
@@ -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.5'
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.5
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: 2021-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -34,42 +34,42 @@ dependencies:
34
34
  name: json
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 2.1.0
40
37
  - - "~>"
41
38
  - !ruby/object:Gem::Version
42
39
  version: '2.1'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.1.0
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 2.1.0
50
47
  - - "~>"
51
48
  - !ruby/object:Gem::Version
52
49
  version: '2.1'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.1.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rspec
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 3.6.0
60
57
  - - "~>"
61
58
  - !ruby/object:Gem::Version
62
59
  version: '3.6'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 3.6.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 3.6.0
70
67
  - - "~>"
71
68
  - !ruby/object:Gem::Version
72
69
  version: '3.6'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.6.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: vcr
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -201,7 +201,6 @@ files:
201
201
  - Gemfile.lock
202
202
  - README.md
203
203
  - Rakefile
204
- - allq_rest-1.2.3.gem
205
204
  - allq_rest.gemspec
206
205
  - deploy.sh
207
206
  - docs/ActionsApi.md
@@ -257,7 +256,8 @@ files:
257
256
  - spec/models/tube_ref_spec.rb
258
257
  - spec/spec_helper.rb
259
258
  homepage: http://www.blitline.com
260
- licenses: []
259
+ licenses:
260
+ - Apache 2.0
261
261
  metadata: {}
262
262
  post_install_message:
263
263
  rdoc_options: []
@@ -274,8 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
- rubyforge_project:
278
- rubygems_version: 2.7.9
277
+ rubygems_version: 3.2.3
279
278
  signing_key:
280
279
  specification_version: 4
281
280
  summary: Ruby REST client for Allq platform
data/allq_rest-1.2.3.gem DELETED
Binary file