baza.rb 0.12.0 → 0.13.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: 0dcbf3bca568fdb8fa1d73b1755967ada89fca6d3f11b397851e53b22b89c8e2
4
- data.tar.gz: 2f26436cc1c46ffc9ba5dfb8b0daa9dcfb09f9171855d175fa0608973b4ccfcc
3
+ metadata.gz: eb8fe624db9622c507078a1d4018750e3c78343d2a0baa23d19904752293acde
4
+ data.tar.gz: 9da42159fb98666f61abe4cb12db282b3f54b8dd2729584f54b7e91e3152c7e8
5
5
  SHA512:
6
- metadata.gz: 4a0cc6b7d9172902193ba0cb2127131ed60fe8a4488a153678b726effe5e58080301a7921409b3660a47ae6c98dcb03ac10dde30a37e13704cb1f0c51bd2b338
7
- data.tar.gz: f314cdf158f4750f77390d3c7cbff25e31f753b23d0e56fceb22a13790cacbec69d1c6d867915067aa8fe75409e83d35e7b47d833c15134cd954b480435a713d
6
+ metadata.gz: ab3ab9f70d603b9717c0737a1a5c8396cd0e3602969adebc532d0ec806e5bf2e9ea3c92618691c796c41c5acd73db22ed1a653911c431937729c2979e52ccfa2
7
+ data.tar.gz: 1be3726da07593b544b7c4940f82b7ff291547a112cbc6f60292763909d95b7df396f0fe024fefbeef72b321f22c9d5a0611183ad5b55c3308a802d65132cae8
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ gem 'minitest', '~>6.0', require: false
12
12
  gem 'minitest-reporters', '~>1.7', require: false
13
13
  gem 'online', '~>0.1', require: false
14
14
  gem 'os', '~>1.1', require: false
15
+ gem 'pact', '~>1.65', require: false
15
16
  gem 'puma', '~>7.0', require: false
16
17
  gem 'qbash', '~>0.4', require: false
17
18
  gem 'rack', '~>3.1', require: false
data/Gemfile.lock CHANGED
@@ -21,6 +21,7 @@ GEM
21
21
  public_suffix (>= 2.0.2, < 8.0)
22
22
  ansi (1.5.0)
23
23
  ast (2.4.3)
24
+ awesome_print (1.9.2)
24
25
  backtrace (0.4.1)
25
26
  base64 (0.3.0)
26
27
  bigdecimal (4.0.1)
@@ -30,6 +31,7 @@ GEM
30
31
  rexml
31
32
  date (3.5.1)
32
33
  decoor (0.1.0)
34
+ diff-lcs (1.6.2)
33
35
  docile (1.4.1)
34
36
  elapsed (0.2.2)
35
37
  loog (~> 0.6)
@@ -38,6 +40,8 @@ GEM
38
40
  erb (6.0.1)
39
41
  ethon (0.15.0)
40
42
  ffi (>= 1.15.0)
43
+ expgen (0.1.1)
44
+ parslet
41
45
  factbase (0.19.3)
42
46
  backtrace (~> 0.4)
43
47
  decoor (~> 0.1)
@@ -61,13 +65,20 @@ GEM
61
65
  net-http (~> 0.5)
62
66
  faraday-retry (2.4.0)
63
67
  faraday (~> 2.0)
68
+ ffi (1.17.3-aarch64-linux-gnu)
69
+ ffi (1.17.3-aarch64-linux-musl)
70
+ ffi (1.17.3-arm-linux-gnu)
71
+ ffi (1.17.3-arm-linux-musl)
64
72
  ffi (1.17.3-arm64-darwin)
65
- ffi (1.17.3-x64-mingw-ucrt)
66
73
  ffi (1.17.3-x86_64-darwin)
67
74
  ffi (1.17.3-x86_64-linux-gnu)
75
+ ffi (1.17.3-x86_64-linux-musl)
76
+ find_a_port (1.0.1)
68
77
  hashdiff (1.2.1)
69
78
  iri (0.11.7)
70
79
  json (2.18.0)
80
+ jsonpath (1.1.5)
81
+ multi_json
71
82
  language_server-protocol (3.17.0.5)
72
83
  lint_roller (1.1.0)
73
84
  logger (1.7.0)
@@ -81,38 +92,78 @@ GEM
81
92
  builder
82
93
  minitest (>= 5.0)
83
94
  ruby-progressbar
95
+ multi_json (1.19.1)
84
96
  multipart-post (2.4.1)
85
97
  mustermann (3.0.4)
86
98
  ruby2_keywords (~> 0.0.1)
87
99
  net-http (0.9.1)
88
100
  uri (>= 0.11.1)
89
101
  nio4r (2.7.5)
90
- nokogiri (1.19.0-arm64-darwin)
102
+ nokogiri (1.19.0-aarch64-linux-gnu)
103
+ racc (~> 1.4)
104
+ nokogiri (1.19.0-aarch64-linux-musl)
91
105
  racc (~> 1.4)
92
- nokogiri (1.19.0-x64-mingw-ucrt)
106
+ nokogiri (1.19.0-arm-linux-gnu)
107
+ racc (~> 1.4)
108
+ nokogiri (1.19.0-arm-linux-musl)
109
+ racc (~> 1.4)
110
+ nokogiri (1.19.0-arm64-darwin)
93
111
  racc (~> 1.4)
