allq_rest 1.2.2 → 1.2.6

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: 3599f2ab5c85ed438b31d09771ef480342786201aa4d3e544297d0caa1d71eec
4
- data.tar.gz: 0fd186fae23fe932802a42d6bed8e5df8f8f8277b8de4a999fedd32d08c0c9f8
3
+ metadata.gz: 1408b8a497b82506fd034da76191cad3d63532784dc93126b21a22aa7301e4ff
4
+ data.tar.gz: 902c1bff0103082afef6a355ed407ea5cf7c0a64d8cae21e9e70f329a233df72
5
5
  SHA512:
6
- metadata.gz: 4402103362c503e0e208f7b977a7c836da0f72e37e8884e08601fb5834436d79f6f659b5d9be4eaf1b4a1fa687ff0c2821784de2968e8e909dc2affe770e6ee9
7
- data.tar.gz: c30efefd28bef740423fe768fea991f65364c70547e40112fd5ef3e2889c4307f1f1c20cbedca0299dc1946281555e6743737c6386b11e40837d4212d84db2df
6
+ metadata.gz: bc3060e0d79318cff373dbf151aae42268548f136cabdc1170d55fb8ce94be248abceccecf4b0b59492d9bf7575ca744c0ef7d455ae1f8d7c8a7b9594d4218f0
7
+ data.tar.gz: 52e03790fcce1e8fc5bc83ade3cc91532e2645755a242fe51617da9f7cfcd500c580010bab1a0ff5c06f2596cb213fe8e651ab3e717897eb4254604a6d29fec6
data/Gemfile.lock CHANGED
@@ -1,49 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- allq_rest (1.0.0)
4
+ allq_rest (1.2.5)
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.11.1)
12
- addressable (2.5.2)
13
- public_suffix (>= 2.0.2, < 4.0)
11
+ ZenTest (4.12.0)
12
+ addressable (2.7.0)
13
+ public_suffix (>= 2.0.2, < 5.0)
14
14
  autotest (4.4.6)
15
15
  ZenTest (>= 4.4.1)
16
- autotest-fsevent (0.2.14)
16
+ autotest-fsevent (0.2.17)
17
17
  sys-uname
18
18
  autotest-growl (0.2.16)
19
19
  autotest-rails-pure (4.1.2)
20
20
  crack (0.4.3)
21
21
  safe_yaml (~> 1.0.0)
22
- diff-lcs (1.3)
23
- ethon (0.11.0)
24
- ffi (>= 1.3.0)
25
- ffi (1.9.25)
26
- hashdiff (0.3.7)
27
- json (2.1.0)
28
- public_suffix (3.0.3)
22
+ diff-lcs (1.4.4)
23
+ ethon (0.14.0)
24
+ ffi (>= 1.15.0)
25
+ ffi (1.15.1)
26
+ hashdiff (1.0.1)
27
+ json (2.5.1)
28
+ public_suffix (4.0.6)
29
29
  rake (12.0.0)
30
- rspec (3.8.0)
31
- rspec-core (~> 3.8.0)
32
- rspec-expectations (~> 3.8.0)
33
- rspec-mocks (~> 3.8.0)
34
- rspec-core (3.8.0)
35
- rspec-support (~> 3.8.0)
36
- rspec-expectations (3.8.2)
30
+ rspec (3.9.0)
31
+ rspec-core (~> 3.9.0)
32
+ rspec-expectations (~> 3.9.0)
33
+ rspec-mocks (~> 3.9.0)
34
+ rspec-core (3.9.2)
35
+ rspec-support (~> 3.9.3)
36
+ rspec-expectations (3.9.2)
37
37
  diff-lcs (>= 1.2.0, < 2.0)
38
- rspec-support (~> 3.8.0)
39
- rspec-mocks (3.8.0)
38
+ rspec-support (~> 3.9.0)
39
+ rspec-mocks (3.9.1)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.8.0)
42
- rspec-support (3.8.0)
43
- safe_yaml (1.0.4)
44
- sys-uname (1.0.3)
41
+ rspec-support (~> 3.9.0)
42
+ rspec-support (3.9.3)
43
+ safe_yaml (1.0.5)
44
+ sys-uname (1.2.1)
45
45
  ffi (>= 1.0.0)
46
- typhoeus (1.3.0)
46
+ typhoeus (1.4.0)
47
47
  ethon (>= 0.9.0)
48
48
  vcr (3.0.3)
49
49
  webmock (1.24.6)
@@ -66,4 +66,4 @@ DEPENDENCIES
66
66
  webmock (~> 1.24, >= 1.24.3)
67
67
 
68
68
  BUNDLED WITH
69
- 1.16.2
69
+ 2.2.3
Binary file
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.1.gem
3
+ gem push allq_rest-1.2.6.gem
data/lib/.DS_Store CHANGED
Binary file
@@ -27,9 +27,10 @@ module Allq
27
27
  # @return [Hash]
28
28
  attr_accessor :default_headers
29
29
 
30
- # Initializes the ApiRest
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 = {
@@ -39,7 +40,7 @@ module Allq
39
40
  end
40
41
 
41
42
  def self.default
42
- @@default ||= ApiRest.new
43
+ @@default ||= ApiClient.new
43
44
  end
44
45
 
45
46
  # Call an API with given options.
@@ -263,7 +264,7 @@ module Allq
263
264
  def build_request_url(path)
264
265
  # Add leading and trailing slashes to path
265
266
  path = "/#{path}".gsub(/\/+/, '/')
266
- URI.encode(@config.base_url + path)
267
+ @config.base_url + path
267
268
  end
268
269
 
269
270
  # Builds the HTTP request body
@@ -10,8 +10,6 @@ Swagger Codegen version: 2.4.2
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
14
-
15
13
  module Allq
16
14
  class Configuration
17
15
  # Defines url scheme
@@ -144,7 +142,6 @@ module Allq
144
142
  @inject_format = false
145
143
  @force_ending_format = false
146
144
  @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
147
-
148
145
  yield(self) if block_given?
149
146
  end
150
147
 
@@ -175,7 +172,7 @@ module Allq
175
172
 
176
173
  def base_url
177
174
  url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
178
- URI.encode(url)
175
+ url
179
176
  end
180
177
 
181
178
  # Gets API key (with prefix if set).
@@ -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,9 @@ 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
+
36
39
  # Name of tube
37
40
  attr_accessor :tube
38
41
 
@@ -45,6 +48,7 @@ module Allq
45
48
  :'buried' => :'buried',
46
49
  :'parents' => :'parents',
47
50
  :'throttle_size' => :'throttle_size',
51
+ :'avg' => :'avg',
48
52
  :'tube' => :'tube'
49
53
  }
50
54
  end
@@ -58,6 +62,7 @@ module Allq
58
62
  :'buried' => :'Integer',
59
63
  :'parents' => :'Integer',
60
64
  :'throttle_size' => :'Integer',
65
+ :'avg' => :'Integer',
61
66
  :'tube' => :'String'
62
67
  }
63
68
  end
@@ -104,6 +109,10 @@ module Allq
104
109
  self.throttle_size = attributes[:'throttle_size']
105
110
  end
106
111
 
112
+ if attributes.has_key?(:'avg')
113
+ self.avg = attributes[:'avg']
114
+ end
115
+
107
116
  if attributes.has_key?(:'tube')
108
117
  self.tube = attributes[:'tube']
109
118
  end
@@ -163,6 +172,7 @@ module Allq
163
172
  buried == o.buried &&
164
173
  parents == o.parents &&
165
174
  throttle_size == o.throttle_size &&
175
+ avg == o.avg &&
166
176
  tube == o.tube
167
177
  end
168
178
 
@@ -175,7 +185,7 @@ module Allq
175
185
  # Calculates hash code according to all attributes.
176
186
  # @return [Fixnum] Hash code
177
187
  def hash
178
- [ready, delayed, reserved, buried, parents, throttle_size, tube].hash
188
+ [ready, delayed, reserved, buried, parents, throttle_size, avg, tube].hash
179
189
  end
180
190
 
181
191
  # Builds the object from hash
@@ -185,7 +195,7 @@ module Allq
185
195
  return nil unless attributes.is_a?(Hash)
186
196
  self.class.swagger_types.each_pair do |key, type|
187
197
  if type =~ /\AArray<(.*)>/i
188
- # check to ensure the input is an array given that the the attribute
198
+ # check to ensure the input is an array given that the attribute
189
199
  # is documented as an array but the input is not
190
200
  if attributes[self.class.attribute_map[key]].is_a?(Array)
191
201
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -281,5 +291,6 @@ module Allq
281
291
  value
282
292
  end
283
293
  end
294
+
284
295
  end
285
296
  end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.2
11
11
  =end
12
12
 
13
13
  module Allq
14
- VERSION = '1.2.2'
14
+ VERSION = '1.2.6'
15
15
  end
@@ -21,8 +21,16 @@ ALT_TUBE = ""
21
21
  describe 'ActionsApi' do
22
22
  before do
23
23
  # run before each test