94
112
  nokogiri (1.19.0-x86_64-darwin)
95
113
  racc (~> 1.4)
96
114
  nokogiri (1.19.0-x86_64-linux-gnu)
97
115
  racc (~> 1.4)
116
+ nokogiri (1.19.0-x86_64-linux-musl)
117
+ racc (~> 1.4)
98
118
  online (0.3.0)
99
119
  openssl (>= 3)
100
120
  timeout (~> 0.4)
101
121
  openssl (4.0.0)
102
122
  os (1.1.4)
103
123
  others (0.1.1)
124
+ pact (1.67.3)
125
+ jsonpath (~> 1.0)
126
+ pact-mock_service (~> 3.0, >= 3.3.1)
127
+ pact-support (~> 1.21, >= 1.21.2)
128
+ rack
129
+ rack-proxy
130
+ rack-test (>= 0.6.3, < 3.0.0)
131
+ rainbow (~> 3.1)
132
+ rspec (~> 3.0)
133
+ string_pattern (~> 2.0)
134
+ thor (>= 0.20, < 2.0)
135
+ webrick (~> 1.8)
136
+ zeitwerk (~> 2.3)
137
+ pact-mock_service (3.12.4)
138
+ find_a_port (~> 1.0.1)
139
+ json
140
+ logger (< 2.0)
141
+ pact-support (~> 1.16, >= 1.16.4)
142
+ rack (>= 3.0, < 4.0)
143
+ rackup (~> 2.0)
144
+ rspec (>= 2.14)
145
+ thor (>= 0.19, < 2.0)
146
+ webrick (~> 1.8)
147
+ pact-support (1.21.2)
148
+ awesome_print (~> 1.9)
149
+ diff-lcs (~> 1.5)
150
+ expgen (~> 0.1)
151
+ jsonpath (~> 1.0)
152
+ rainbow (~> 3.1.1)
153
+ string_pattern (~> 2.0)
104
154
  parallel (1.27.0)
105
155
  parser (3.3.10.1)
106
156
  ast (~> 2.4.1)
107
157
  racc
108
- prism (1.8.0)
158
+ parslet (2.0.0)
159
+ prism (1.9.0)
109
160
  psych (5.3.1)
110
161
  date
111
162
  stringio
112
163
  public_suffix (7.0.2)
113
164
  puma (7.2.0)
114
165
  nio4r (~> 2.0)
115
- qbash (0.6.0)
166
+ qbash (0.7.2)
116
167
  backtrace (> 0)
117
168
  elapsed (> 0)
118
169
  loog (> 0)
@@ -123,9 +174,13 @@ GEM
123
174
  base64 (>= 0.1.0)
124
175
  logger (>= 1.6.0)
125
176
  rack (>= 3.0.0, < 4)
177
+ rack-proxy (0.7.7)
178
+ rack
126
179
  rack-session (2.1.1)
127
180
  base64 (>= 0.1.0)
128
181
  rack (>= 3.0.0)
182
+ rack-test (2.2.0)
183
+ rack (>= 1.3)
129
184
  rackup (2.3.1)
130
185
  rack (>= 3)
131
186
  rainbow (3.1.1)
@@ -139,7 +194,20 @@ GEM
139
194
  regexp_parser (2.11.3)
140
195
  retries (0.0.5)
141
196
  rexml (3.4.4)
142
- rubocop (1.82.1)
197
+ rspec (3.13.2)
198
+ rspec-core (~> 3.13.0)
199
+ rspec-expectations (~> 3.13.0)
200
+ rspec-mocks (~> 3.13.0)
201
+ rspec-core (3.13.6)
202
+ rspec-support (~> 3.13.0)
203
+ rspec-expectations (3.13.5)
204
+ diff-lcs (>= 1.2.0, < 2.0)
205
+ rspec-support (~> 3.13.0)
206
+ rspec-mocks (3.13.7)
207
+ diff-lcs (>= 1.2.0, < 2.0)
208
+ rspec-support (~> 3.13.0)
209
+ rspec-support (3.13.7)
210
+ rubocop (1.84.0)
143
211
  json (~> 2.3)
144
212
  language_server-protocol (~> 3.17.0.2)
145
213
  lint_roller (~> 1.1.0)
@@ -147,7 +215,7 @@ GEM
147
215
  parser (>= 3.3.0.2)
148
216
  rainbow (>= 2.2.2, < 4.0)
149
217
  regexp_parser (>= 2.9.3, < 3.0)
150
- rubocop-ast (>= 1.48.0, < 2.0)
218
+ rubocop-ast (>= 1.49.0, < 2.0)
151
219
  ruby-progressbar (~> 1.7)
152
220
  unicode-display_width (>= 2.4.0, < 4.0)
153
221
  rubocop-ast (1.49.0)
@@ -182,8 +250,11 @@ GEM
182
250
  rack-protection (= 4.2.1)
183
251
  rack-session (>= 2.0.0, < 3)
184
252
  tilt (~> 2.0)