24
- @instance = Allq::ActionsApi.new
25
- stats_result = AllQTools::get_stats[0]
24
+ allq_conf = Allq::Configuration.new do |config|
25
+ config.host = ENV['ALLQ_CLIENT_LOCATION'] || 'localhost:8091'
26
+ end
27
+ raw_client = Allq::ApiClient.new(allq_conf)
28
+ @instance = Allq::ActionsApi.new(raw_client)
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]
26
34
  stats_result.stats.each do |stat|
27
35
  @instance.tube_delete(stat.tube)
28
36
  end
@@ -46,12 +54,12 @@ describe 'ActionsApi' do
46
54
  # @return [BasicResponse]
47
55
  describe 'bury_put test' do
48
56
  it "should work" do
49
- AllQTools::add_job
50
- 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)
51
59
  job = @instance.job_get(DEFAULT_TUBE)
52
60
  @instance.bury_put(job.id)
53
- expect(AllQTools::get_buried(DEFAULT_TUBE)).to eq(1)
54
- 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)
55
63
  end
56
64
  end
57
65
 
@@ -64,11 +72,11 @@ describe 'ActionsApi' do
64
72
  # @return [BasicResponse]
65
73
  describe 'job_delete test' do
66
74
  it "should work" do
67
- AllQTools::add_job
68
- 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)
69
77
  job = @instance.peek_get(DEFAULT_TUBE)
70
78
  @instance.job_delete(job.id, tube: DEFAULT_TUBE)
71
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
79
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
72
80
  end
73
81
  end
74
82
 
@@ -80,9 +88,9 @@ describe 'ActionsApi' do
80
88
  # @return [JobResponse]
81
89
  describe 'job_get test' do
82
90
  it "should work" do
83
- AllQTools::add_job
91
+ @allq_tool.add_job
84
92
  job = @instance.job_get(DEFAULT_TUBE)
85
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
93
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
86
94
  expect(job.id).to be_truthy
87
95
  end
88
96
  end
@@ -96,19 +104,19 @@ describe 'ActionsApi' do
96
104
  describe 'mulitple_job_get test' do
97
105
  it "should work" do
98
106
  1.upto(6) do
99
- AllQTools::add_job
107
+ @allq_tool.add_job
100
108
  end
101
109
  multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
102
110
  expect(multiple_jobs.jobs.length).to eq(4)
103
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
111
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(2)
104
112
  multiple_jobs.jobs.each do |job|
105
113
  @instance.job_delete(job.id)
106
114
  end
107
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(0)
115
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(0)
108
116
 
109
117
  multiple_jobs = @instance.multiple_job_get(DEFAULT_TUBE, 4)
110
118
  expect(multiple_jobs.jobs.length).to eq(2)
111
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
119
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
112
120
  end
113
121
  end
114
122
 
@@ -120,8 +128,8 @@ describe 'ActionsApi' do
120
128
  # @return [JobRef]
121
129
  describe 'job_post test' do
122
130
  it "should work" do
123
- AllQTools::add_job
124
- 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)
125
133
  job = @instance.job_get(DEFAULT_TUBE)
126
134
  expect(job.id).to be_truthy
127
135
  end
@@ -144,18 +152,18 @@ describe 'ActionsApi' do
144
152
  run_on_timeout: false,
145
153
  limit: 2)
146
154
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
147
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
148
- 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)
149
157
  @instance.job_post(job)
150
- 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)
151
159
  @instance.job_post(job)
152
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
153
- AllQTools::get_finish(DEFAULT_TUBE)
154
- AllQTools::get_finish(DEFAULT_TUBE)
155
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
156
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
157
- AllQTools::get_finish(DEFAULT_TUBE)
158
- 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)
159
167
  end
160
168
  end
161
169
 
@@ -176,19 +184,19 @@ describe 'ActionsApi' do
176
184
  run_on_timeout: false,
177
185
  limit: 2)
178
186
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
179
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
187
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
180
188
 
181
- 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)
182
190
  @instance.job_post(job)
183
- 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)
184
192
  @instance.job_post(job)
185
- expect(AllQTools::get_ready('foo')).to eq(2)
186
- AllQTools::get_finish('foo')
187
- AllQTools::get_finish('foo')
188
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
189
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
190
- AllQTools::get_finish(DEFAULT_TUBE)
191
- 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)
192
200
  end
193
201
  end
194
202
 
@@ -209,16 +217,16 @@ describe 'ActionsApi' do
209
217
  run_on_timeout: true,
210
218
  limit: 2)
211
219
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
212
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
220
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
213
221
 
214
- 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)
215
223
  @instance.job_post(job)
216
- expect(AllQTools::get_ready('foo')).to eq(1)
217
- 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)
218
226
 
219
227
  sleep(7)
220
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
221
- 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)
222
230
  end
223
231
  end
224
232
 
@@ -231,7 +239,7 @@ describe 'ActionsApi' do
231
239
  # @return [JobResponse]
232
240
  describe 'peek_get test' do
233
241
  it "should work" do
234
- AllQTools::add_job
242
+ @allq_tool.add_job
235
243
  job = @instance.peek_get(DEFAULT_TUBE)
236
244
  expect(job.id).to be_truthy
237
245
  end
@@ -239,7 +247,7 @@ describe 'ActionsApi' do
239
247
 
240
248
  describe 'peek_get buried test' do
241
249
  it "should work" do
242
- AllQTools::add_job
250
+ @allq_tool.add_job
243
251
  job = @instance.peek_get(DEFAULT_TUBE, buried: true)
244
252
  expect(job.id).to be_falsey
245
253
  job = @instance.job_get(DEFAULT_TUBE)
@@ -272,20 +280,20 @@ describe 'ActionsApi' do
272
280
  # @return [BasicResponse]
273
281
  describe 'release_put test' do
274
282
  it "should work" do
275
- AllQTools::add_job
276
- 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)
277
285
  job = @instance.job_get(DEFAULT_TUBE)
278
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
286
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
279
287
  expect(job.id).to be_truthy
280
288
  @instance.release_put(job.id)
281
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
289
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(1)
282
290
  end
283
291
  end
284
292
 
285
293
  describe 'release should increment release' do
286
294
  it "should work" do
287
- AllQTools::add_job
288
- 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)
289
297
  job = @instance.job_get(DEFAULT_TUBE)
290
298
  expect(job.releases).to eq(0)
291
299
  @instance.release_put(job.id)
@@ -317,25 +325,25 @@ describe 'ActionsApi' do
317
325
  run_on_timeout: false,
318
326
  limit: nil)
319
327
  new_parent_job_response = @instance.parent_job_post(new_parent_job)
320
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
321
- 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)
322
330
  @instance.job_post(job)
323
- 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)
324
332
  @instance.job_post(job)
325
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(2)
326
- AllQTools::get_finish(DEFAULT_TUBE)
327
- 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)
328
336
  # After jobs have already finished
329
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(0)
337
+ expect(@allq_tool.get_ready(DEFAULT_TUBE)).to eq(0)
330
338
  # Parent still waiting
331
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(1)
339
+ expect(@allq_tool.get_parents(DEFAULT_TUBE)).to eq(1)
332
340
  # Set limit on parent
333
341
  @instance.set_children_started_put(new_parent_job_response.job_id)
334
342
  # Now parent gets moved to ready
335
- expect(AllQTools::get_ready(DEFAULT_TUBE)).to eq(1)
336
- expect(AllQTools::get_parents(DEFAULT_TUBE)).to eq(0)
337
- AllQTools::get_finish(DEFAULT_TUBE)
338
- 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)
339
347
  end
340
348
  end
341
349
 
@@ -360,10 +368,10 @@ describe 'ActionsApi' do
360
368
  # @return [TubeRef]
361
369
  describe 'throttle_post test' do
362
370
  it "should work" do
363
- AllQTools::add_job
364
- 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)
365
373
  @instance.job_get(DEFAULT_TUBE)
366
- stats_result = AllQTools::get_stats[0]
374
+ stats_result = @allq_tool.get_stats[0]
367
375
  expect(stats_result.action_count > 1).to eq(true)
368
376
  end
369
377
  end
@@ -376,8 +384,8 @@ describe 'ActionsApi' do
376
384
  # @return [BasicResponse]
377
385
  describe 'touch_put test' do
378
386
  it "should work" do
379
- AllQTools::add_job
380
- 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)
381
389
  job = @instance.job_get(DEFAULT_TUBE)
382
390
  @instance.touch_put(job.id)
383
391
  end
@@ -427,31 +435,31 @@ describe 'ActionsApi' do
427
435
  priority: 5,
428
436
  parent_id: nil)
429
437
  @instance.job_post(new_job)
430
- 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
431
439
  reserved_job = @instance.job_get("alt_tube2")
432
440
 
433
441
  # Other tube has 1 ready, 1 reserved
434
- expect(AllQTools::get_ready("alt_tube2")).to eq(1)
435
- 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)
436
444
 
437
445
  # Get 1 into buried, 1 into reserved, and 1 in ready so we can clear it
438
- 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
439
447
  reserved_job = @instance.job_get(alt_tube_name)
440
- 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
441
449
  reserved_job = @instance.job_get(alt_tube_name)
442
- 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
443
451
  @instance.bury_put(reserved_job.id)