253
+ string_pattern (2.3.0)
254
+ regexp_parser (~> 2.5, >= 2.5.0)
185
255
  stringio (3.2.0)
186
- tago (0.6.0)
256
+ tago (0.7.0)
257
+ thor (1.5.0)
187
258
  tilt (2.7.0)
188
259
  timeout (0.6.0)
189
260
  tsort (0.2.0)
@@ -201,15 +272,17 @@ GEM
201
272
  webrick (1.9.2)
202
273
  yaml (0.4.0)
203
274
  yard (0.9.38)
275
+ zeitwerk (2.7.4)
204
276
 
205
277
  PLATFORMS
206
- arm64-darwin-22
207
- arm64-darwin-23
208
- arm64-darwin-24
209
- x64-mingw-ucrt
210
- x86_64-darwin-20
211
- x86_64-darwin-21
212
- x86_64-linux
278
+ aarch64-linux-gnu
279
+ aarch64-linux-musl
280
+ arm-linux-gnu
281
+ arm-linux-musl
282
+ arm64-darwin
283
+ x86_64-darwin
284
+ x86_64-linux-gnu
285
+ x86_64-linux-musl
213
286
 
214
287
  DEPENDENCIES
215
288
  base64 (~> 0.3)
@@ -219,6 +292,7 @@ DEPENDENCIES
219
292
  minitest-reporters (~> 1.7)
220
293
  online (~> 0.1)
221
294
  os (~> 1.1)
295
+ pact (~> 1.65)
222
296
  puma (~> 7.0)
223
297
  qbash (~> 0.4)
224
298
  rack (~> 3.1)
@@ -239,4 +313,4 @@ DEPENDENCIES
239
313
  yard (~> 0.9)
240
314
 
241
315
  BUNDLED WITH