444
- expect(AllQTools::get_buried(alt_tube_name)).to eq(1)
452
+ expect(@allq_tool.get_buried(alt_tube_name)).to eq(1)
445
453
 
446
454
  # Now check that first tube is empty
447
455
  @instance.tube_delete(alt_tube_name)
448
- expect(AllQTools::get_buried(alt_tube_name)).to eq(0)
449
- expect(AllQTools::get_reserved(alt_tube_name)).to eq(0) # OK..it's there
450
- 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)
451
459
 
452
460
  # ..and other tubes are fine
453
- expect(AllQTools::get_ready("alt_tube2")).to eq(1)
454
- 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)
455
463
  end
456
464
  end
457
465
 
@@ -466,9 +474,9 @@ describe 'ActionsApi' do
466
474
  priority: 5,
467
475
  parent_id: nil)
468
476
  @instance.job_post(new_job)
469
- 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
470
478
  sleep(4)
471
- 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
472
480
  end
473
481
  end
474
482
 
@@ -485,18 +493,21 @@ describe 'ActionsApi' do
485
493
  @instance.job_post(new_job)
486
494
  sleep(1)
487
495
  @instance.job_get(DEFAULT_TUBE)
488
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(1)
496
+ expect(@allq_tool.get_reserved(DEFAULT_TUBE)).to eq(1)
489
497
  sleep(5)
490
- expect(AllQTools::get_reserved(DEFAULT_TUBE)).to eq(0) # Should expire
491
- 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
492
500
  end
493
501
  end
494
502
 
495
503
  end
496
504
 
497
505
 
498
- module AllQTools
499
- class << self
506
+ class AllQTools
507
+ def initialize(action_client, admin_client)
508
+ @action_client = action_client
509
+ @admin_client = admin_client
510
+ end
500
511
 
501
512
  def new_job(tube = 'default', body = nil, parent_id = nil)
502
513
  body = (0...8).map { (65 + rand(26)).chr }.join unless body
@@ -511,20 +522,20 @@ module AllQTools
511
522
  end
512
523
 
513
524
  def add_job(tube = DEFAULT_TUBE)
514
- client = Allq::ActionsApi.new
525
+ client = @action_client
515
526
  job = new_job(tube)
516
527
  job = client.job_post(new_job)
517
528
  return job
518
529
  end
519
530
 
520
531
  def get_finish(tube)
521
- client = Allq::ActionsApi.new
532
+ client = @action_client
522
533
  job = client.job_get(tube)
523
534
  client.job_delete(job.id)
524
535
  end
525
536
 
526
537
  def get_stats
527
- client = Allq::AdminApi.new
538
+ client = @admin_client
528
539
  client.stats_get
529
540
  end
530
541
 
@@ -571,5 +582,4 @@ module AllQTools
571
582
  end
572
583
  end
573
584
  end
574
- end
575
585
  end
@@ -18,11 +18,11 @@ describe Allq::Configuration do
18
18
  before(:each) do
19
19
  # uncomment below to setup host and base_path
20
20
  #require 'URI'
21
- #uri = URI.parse("http://localhost:8090")
22
- #Allq.configure do |c|
23
- # c.host = uri.host
24
- # c.base_path = uri.path
25
- #end
21
+ uri = URI.parse("http://localhost:8091")
22
+ Allq.configure do |c|
23
+ c.host = uri.host
24
+ c.base_path = uri.path
25
+ end
26
26
  end
27
27
 
28
28
  describe '#base_url' do
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.2
4
+ version: 1.2.6
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: 2020-09-07 00:00:00.000000000 Z
11
+ date: 2021-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -201,6 +201,7 @@ files:
201
201
  - Gemfile.lock
202
202
  - README.md
203
203
  - Rakefile
204
+ - allq_rest-1.2.5.gem
204
205
  - allq_rest.gemspec
205
206
  - deploy.sh
206
207
  - docs/ActionsApi.md
@@ -256,7 +257,8 @@ files:
256
257
  - spec/models/tube_ref_spec.rb
257
258
  - spec/spec_helper.rb
258
259
  homepage: http://www.blitline.com
259
- licenses: []
260
+ licenses:
261
+ - Apache 2.0
260
262
  metadata: {}
261
263
  post_install_message:
262
264
  rdoc_options: []
@@ -273,8 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
275
  - !ruby/object:Gem::Version
274
276
  version: '0'
275
277
  requirements: []
276
- rubyforge_project:
277
- rubygems_version: 2.7.9
278
+ rubygems_version: 3.0.9
278
279
  signing_key:
279
280
  specification_version: 4
280
281
  summary: Ruby REST client for Allq platform