242
- 2.5.16
316
+ 2.6.8
data/REUSE.toml CHANGED
@@ -6,7 +6,6 @@ version = 1
6
6
  path = [
7
7
  ".DS_Store",
8
8
  ".gitattributes",
9
- ".gitignore",
10
9
  ".pdd",
11
10
  "**.json",
12
11
  "**.md",
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ task :picks do
38
38
  Dir['lib/**/*.rb'].each do |f|
39
39
  qbash(
40
40
  "bundle exec ruby #{Shellwords.escape(f)} -- --offline",
41
- log: $stdout, env: { 'RACK_ENV' => 'picks' }
41
+ stdout: $stdout, env: { 'RACK_ENV' => 'picks' }
42
42
  )
43
43
  end
44
44
  end
@@ -0,0 +1,794 @@
1
+ {
2
+ "consumer": {
3
+ "name": "BazaRb"
4
+ },
5
+ "provider": {
6
+ "name": "Zerocracy"
7
+ },
8
+ "interactions": [
9
+ {
10
+ "description": "a pull request",
11
+ "providerState": "job #42 exists",
12
+ "request": {
13
+ "method": "get",
14
+ "path": "/pull/42.fb",
15
+ "matchingRules": {
16
+ "$.path": {
17
+ "match": "regex",
18
+ "regex": "^\\/pull\\/[1-9][0-9]*\\.fb$"
19
+ }
20
+ }
21
+ },
22
+ "response": {
23
+ "status": 200,
24
+ "headers": {}
25
+ }
26
+ },
27
+ {
28
+ "description": "a request for CSRF token",
29
+ "request": {
30
+ "method": "get",
31
+ "path": "/csrf"
32
+ },
33
+ "response": {
34
+ "status": 200,
35
+ "headers": {},
36
+ "body": "csrf-token-example",
37
+ "matchingRules": {
38
+ "$.body": {
39
+ "match": "regex",
40
+ "regex": "^.+$"
41
+ }
42
+ }
43
+ }
44
+ },
45
+ {
46
+ "description": "a durable lock request",
47
+ "providerState": "durable #42 exists",
48
+ "request": {
49
+ "method": "post",
50
+ "path": "/durables/42/lock",
51
+ "headers": {
52
+ "Content-Type": "application/x-www-form-urlencoded"
53
+ },
54
+ "body": "_csrf=csrf-token-example&owner=the-owner",
55
+ "matchingRules": {
56
+ "$.path": {
57
+ "match": "regex",
58
+ "regex": "^\\/durables\\/[1-9][0-9]*\\/lock$"
59
+ },
60
+ "$.body._csrf": {
61
+ "match": "regex",
62
+ "regex": "^.+$"
63
+ },
64
+ "$.body.owner": {
65
+ "match": "regex",
66
+ "regex": "^.+$"
67
+ }
68
+ }
69
+ },
70
+ "response": {
71
+ "status": 302,
72
+ "headers": {}
73
+ }
74
+ },
75
+ {
76
+ "description": "a stdout request",
77
+ "providerState": "job #42 exists",
78
+ "request": {
79
+ "method": "get",
80
+ "path": "/stdout/42.txt",
81
+ "matchingRules": {
82
+ "$.path": {
83
+ "match": "regex",
84
+ "regex": "^\\/stdout\\/[1-9][0-9]*\\.txt$"
85
+ }
86
+ }
87
+ },
88
+ "response": {
89
+ "status": 200,
90
+ "headers": {
91
+ "Content-Type": "text/plain"
92
+ },
93
+ "body": "hello, друг!"
94
+ }
95
+ },
96
+ {
97
+ "description": "a lock request that fails",
98
+ "providerState": "product \"foo\" is locked",
99
+ "request": {
100
+ "method": "post",
101
+ "path": "/lock/foo",
102
+ "headers": {
103
+ "Content-Type": "application/x-www-form-urlencoded"
104
+ },
105
+ "body": "_csrf=csrf-token-example&owner=the-owner",
106
+ "matchingRules": {
107
+ "$.path": {
108
+ "match": "regex",
109
+ "regex": "^\\/lock\\/[a-z0-9]+$"
110
+ },
111
+ "$.body._csrf": {
112
+ "match": "regex",
113
+ "regex": "^.+$"
114
+ },
115
+ "$.body.owner": {
116
+ "match": "regex",
117
+ "regex": "^.+$"
118
+ }
119
+ }
120
+ },
121
+ "response": {
122
+ "status": 409,
123
+ "headers": {}
124
+ }
125
+ },
126
+ {
127
+ "description": "a lock request",
128
+ "providerState": "product \"foo\" exists",
129
+ "request": {
130
+ "method": "post",
131
+ "path": "/lock/foo",
132
+ "headers": {
133
+ "Content-Type": "application/x-www-form-urlencoded"
134
+ },
135
+ "body": "_csrf=csrf-token-example&owner=the-owner",
136
+ "matchingRules": {
137
+ "$.path": {
138
+ "match": "regex",
139
+ "regex": "^\\/lock\\/[a-z0-9]+$"
140
+ },
141
+ "$.body._csrf": {
142
+ "match": "regex",
143
+ "regex": "^.+$"
144
+ },
145
+ "$.body.owner": {
146
+ "match": "regex",
147
+ "regex": "^.+$"
148
+ }
149
+ }
150
+ },
151
+ "response": {
152
+ "status": 302,
153
+ "headers": {}
154
+ }
155
+ },
156
+ {
157
+ "description": "an exit code request",
158
+ "providerState": "job #42 exists",
159
+ "request": {
160
+ "method": "get",
161
+ "path": "/exit/42.txt",
162
+ "matchingRules": {
163
+ "$.path": {
164
+ "match": "regex",
165
+ "regex": "^\\/exit\\/[1-9][0-9]*\\.txt$"
166
+ }
167
+ }
168
+ },
169
+ "response": {
170
+ "status": 200,
171
+ "headers": {
172
+ "Content-Type": "text/plain"
173
+ },
174
+ "body": "0"
175
+ }
176
+ },
177
+ {
178
+ "description": "a durable load request for empty content",
179
+ "providerState": "durable is empty",
180
+ "request": {
181
+ "method": "get",
182
+ "path": "/durables/42",
183
+ "matchingRules": {
184
+ "$.path": {
185
+ "match": "regex",
186
+ "regex": "^\\/durables\\/[1-9][0-9]*$"
187
+ }
188
+ }
189
+ },
190
+ "response": {
191
+ "status": 206,
192
+ "headers": {
193
+ "Content-Range": "bytes 0-0/0"
194
+ },
195
+ "body": ""
196
+ }
197
+ },
198
+ {
199
+ "description": "a durable unlock request",
200
+ "providerState": "durable #42 is locked",
201
+ "request": {
202
+ "method": "post",
203
+ "path": "/durables/42/unlock",
204
+ "headers": {
205
+ "Content-Type": "application/x-www-form-urlencoded"
206
+ },
207
+ "body": "_csrf=csrf-token-example&owner=the-owner",
208
+ "matchingRules": {
209
+ "$.path": {
210
+ "match": "regex",
211
+ "regex": "^\\/durables\\/[1-9][0-9]*\\/unlock$"
212
+ },
213
+ "$.body._csrf": {
214
+ "match": "regex",
215
+ "regex": "^.+$"
216
+ },
217
+ "$.body.owner": {
218
+ "match": "regex",
219
+ "regex": "^.+$"
220
+ }
221
+ }
222
+ },
223
+ "response": {
224
+ "status": 302,
225
+ "headers": {}
226
+ }
227
+ },
228
+ {
229
+ "description": "a finished check request",
230
+ "providerState": "job #42 exists",
231
+ "request": {
232
+ "method": "get",
233
+ "path": "/finished/42",
234
+ "matchingRules": {
235
+ "$.path": {
236
+ "match": "regex",
237
+ "regex": "^\\/finished\\/[1-9][0-9]*$"
238
+ }
239
+ }
240
+ },
241
+ "response": {
242
+ "status": 200,
243
+ "headers": {
244
+ "Content-Type": "text/plain"
245
+ },
246
+ "body": "yes",
247
+ "matchingRules": {
248
+ "$.body": {
249
+ "match": "regex",
250
+ "regex": "^yes|no$"
251
+ }
252
+ }
253
+ }
254
+ },
255
+ {
256
+ "description": "an enter request with cached result",
257
+ "providerState": "result for the \"bar\" badge for job #42 and \"foo\" product exists as \"before\"",
258
+ "request": {
259
+ "method": "get",
260
+ "path": "/result",
261
+ "query": "badge=bar",
262
+ "matchingRules": {
263
+ "$.query.badge[0]": {
264
+ "match": "regex",
265
+ "regex": "^[a-z0-9.]+$"
266
+ }
267
+ }
268
+ },
269
+ "response": {
270
+ "status": 200,
271
+ "headers": {
272
+ "Content-Type": "text/plain"
273
+ },
274
+ "body": "before",
275
+ "matchingRules": {
276
+ "$.body": {
277
+ "match": "regex",
278
+ "regex": "^.+$"
279
+ }
280
+ }
281
+ }
282
+ },
283
+ {
284
+ "description": "a durable find request that returns not found",
285
+ "providerState": "durable \"bar.txt\" does not exist for the \"foo\" product",
286
+ "request": {
287
+ "method": "get",
288
+ "path": "/durable-find",
289
+ "query": "file=bar.txt&pname=foo",
290
+ "matchingRules": {
291
+ "$.query.file[0]": {
292
+ "match": "regex",
293
+ "regex": "[a-z0-9.]+"
294
+ },
295
+ "$.query.pname[0]": {
296
+ "match": "regex",
297
+ "regex": "^[a-z0-9]+$"
298
+ }
299
+ }
300
+ },
301
+ "response": {
302
+ "status": 404,
303
+ "headers": {}
304
+ }
305
+ },
306
+ {
307
+ "description": "a push request",
308
+ "providerState": "product \"foo\" exists",
309
+ "request": {
310
+ "method": "put",
311
+ "path": "/push/foo",
312
+ "matchingRules": {
313
+ "$.path": {
314
+ "match": "regex",
315
+ "regex": "\\/push\\/[a-z0-9]+"
316
+ }
317
+ }
318
+ },
319
+ "response": {
320
+ "status": 200,
321
+ "headers": {},
322
+ "body": "42",
323
+ "matchingRules": {
324
+ "$.body": {
325
+ "match": "regex",
326
+ "regex": "^[1-9][0-9]*$"
327
+ }
328
+ }
329
+ }
330
+ },
331
+ {
332
+ "description": "an enter request without cached result",
333
+ "providerState": "result for the \"bar\" badge for \"foo\" product not exists",
334
+ "request": {
335
+ "method": "get",
336
+ "path": "/result",
337
+ "query": "badge=bar",
338
+ "matchingRules": {
339
+ "$.query.badge[0]": {
340
+ "match": "regex",
341
+ "regex": "^[a-z0-9.]+$"
342
+ }
343
+ }
344
+ },
345
+ "response": {
346
+ "status": 204,
347
+ "headers": {
348
+ "Content-Type": "text/plain"
349
+ },
350
+ "body": ""
351
+ }
352
+ },
353
+ {
354
+ "description": "a valve creation request",
355
+ "providerState": "job #42 exists for the \"foo\" product and valve \"bar\" not exists",
356
+ "request": {
357
+ "method": "post",
358
+ "path": "/valves",
359
+ "query": "job=42",
360
+ "headers": {
361
+ "Content-Type": "application/x-www-form-urlencoded"
362
+ },
363
+ "body": "_csrf=csrf-token-example&badge=bar&pname=foo&result=after&why=no+reason",
364
+ "matchingRules": {
365
+ "$.query.job[0]": {
366
+ "match": "regex",
367
+ "regex": "^[0-9]+$"
368
+ },
369
+ "$.body._csrf": {
370
+ "match": "regex",
371
+ "regex": "^.+$"
372
+ },
373
+ "$.body.badge": {
374
+ "match": "regex",
375
+ "regex": "^[a-z0-9.-]+$"
376
+ },
377
+ "$.body.pname": {
378
+ "match": "regex",
379
+ "regex": "^[a-z0-9]+$"
380
+ },
381
+ "$.body.result": {
382
+ "match": "regex",
383
+ "regex": "^.+$"
384
+ },
385
+ "$.body.why": {
386
+ "match": "regex",
387
+ "regex": "^.+$"
388
+ }
389
+ }
390
+ },
391
+ "response": {
392
+ "status": 302,
393
+ "headers": {}
394
+ }
395
+ },
396
+ {
397
+ "description": "a fee payment request",
398
+ "providerState": "user is logged in",
399
+ "request": {
400
+ "method": "post",
401
+ "path": "/account/fee",
402
+ "headers": {
403
+ "Content-Type": "application/x-www-form-urlencoded"
404
+ },
405
+ "body": "_csrf=csrf-token-example&amount=42.77&job=42&summary=the+summary&tab=unknown",
406
+ "matchingRules": {
407
+ "$.body._csrf": {
408
+ "match": "regex",
409
+ "regex": "^.+$"
410
+ },
411
+ "$.body.amount": {
412
+ "match": "regex",
413
+ "regex": "^[0-9]+\\.[0-9]+$"
414
+ },
415
+ "$.body.job": {
416
+ "match": "regex",
417
+ "regex": "^[0-9]+$"
418
+ },
419
+ "$.body.summary": {
420
+ "match": "regex",
421
+ "regex": "^.+$"
422
+ },
423
+ "$.body.tab": {
424
+ "match": "regex",
425
+ "regex": "^[a-z]+$"
426
+ }
427
+ }
428
+ },
429
+ "response": {
430
+ "status": 302,
431
+ "headers": {
432
+ "X-Zerocracy-ReceiptId": "42"
433
+ },
434
+ "matchingRules": {
435
+ "$.headers.X-Zerocracy-ReceiptId": {
436
+ "match": "regex",
437
+ "regex": "^[1-9][0-9]*$"
438
+ }
439
+ }
440
+ }
441
+ },
442
+ {
443
+ "description": "a verification verdict request",
444
+ "providerState": "job 42 exists",
445
+ "request": {
446
+ "method": "get",
447
+ "path": "/jobs/42/verified.txt",
448
+ "matchingRules": {
449
+ "$.path": {
450
+ "match": "regex",
451
+ "regex": "^\\/jobs\\/[1-9][0-9]*\\/verified\\.txt$"
452
+ }
453
+ }
454
+ },
455
+ "response": {
456
+ "status": 200,
457
+ "headers": {
458
+ "Content-Type": "text/plain"
459
+ },
460
+ "body": "done"
461
+ }
462
+ },
463
+ {
464
+ "description": "a whoami request",
465
+ "providerState": "user is logged in",
466
+ "request": {
467
+ "method": "get",
468
+ "path": "/whoami"
469
+ },
470
+ "response": {
471
+ "status": 200,
472
+ "headers": {
473
+ "Content-Type": "text/plain"
474
+ },
475
+ "body": "jeff",
476
+ "matchingRules": {
477
+ "$.body": {
478
+ "match": "regex",
479
+ "regex": "^[a-z0-9-]+$"
480
+ }
481
+ }
482
+ }
483
+ },
484
+ {
485
+ "description": "a durable find request",
486
+ "providerState": "durable \"bar.txt\" exists for the \"foo\" product",
487
+ "request": {
488
+ "method": "get",
489
+ "path": "/durable-find",
490
+ "query": "file=bar.txt&pname=foo",
491
+ "matchingRules": {
492
+ "$.query.file[0]": {
493
+ "match": "regex",
494
+ "regex": "[a-z0-9.]+"
495
+ },
496
+ "$.query.pname[0]": {
497
+ "match": "regex",
498
+ "regex": "^[a-z0-9]+$"
499
+ }
500
+ }
501
+ },
502
+ "response": {
503
+ "status": 200,
504
+ "headers": {},
505
+ "body": "42",
506
+ "matchingRules": {
507
+ "$.body": {
508
+ "match": "regex",
509
+ "regex": "^[1-9][0-9]*$"
510
+ }
511
+ }
512
+ }
513
+ },
514
+ {
515
+ "description": "a durable save request",
516
+ "providerState": "durable #42 exists",
517
+ "request": {
518
+ "method": "put",
519
+ "path": "/durables/42",
520
+ "matchingRules": {
521
+ "$.path": {
522
+ "match": "regex",
523
+ "regex": "^\\/durables\\/[1-9][0-9]*$"
524
+ }
525
+ }
526
+ },
527
+ "response": {
528
+ "status": 200,
529
+ "headers": {},
530
+ "body": ""
531
+ }
532
+ },
533
+ {
534
+ "description": "a recent job check",
535
+ "providerState": "job #42 exists",
536
+ "request": {
537
+ "method": "get",
538
+ "path": "/recent/foo.txt",
539
+ "matchingRules": {
540
+ "$.path": {
541
+ "match": "regex",
542
+ "regex": "\\/recent\\/[a-z0-9]+\\.txt"
543
+ }
544
+ }
545
+ },
546
+ "response": {
547
+ "status": 200,
548
+ "headers": {
549
+ "Content-Type": "text/plain"
550
+ },
551
+ "body": "42",
552
+ "matchingRules": {
553
+ "$.body": {
554
+ "match": "regex",
555
+ "regex": "^[1-9][0-9]*$"
556
+ }
557
+ }
558
+ }
559
+ },
560
+ {
561
+ "description": "a balance request",
562
+ "providerState": "user is logged in",
563
+ "request": {
564
+ "method": "get",
565
+ "path": "/account/balance"
566
+ },
567
+ "response": {
568
+ "status": 200,
569
+ "headers": {
570
+ "Content-Type": "text/plain"
571
+ },
572
+ "body": "42.33",
573
+ "matchingRules": {
574
+ "$.body": {
575
+ "match": "regex",
576
+ "regex": "^[0-9]+\\.[0-9]+$"
577
+ }
578
+ }
579
+ }
580
+ },
581
+ {
582
+ "description": "a transfer payment request",
583
+ "providerState": "user is logged in",
584
+ "request": {
585
+ "method": "post",
586
+ "path": "/account/transfer",
587
+ "headers": {
588
+ "Content-Type": "application/x-www-form-urlencoded"
589
+ },
590
+ "body": "_csrf=csrf-token-example&human=jeff&amount=42.50&summary=for+fun",
591
+ "matchingRules": {
592
+ "$.body._csrf": {
593
+ "match": "regex",
594
+ "regex": "^.+$"
595
+ },
596
+ "$.body.human": {
597
+ "match": "regex",
598
+ "regex": "^[a-z0-9-]+$"
599
+ },
600
+ "$.body.amount": {
601
+ "match": "regex",
602
+ "regex": "^[0-9]+\\.[0-9]+$"
603
+ },
604
+ "$.body.summary": {
605
+ "match": "regex",
606
+ "regex": "^.+$"
607
+ }
608
+ }
609
+ },
610
+ "response": {
611
+ "status": 302,
612
+ "headers": {
613
+ "X-Zerocracy-ReceiptId": "42"
614
+ },
615
+ "matchingRules": {
616
+ "$.headers.X-Zerocracy-ReceiptId": {
617
+ "match": "regex",
618
+ "regex": "^[1-9][0-9]*$"
619
+ }
620
+ }
621
+ }
622
+ },
623
+ {
624
+ "description": "an exists check",
625
+ "providerState": "product \"foo\" exists",
626
+ "request": {
627
+ "method": "get",
628
+ "path": "/exists/foo",
629
+ "matchingRules": {
630
+ "$.path": {
631
+ "match": "regex",
632
+ "regex": "^\\/exists\\/[a-z0-9]+$"
633
+ }
634
+ }
635
+ },
636
+ "response": {
637
+ "status": 200,
638
+ "headers": {
639
+ "Content-Type": "text/plain"
640
+ },
641
+ "body": "yes"
642
+ }
643
+ },
644
+ {
645
+ "description": "a pop request with no job",
646
+ "providerState": "queue is empty",
647
+ "request": {
648
+ "method": "get",
649
+ "path": "/pop",
650
+ "query": "owner=me",
651
+ "matchingRules": {
652
+ "$.query.owner[0]": {
653
+ "match": "regex",
654
+ "regex": "^.+$"
655
+ }
656
+ }
657
+ },
658
+ "response": {
659
+ "status": 204,
660
+ "headers": {}
661
+ }
662
+ },
663
+ {
664
+ "description": "an unlock request",
665
+ "providerState": "job exists",
666
+ "request": {
667
+ "method": "post",
668
+ "path": "/unlock/foo",
669
+ "headers": {
670
+ "Content-Type": "application/x-www-form-urlencoded"
671
+ },
672
+ "body": "_csrf=csrf-token-example&owner=the-owner",
673
+ "matchingRules": {
674
+ "$.path": {
675
+ "match": "regex",
676
+ "regex": "^\\/unlock\\/.+$"
677
+ },
678
+ "$.body._csrf": {
679
+ "match": "regex",
680
+ "regex": "^.+$"
681
+ },
682
+ "$.body.owner": {
683
+ "match": "regex",
684
+ "regex": "^.+$"
685
+ }
686
+ }
687
+ },
688
+ "response": {
689
+ "status": 302,
690
+ "headers": {}
691
+ }
692
+ },
693
+ {
694
+ "description": "a transfer payment request with job",
695
+ "providerState": "user is logged in",
696
+ "request": {
697
+ "method": "post",
698
+ "path": "/account/transfer",
699
+ "headers": {
700
+ "Content-Type": "application/x-www-form-urlencoded"
701
+ },
702
+ "body": "_csrf=csrf-token-example&job=555&human=jeff&amount=42.50&summary=for+fun",
703
+ "matchingRules": {
704
+ "$.body._csrf": {
705
+ "match": "regex",
706
+ "regex": "^.+$"
707
+ },
708
+ "$.body.job": {
709
+ "match": "regex",
710
+ "regex": "^[0-9]+$"
711
+ },
712
+ "$.body.human": {
713
+ "match": "regex",
714
+ "regex": "^[a-z0-9-]+$"
715
+ },
716
+ "$.body.amount": {
717
+ "match": "regex",
718
+ "regex": "^[0-9]+\\.[0-9]+$"
719
+ },
720
+ "$.body.summary": {
721
+ "match": "regex",
722
+ "regex": "^.+$"
723
+ }
724
+ }
725
+ },
726
+ "response": {
727
+ "status": 302,
728
+ "headers": {
729
+ "X-Zerocracy-ReceiptId": "42"
730
+ },
731
+ "matchingRules": {
732
+ "$.headers.X-Zerocracy-ReceiptId": {
733
+ "match": "regex",
734
+ "regex": "^[1-9][0-9]*$"
735
+ }
736
+ }
737
+ }
738
+ },
739
+ {
740
+ "description": "a durable load request",
741
+ "providerState": "durable #42 exists",
742
+ "request": {
743
+ "method": "get",
744
+ "path": "/durables/42",
745
+ "matchingRules": {
746
+ "$.path": {
747
+ "match": "regex",
748
+ "regex": "^\\/durables\\/[1-9][0-9]*$"
749
+ }
750
+ }
751
+ },
752
+ "response": {
753
+ "status": 200,
754
+ "headers": {},
755
+ "body": "some data",
756
+ "matchingRules": {
757
+ "$.body": {
758
+ "match": "regex",
759
+ "regex": "^.+$"
760
+ }
761
+ }
762
+ }
763
+ },
764
+ {
765
+ "description": "a finish request",
766
+ "providerState": "job #42 exists",
767
+ "request": {
768
+ "method": "put",
769
+ "path": "/finish",
770
+ "query": "id=42",
771
+ "matchingRules": {
772
+ "$.query.id[0]": {
773
+ "match": "regex",
774
+ "regex": "^[1-9][0-9]*$"
775
+ }
776
+ }
777
+ },
778
+ "response": {
779
+ "status": 200,
780
+ "headers": {}
781
+ }
782
+ }
783
+ ],
784
+ "metadata": {
785
+ "pactSpecification": {
786
+ "version": "2.0.0"
787
+ },
788
+ "client": {
789
+ "name": "BazaRb",
790
+ "version": "0.0.0",
791
+ "date": "2026-02-02T13:19:40Z"
792
+ }
793
+ }
794
+ }
data/lib/baza-rb/fake.rb CHANGED
@@ -125,22 +125,22 @@ class BazaRb::Fake
125
125
 
126
126
  # Find a single durable.
127
127
  #
128
- # @param [String] jname The name of the job on the server
128
+ # @param [String] pname The name of the job on the server
129
129
  # @param [String] file The path to the file to upload
130
130
  # @return [Integer] Always returns 42 as the fake durable ID
131
- def durable_find(jname, file)
132
- assert_name(jname)
131
+ def durable_find(pname, file)
132
+ assert_name(pname)
133
133
  assert_file(file)
134
134
  42
135
135
  end
136
136
 
137
137
  # Place a single durable file on the server.
138
138
  #
139
- # @param [String] jname The name of the job on the server
139
+ # @param [String] pname The name of the job on the server
140
140
  # @param [String] file The path to the file to upload
141
141
  # @return [Integer] Always returns 42 as the fake durable ID
142
- def durable_place(jname, file)
143
- assert_name(jname)
142
+ def durable_place(pname, file)
143
+ assert_name(pname)
144
144
  assert_file(file)
145
145
  42
146
146
  end
@@ -13,5 +13,5 @@
13
13
  # Copyright:: Copyright (c) 2024-2026 Yegor Bugayenko
14
14
  # License:: MIT
15
15
  class BazaRb
16
- VERSION = '0.12.0'
16
+ VERSION = '0.13.0'
17
17
  end
data/lib/baza-rb.rb CHANGED
@@ -314,7 +314,6 @@ class BazaRb
314
314
  home.append('durable-place'),
315
315
  {
316
316
  'pname' => pname,
317
- 'jname' => pname,
318
317
  'file' => File.basename(file),
319
318
  'zip' => File.open(file, 'rb')
320
319
  }
@@ -411,7 +410,7 @@ class BazaRb
411
410
  raise 'The "file" may not be empty' if file.empty?
412
411
  id = nil
413
412
  elapsed(@loog, level: Logger::INFO) do
414
- ret = get(home.append('durable-find').add(jname: pname, pname:, file:), [200, 404])
413
+ ret = get(home.append('durable-find').add(file:, pname:), [200, 404])
415
414
  if ret.code == 200
416
415
  id = ret.body.to_i
417
416
  throw :"Found durable ##{id} for job \"#{pname}\" file \"#{file}\" at #{@host}"
@@ -473,10 +472,10 @@ class BazaRb
473
472
  ret = post(
474
473
  home.append('account').append('fee'),
475
474
  {
476
- 'tab' => tab,
477
475
  'amount' => format('%0.6f', amount),
476
+ 'job' => job.to_s,
478
477
  'summary' => summary,
479
- 'job' => job.to_s
478
+ 'tab' => tab
480
479
  }
481
480
  )
482
481
  id = ret.headers['X-Zerocracy-ReceiptId'].to_i
@@ -550,11 +549,10 @@ class BazaRb
550
549
  post(
551
550
  uri,
552
551
  {
553
- 'name' => pname,
554
- 'pname' => pname,
555
552
  'badge' => badge,
556
- 'why' => why,
557
- 'result' => r.to_s
553
+ 'pname' => pname,
554
+ 'result' => r.to_s,
555
+ 'why' => why
558
556
  }
559
557
  )
560
558
  r
@@ -708,7 +706,7 @@ class BazaRb
708
706
  if ret.code >= 500 && attempt < @retries
709
707
  attempt += 1
710
708
  seconds = @pause * (2**attempt)
711
- @loog.info("Server seems to be in trouble, will sleep for #{seconds} (attempt no.#{attempt})...")
709
+ @loog.info("Server seems to be in trouble (#{ret.code}), sleep #{seconds}s (attempt no.#{attempt})...")
712
710
  sleep(seconds)
713
711
  next
714
712
  end
@@ -806,7 +804,7 @@ class BazaRb
806
804
  retry_if_server_failed do
807
805
  Typhoeus::Request.post(
808
806
  uri.to_s,
809
- body: params.merge('_csrf' => csrf),
807
+ body: params.merge('_csrf' => csrf).sort.to_h,
810
808
  headers:,
811
809
  connecttimeout: @timeout,
812
810
  timeout: @timeout
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -181,6 +181,7 @@ files:
181
181
  - REUSE.toml
182
182
  - Rakefile
183
183
  - baza.rb.gemspec
184
+ - bazarb-zerocracy.json
184
185
  - lib/baza-rb.rb
185
186
  - lib/baza-rb/fake.rb
186
187
  - lib/baza-rb/version.rb