crowdin-api 1.14.0 → 1.15.1
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 +4 -4
- data/.github/workflows/docs.yml +1 -0
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +1 -0
- data/AGENTS.md +63 -0
- data/CLAUDE.md +1 -0
- data/Gemfile.lock +7 -7
- data/README.md +1 -1
- data/crowdin-api.gemspec +1 -1
- data/lib/crowdin-api/api_resources/advisor.rb +86 -0
- data/lib/crowdin-api/api_resources/ai.rb +974 -0
- data/lib/crowdin-api/api_resources/applications.rb +247 -10
- data/lib/crowdin-api/api_resources/bundles.rb +45 -29
- data/lib/crowdin-api/api_resources/clients.rb +23 -0
- data/lib/crowdin-api/api_resources/custom_spellcheckers.rb +36 -0
- data/lib/crowdin-api/api_resources/dictionaries.rb +5 -5
- data/lib/crowdin-api/api_resources/distributions.rb +15 -15
- data/lib/crowdin-api/api_resources/external_qa_checks.rb +36 -0
- data/lib/crowdin-api/api_resources/fields.rb +78 -0
- data/lib/crowdin-api/api_resources/glossaries.rb +62 -50
- data/lib/crowdin-api/api_resources/integrations.rb +201 -0
- data/lib/crowdin-api/api_resources/labels.rb +32 -0
- data/lib/crowdin-api/api_resources/languages.rb +16 -0
- data/lib/crowdin-api/api_resources/machine_translation_engines.rb +17 -0
- data/lib/crowdin-api/api_resources/notifications.rb +15 -6
- data/lib/crowdin-api/api_resources/organization.rb +33 -0
- data/lib/crowdin-api/api_resources/organization_webhooks.rb +71 -0
- data/lib/crowdin-api/api_resources/placeholders.rb +182 -0
- data/lib/crowdin-api/api_resources/projects.rb +137 -41
- data/lib/crowdin-api/api_resources/reports.rb +310 -26
- data/lib/crowdin-api/api_resources/screenshots.rb +48 -0
- data/lib/crowdin-api/api_resources/security_logs.rb +63 -0
- data/lib/crowdin-api/api_resources/source_files.rb +370 -65
- data/lib/crowdin-api/api_resources/source_strings.rb +62 -0
- data/lib/crowdin-api/api_resources/storages.rb +11 -11
- data/lib/crowdin-api/api_resources/string_comments.rb +46 -0
- data/lib/crowdin-api/api_resources/string_corrections.rb +21 -6
- data/lib/crowdin-api/api_resources/string_translations.rb +96 -0
- data/lib/crowdin-api/api_resources/style_guides.rb +71 -0
- data/lib/crowdin-api/api_resources/tasks.rb +140 -10
- data/lib/crowdin-api/api_resources/teams.rb +99 -0
- data/lib/crowdin-api/api_resources/translation_memory.rb +138 -0
- data/lib/crowdin-api/api_resources/translation_status.rb +65 -0
- data/lib/crowdin-api/api_resources/translations.rb +122 -2
- data/lib/crowdin-api/api_resources/users.rb +136 -6
- data/lib/crowdin-api/api_resources/vendors.rb +2 -0
- data/lib/crowdin-api/api_resources/webhooks.rb +16 -0
- data/lib/crowdin-api/api_resources/workflows.rb +24 -0
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/request.rb +1 -1
- data/lib/crowdin-api.rb +3 -1
- data/spec/api_resources/advisor_spec.rb +45 -0
- data/spec/api_resources/ai_spec.rb +863 -0
- data/spec/api_resources/applications_spec.rb +138 -0
- data/spec/api_resources/bundles_spec.rb +8 -0
- data/spec/api_resources/clients_spec.rb +13 -0
- data/spec/api_resources/custom_spellcheckers_spec.rb +21 -0
- data/spec/api_resources/external_qa_checks_spec.rb +21 -0
- data/spec/api_resources/fields_spec.rb +45 -0
- data/spec/api_resources/glossaries_spec.rb +18 -0
- data/spec/api_resources/integrations_spec.rb +117 -0
- data/spec/api_resources/organization_spec.rb +21 -0
- data/spec/api_resources/organization_webhooks_spec.rb +45 -0
- data/spec/api_resources/placeholders_spec.rb +103 -0
- data/spec/api_resources/projects_spec.rb +58 -0
- data/spec/api_resources/reports_spec.rb +221 -0
- data/spec/api_resources/security_logs_spec.rb +39 -0
- data/spec/api_resources/source_files_spec.rb +182 -0
- data/spec/api_resources/source_strings_spec.rb +26 -0
- data/spec/api_resources/string_comments_spec.rb +18 -0
- data/spec/api_resources/string_corrections_spec.rb +25 -19
- data/spec/api_resources/string_translations_spec.rb +26 -0
- data/spec/api_resources/style_guides_spec.rb +45 -0
- data/spec/api_resources/tasks_spec.rb +60 -0
- data/spec/api_resources/teams_spec.rb +42 -0
- data/spec/api_resources/translation_memory_spec.rb +58 -0
- data/spec/api_resources/translation_status_spec.rb +26 -0
- data/spec/api_resources/translations_spec.rb +42 -0
- data/spec/api_resources/users_spec.rb +84 -0
- data/spec/api_resources/workflows_spec.rb +10 -0
- metadata +29 -3
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
describe Crowdin::ApiResources::Reports do
|
|
4
4
|
describe 'Default endpoints' do
|
|
5
|
+
describe '#list_report_settings_templates' do
|
|
6
|
+
it 'when request are valid', :default do
|
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/settings-templates")
|
|
8
|
+
result = @crowdin.list_report_settings_templates({}, project_id)
|
|
9
|
+
expect(result).to eq(200)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#add_report_settings_template' do
|
|
14
|
+
it 'when request are valid', :default do
|
|
15
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/settings-templates")
|
|
16
|
+
query = { name: 't', currency: 'USD', unit: 'words', mode: 'simple', config: {} }
|
|
17
|
+
result = @crowdin.add_report_settings_template(query, project_id)
|
|
18
|
+
expect(result).to eq(200)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe '#get_report_settings_template' do
|
|
23
|
+
it 'when request are valid', :default do
|
|
24
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/settings-templates/1")
|
|
25
|
+
result = @crowdin.get_report_settings_template(1, project_id)
|
|
26
|
+
expect(result).to eq(200)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe '#edit_report_settings_template' do
|
|
31
|
+
it 'when request are valid', :default do
|
|
32
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/settings-templates/1")
|
|
33
|
+
result = @crowdin.edit_report_settings_template({}, 1, project_id)
|
|
34
|
+
expect(result).to eq(200)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
describe '#delete_report_settings_template' do
|
|
39
|
+
it 'when request are valid', :default do
|
|
40
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/settings-templates/1")
|
|
41
|
+
result = @crowdin.delete_report_settings_template(1, project_id)
|
|
42
|
+
expect(result).to eq(200)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
5
46
|
describe '#generate_report' do
|
|
6
47
|
it 'when request are valid', :default do
|
|
7
48
|
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports")
|
|
@@ -142,4 +183,184 @@ describe Crowdin::ApiResources::Reports do
|
|
|
142
183
|
end
|
|
143
184
|
end
|
|
144
185
|
end
|
|
186
|
+
|
|
187
|
+
describe 'Default endpoints' do
|
|
188
|
+
describe '#list_report_archives' do
|
|
189
|
+
it 'when request are valid', :default do
|
|
190
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives")
|
|
191
|
+
result = @crowdin.list_report_archives({}, 1)
|
|
192
|
+
expect(result).to eq(200)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
describe '#delete_report_archive' do
|
|
197
|
+
it 'when request are valid', :default do
|
|
198
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives/1")
|
|
199
|
+
result = @crowdin.delete_report_archive(1, 1)
|
|
200
|
+
expect(result).to eq(200)
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
describe '#get_report_archive' do
|
|
205
|
+
it 'when request are valid', :default do
|
|
206
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives/1")
|
|
207
|
+
result = @crowdin.get_report_archive(1, 1)
|
|
208
|
+
expect(result).to eq(200)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
describe '#export_report_archive' do
|
|
213
|
+
it 'when request are valid', :default do
|
|
214
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives/1/exports")
|
|
215
|
+
result = @crowdin.export_report_archive(1, {}, 1)
|
|
216
|
+
expect(result).to eq(200)
|
|
217
|
+
end
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
describe '#check_report_archive_export_status' do
|
|
221
|
+
it 'when request are valid', :default do
|
|
222
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives/1/exports/1")
|
|
223
|
+
result = @crowdin.check_report_archive_export_status(1, 1, 1)
|
|
224
|
+
expect(result).to eq(200)
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
describe '#download_report_archive' do
|
|
229
|
+
it 'when request are valid', :default do
|
|
230
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/archives/1/exports/1/download")
|
|
231
|
+
result = @crowdin.download_report_archive(1, 1, nil, 1)
|
|
232
|
+
expect(result).to eq(200)
|
|
233
|
+
end
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
describe '#list_user_report_settings_templates' do
|
|
237
|
+
it 'when request are valid', :default do
|
|
238
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/settings-templates")
|
|
239
|
+
result = @crowdin.list_user_report_settings_templates(1, {})
|
|
240
|
+
expect(result).to eq(200)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
describe '#add_user_report_settings_template' do
|
|
245
|
+
it 'when request are valid', :default do
|
|
246
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/users/1/reports/settings-templates")
|
|
247
|
+
result = @crowdin.add_user_report_settings_template(1, {})
|
|
248
|
+
expect(result).to eq(200)
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
describe '#delete_user_report_settings_template' do
|
|
253
|
+
it 'when request are valid', :default do
|
|
254
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/users/1/reports/settings-templates/1")
|
|
255
|
+
result = @crowdin.delete_user_report_settings_template(1, 1)
|
|
256
|
+
expect(result).to eq(200)
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
describe '#get_user_report_settings_template' do
|
|
261
|
+
it 'when request are valid', :default do
|
|
262
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/reports/settings-templates/1")
|
|
263
|
+
result = @crowdin.get_user_report_settings_template(1, 1)
|
|
264
|
+
expect(result).to eq(200)
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
describe '#edit_user_report_settings_template' do
|
|
269
|
+
it 'when request are valid', :default do
|
|
270
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/users/1/reports/settings-templates/1")
|
|
271
|
+
result = @crowdin.edit_user_report_settings_template(1, 1, [])
|
|
272
|
+
expect(result).to eq(200)
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
describe 'Enterprise endpoints' do
|
|
278
|
+
describe '#list_organization_report_settings_templates' do
|
|
279
|
+
it 'when request are valid', :enterprise do
|
|
280
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/settings-templates")
|
|
281
|
+
result = @crowdin.list_organization_report_settings_templates({})
|
|
282
|
+
expect(result).to eq(200)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
describe '#add_organization_report_settings_template' do
|
|
287
|
+
it 'when request are valid', :enterprise do
|
|
288
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/reports/settings-templates")
|
|
289
|
+
result = @crowdin.add_organization_report_settings_template({})
|
|
290
|
+
expect(result).to eq(200)
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
describe '#delete_organization_report_settings_template' do
|
|
295
|
+
it 'when request are valid', :enterprise do
|
|
296
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/reports/settings-templates/1")
|
|
297
|
+
result = @crowdin.delete_organization_report_settings_template(1)
|
|
298
|
+
expect(result).to eq(200)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
describe '#get_organization_report_settings_template' do
|
|
303
|
+
it 'when request are valid', :enterprise do
|
|
304
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/settings-templates/1")
|
|
305
|
+
result = @crowdin.get_organization_report_settings_template(1)
|
|
306
|
+
expect(result).to eq(200)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
describe '#edit_organization_report_settings_template' do
|
|
311
|
+
it 'when request are valid', :enterprise do
|
|
312
|
+
stub_request(:patch, "https://domain.api.crowdin.com/#{target_api_url}/reports/settings-templates/1")
|
|
313
|
+
result = @crowdin.edit_organization_report_settings_template(1, [])
|
|
314
|
+
expect(result).to eq(200)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
describe '#list_report_archives' do
|
|
319
|
+
it 'when request are valid', :enterprise do
|
|
320
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives")
|
|
321
|
+
result = @crowdin.list_report_archives({})
|
|
322
|
+
expect(result).to eq(200)
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
describe '#delete_report_archive' do
|
|
327
|
+
it 'when request are valid', :enterprise do
|
|
328
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives/1")
|
|
329
|
+
result = @crowdin.delete_report_archive(1)
|
|
330
|
+
expect(result).to eq(200)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
describe '#get_report_archive' do
|
|
335
|
+
it 'when request are valid', :enterprise do
|
|
336
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives/1")
|
|
337
|
+
result = @crowdin.get_report_archive(1)
|
|
338
|
+
expect(result).to eq(200)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
describe '#export_report_archive' do
|
|
343
|
+
it 'when request are valid', :enterprise do
|
|
344
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives/1/exports")
|
|
345
|
+
result = @crowdin.export_report_archive(1, {})
|
|
346
|
+
expect(result).to eq(200)
|
|
347
|
+
end
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
describe '#check_report_archive_export_status' do
|
|
351
|
+
it 'when request are valid', :enterprise do
|
|
352
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives/1/exports/1")
|
|
353
|
+
result = @crowdin.check_report_archive_export_status(1, 1)
|
|
354
|
+
expect(result).to eq(200)
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
describe '#download_report_archive' do
|
|
359
|
+
it 'when request are valid', :enterprise do
|
|
360
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/archives/1/exports/1/download")
|
|
361
|
+
result = @crowdin.download_report_archive(1, 1, nil)
|
|
362
|
+
expect(result).to eq(200)
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
end
|
|
145
366
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe Crowdin::ApiResources::SecurityLogs do
|
|
4
|
+
describe 'Default endpoints' do
|
|
5
|
+
describe '#list_user_security_logs' do
|
|
6
|
+
it 'when request are valid', :default do
|
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/security-logs")
|
|
8
|
+
result = @crowdin.list_user_security_logs(1, {})
|
|
9
|
+
expect(result).to eq(200)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#get_user_security_log' do
|
|
14
|
+
it 'when request are valid', :default do
|
|
15
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/users/1/security-logs/1")
|
|
16
|
+
result = @crowdin.get_user_security_log(1, 1)
|
|
17
|
+
expect(result).to eq(200)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe 'Enterprise endpoints' do
|
|
23
|
+
describe '#list_organization_security_logs' do
|
|
24
|
+
it 'when request are valid', :enterprise do
|
|
25
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/security-logs")
|
|
26
|
+
result = @crowdin.list_organization_security_logs({})
|
|
27
|
+
expect(result).to eq(200)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
describe '#get_organization_security_log' do
|
|
32
|
+
it 'when request are valid', :enterprise do
|
|
33
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/security-logs/1")
|
|
34
|
+
result = @crowdin.get_organization_security_log(1)
|
|
35
|
+
expect(result).to eq(200)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -36,6 +36,12 @@ describe Crowdin::ApiResources::SourceFiles do
|
|
|
36
36
|
delete_branch = @crowdin.delete_branch(branch_id, project_id)
|
|
37
37
|
expect(delete_branch).to eq(200)
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
it 'sends Prefer header when async', :default do
|
|
41
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1")
|
|
42
|
+
.with(headers: { 'Prefer' => 'respond-async' })
|
|
43
|
+
expect(@crowdin.delete_branch(1, project_id, async: true)).to eq(200)
|
|
44
|
+
end
|
|
39
45
|
end
|
|
40
46
|
|
|
41
47
|
describe '#edit_branch' do
|
|
@@ -82,6 +88,12 @@ describe Crowdin::ApiResources::SourceFiles do
|
|
|
82
88
|
delete_directory = @crowdin.delete_directory(directory_id, project_id)
|
|
83
89
|
expect(delete_directory).to eq(200)
|
|
84
90
|
end
|
|
91
|
+
|
|
92
|
+
it 'sends Prefer header when async', :default do
|
|
93
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/1")
|
|
94
|
+
.with(headers: { 'Prefer' => 'respond-async' })
|
|
95
|
+
expect(@crowdin.delete_directory(1, project_id, async: true)).to eq(200)
|
|
96
|
+
end
|
|
85
97
|
end
|
|
86
98
|
|
|
87
99
|
describe '#edit_directory' do
|
|
@@ -138,6 +150,12 @@ describe Crowdin::ApiResources::SourceFiles do
|
|
|
138
150
|
delete_file = @crowdin.delete_file(file_id, project_id)
|
|
139
151
|
expect(delete_file).to eq(200)
|
|
140
152
|
end
|
|
153
|
+
|
|
154
|
+
it 'sends Prefer header when async', :default do
|
|
155
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1")
|
|
156
|
+
.with(headers: { 'Prefer' => 'respond-async' })
|
|
157
|
+
expect(@crowdin.delete_file(1, project_id, async: true)).to eq(200)
|
|
158
|
+
end
|
|
141
159
|
end
|
|
142
160
|
|
|
143
161
|
describe '#edit_file' do
|
|
@@ -191,4 +209,168 @@ describe Crowdin::ApiResources::SourceFiles do
|
|
|
191
209
|
end
|
|
192
210
|
end
|
|
193
211
|
end
|
|
212
|
+
|
|
213
|
+
describe 'Default endpoints' do
|
|
214
|
+
describe '#search_branches' do
|
|
215
|
+
it 'when request are valid', :default do
|
|
216
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/branches")
|
|
217
|
+
result = @crowdin.search_branches({})
|
|
218
|
+
expect(result).to eq(200)
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
describe '#search_directories' do
|
|
223
|
+
it 'when request are valid', :default do
|
|
224
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/directories")
|
|
225
|
+
result = @crowdin.search_directories({})
|
|
226
|
+
expect(result).to eq(200)
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
describe '#search_files' do
|
|
231
|
+
it 'when request are valid', :default do
|
|
232
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/files")
|
|
233
|
+
result = @crowdin.search_files({})
|
|
234
|
+
expect(result).to eq(200)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
describe '#clone_branch' do
|
|
239
|
+
it 'when request are valid', :default do
|
|
240
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/clones")
|
|
241
|
+
result = @crowdin.clone_branch(1, {}, project_id)
|
|
242
|
+
expect(result).to eq(200)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
describe '#check_branch_clone_status' do
|
|
247
|
+
it 'when request are valid', :default do
|
|
248
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/clones/1")
|
|
249
|
+
result = @crowdin.check_branch_clone_status(1, 1, project_id)
|
|
250
|
+
expect(result).to eq(200)
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
describe '#get_cloned_branch' do
|
|
255
|
+
it 'when request are valid', :default do
|
|
256
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/clones/1/branch")
|
|
257
|
+
result = @crowdin.get_cloned_branch(1, 1, project_id)
|
|
258
|
+
expect(result).to eq(200)
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
describe '#check_delete_branch_job_status' do
|
|
263
|
+
it 'when request are valid', :default do
|
|
264
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/jobs/1")
|
|
265
|
+
result = @crowdin.check_delete_branch_job_status(1, 1, project_id)
|
|
266
|
+
expect(result).to eq(200)
|
|
267
|
+
end
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
describe '#merge_branch' do
|
|
271
|
+
it 'when request are valid', :default do
|
|
272
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/merges")
|
|
273
|
+
result = @crowdin.merge_branch(1, {}, project_id)
|
|
274
|
+
expect(result).to eq(200)
|
|
275
|
+
end
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
describe '#check_branch_merge_status' do
|
|
279
|
+
it 'when request are valid', :default do
|
|
280
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/merges/1")
|
|
281
|
+
result = @crowdin.check_branch_merge_status(1, 1, project_id)
|
|
282
|
+
expect(result).to eq(200)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
describe '#get_branch_merge_summary' do
|
|
287
|
+
it 'when request are valid', :default do
|
|
288
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/1/merges/1/summary")
|
|
289
|
+
result = @crowdin.get_branch_merge_summary(1, 1, project_id)
|
|
290
|
+
expect(result).to eq(200)
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
describe '#check_delete_directory_job_status' do
|
|
295
|
+
it 'when request are valid', :default do
|
|
296
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/directories/1/jobs/1")
|
|
297
|
+
result = @crowdin.check_delete_directory_job_status(1, 1, project_id)
|
|
298
|
+
expect(result).to eq(200)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
describe '#check_delete_file_job_status' do
|
|
303
|
+
it 'when request are valid', :default do
|
|
304
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1/jobs/1")
|
|
305
|
+
result = @crowdin.check_delete_file_job_status(1, 1, project_id)
|
|
306
|
+
expect(result).to eq(200)
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
describe '#list_asset_references' do
|
|
311
|
+
it 'when request are valid', :default do
|
|
312
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1/references")
|
|
313
|
+
result = @crowdin.list_asset_references(1, {}, project_id)
|
|
314
|
+
expect(result).to eq(200)
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
describe '#add_asset_reference' do
|
|
319
|
+
it 'when request are valid', :default do
|
|
320
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1/references")
|
|
321
|
+
result = @crowdin.add_asset_reference(1, {}, project_id)
|
|
322
|
+
expect(result).to eq(200)
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
describe '#delete_asset_reference' do
|
|
327
|
+
it 'when request are valid', :default do
|
|
328
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1/references/1")
|
|
329
|
+
result = @crowdin.delete_asset_reference(1, 1, project_id)
|
|
330
|
+
expect(result).to eq(200)
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
describe '#get_asset_reference' do
|
|
335
|
+
it 'when request are valid', :default do
|
|
336
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/files/1/references/1")
|
|
337
|
+
result = @crowdin.get_asset_reference(1, 1, project_id)
|
|
338
|
+
expect(result).to eq(200)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
describe 'Enterprise endpoints' do
|
|
344
|
+
describe '#list_reviewed_source_files_builds' do
|
|
345
|
+
it 'when request are valid', :enterprise do
|
|
346
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/reviewed-builds")
|
|
347
|
+
result = @crowdin.list_reviewed_source_files_builds({}, project_id)
|
|
348
|
+
expect(result).to eq(200)
|
|
349
|
+
end
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
describe '#build_reviewed_source_files' do
|
|
353
|
+
it 'when request are valid', :enterprise do
|
|
354
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/reviewed-builds")
|
|
355
|
+
result = @crowdin.build_reviewed_source_files({}, project_id)
|
|
356
|
+
expect(result).to eq(200)
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
describe '#check_reviewed_source_files_build_status' do
|
|
361
|
+
it 'when request are valid', :enterprise do
|
|
362
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/reviewed-builds/1")
|
|
363
|
+
result = @crowdin.check_reviewed_source_files_build_status(1, project_id)
|
|
364
|
+
expect(result).to eq(200)
|
|
365
|
+
end
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
describe '#download_reviewed_source_files' do
|
|
369
|
+
it 'when request are valid', :enterprise do
|
|
370
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/reviewed-builds/1/download")
|
|
371
|
+
result = @crowdin.download_reviewed_source_files(1, nil, project_id)
|
|
372
|
+
expect(result).to eq(200)
|
|
373
|
+
end
|
|
374
|
+
end
|
|
375
|
+
end
|
|
194
376
|
end
|
|
@@ -56,4 +56,30 @@ describe Crowdin::ApiResources::SourceStrings do
|
|
|
56
56
|
end
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
|
+
|
|
60
|
+
describe 'Default endpoints' do
|
|
61
|
+
describe '#upload_strings' do
|
|
62
|
+
it 'when request are valid', :default do
|
|
63
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/uploads")
|
|
64
|
+
result = @crowdin.upload_strings({}, project_id)
|
|
65
|
+
expect(result).to eq(200)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe '#upload_strings_status' do
|
|
70
|
+
it 'when request are valid', :default do
|
|
71
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/uploads/1")
|
|
72
|
+
result = @crowdin.upload_strings_status(1, project_id)
|
|
73
|
+
expect(result).to eq(200)
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe '#search_strings' do
|
|
78
|
+
it 'when request are valid', :default do
|
|
79
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/strings")
|
|
80
|
+
result = @crowdin.search_strings({})
|
|
81
|
+
expect(result).to eq(200)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
59
85
|
end
|
|
@@ -48,4 +48,22 @@ describe Crowdin::ApiResources::StringComments do
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
describe 'Default endpoints' do
|
|
53
|
+
describe '#string_asset_comment_batch_operations' do
|
|
54
|
+
it 'when request are valid', :default do
|
|
55
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments")
|
|
56
|
+
result = @crowdin.string_asset_comment_batch_operations([], project_id)
|
|
57
|
+
expect(result).to eq(200)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe '#delete_attachment_from_string_asset_comment' do
|
|
62
|
+
it 'when request are valid', :default do
|
|
63
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments/1/attachments/1")
|
|
64
|
+
result = @crowdin.delete_attachment_from_string_asset_comment(1, 1, project_id)
|
|
65
|
+
expect(result).to eq(200)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
51
69
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
describe Crowdin::ApiResources::StringCorrections do
|
|
4
|
-
describe '
|
|
4
|
+
describe 'Enterprise endpoints' do
|
|
5
5
|
let(:correction_id) { 35 }
|
|
6
6
|
let(:string_id) { 2 }
|
|
7
7
|
|
|
8
8
|
describe '#list_corrections' do
|
|
9
|
-
it 'when request is valid', :
|
|
10
|
-
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
9
|
+
it 'when request is valid', :enterprise do
|
|
10
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
11
11
|
.with(query: { stringId: string_id })
|
|
12
12
|
list_corrections = @crowdin.list_corrections({ stringId: string_id }, project_id)
|
|
13
13
|
expect(list_corrections).to eq(200)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
it 'when request is valid', :
|
|
16
|
+
it 'when request is valid', :enterprise do
|
|
17
17
|
query = { stringId: string_id, limit: 50, offset: 10, orderBy: 'createdAt desc', denormalizePlaceholders: 1 }
|
|
18
|
-
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
18
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
19
19
|
.with(query: query)
|
|
20
20
|
list_corrections = @crowdin.list_corrections(query, project_id)
|
|
21
21
|
expect(list_corrections).to eq(200)
|
|
@@ -23,17 +23,17 @@ describe Crowdin::ApiResources::StringCorrections do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
describe '#add_correction' do
|
|
26
|
-
it 'when request is valid', :
|
|
26
|
+
it 'when request is valid', :enterprise do
|
|
27
27
|
body = { stringId: 35_434, text: 'This string has been corrected', pluralCategoryName: 'few' }
|
|
28
|
-
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
28
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
29
29
|
.with(body: body)
|
|
30
30
|
add_correction = @crowdin.add_correction(body, project_id)
|
|
31
31
|
expect(add_correction).to eq(200)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
it 'when request is valid', :
|
|
34
|
+
it 'when request is valid', :enterprise do
|
|
35
35
|
body = { stringId: 35_434, text: 'This string has been corrected' }
|
|
36
|
-
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
36
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
37
37
|
.with(body: body)
|
|
38
38
|
add_correction = @crowdin.add_correction(body, project_id)
|
|
39
39
|
expect(add_correction).to eq(200)
|
|
@@ -41,14 +41,14 @@ describe Crowdin::ApiResources::StringCorrections do
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
describe '#get_correction' do
|
|
44
|
-
it 'when request is valid', :
|
|
45
|
-
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
44
|
+
it 'when request is valid', :enterprise do
|
|
45
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
46
46
|
get_correction = @crowdin.get_correction(correction_id, {}, project_id)
|
|
47
47
|
expect(get_correction).to eq(200)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
it 'when request is valid', :
|
|
51
|
-
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
50
|
+
it 'when request is valid', :enterprise do
|
|
51
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
52
52
|
.with(query: { denormalizePlaceholders: 1 })
|
|
53
53
|
get_correction = @crowdin.get_correction(correction_id, { denormalizePlaceholders: 1 }, project_id)
|
|
54
54
|
expect(get_correction).to eq(200)
|
|
@@ -56,8 +56,8 @@ describe Crowdin::ApiResources::StringCorrections do
|
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
describe '#delete_corrections' do
|
|
59
|
-
it 'when request is valid', :
|
|
60
|
-
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
59
|
+
it 'when request is valid', :enterprise do
|
|
60
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections")
|
|
61
61
|
.with(query: { stringId: string_id })
|
|
62
62
|
delete_corrections = @crowdin.delete_corrections({ stringId: string_id }, project_id)
|
|
63
63
|
expect(delete_corrections).to eq(200)
|
|
@@ -65,19 +65,25 @@ describe Crowdin::ApiResources::StringCorrections do
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
describe '#delete_correction' do
|
|
68
|
-
it 'when request is valid', :
|
|
69
|
-
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
68
|
+
it 'when request is valid', :enterprise do
|
|
69
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
70
70
|
delete_correction = @crowdin.delete_correction(correction_id, project_id)
|
|
71
71
|
expect(delete_correction).to eq(200)
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
describe '#restore_correction' do
|
|
76
|
-
it 'when request is valid', :
|
|
77
|
-
stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
76
|
+
it 'when request is valid', :enterprise do
|
|
77
|
+
stub_request(:put, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/corrections/#{correction_id}")
|
|
78
78
|
restore_correction = @crowdin.restore_correction(correction_id, project_id)
|
|
79
79
|
expect(restore_correction).to eq(200)
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
|
+
|
|
84
|
+
describe 'Default endpoints' do
|
|
85
|
+
it 'raises outside Enterprise mode', :default do
|
|
86
|
+
expect { @crowdin.list_corrections({}, project_id) }.to raise_error(Crowdin::Errors::OnlyForEnterpriseModeError)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
83
89
|
end
|
|
@@ -165,4 +165,30 @@ describe Crowdin::ApiResources::StringTranslations do
|
|
|
165
165
|
end
|
|
166
166
|
end
|
|
167
167
|
end
|
|
168
|
+
|
|
169
|
+
describe 'Default endpoints' do
|
|
170
|
+
describe '#approval_batch_operations' do
|
|
171
|
+
it 'when request are valid', :default do
|
|
172
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/approvals")
|
|
173
|
+
result = @crowdin.approval_batch_operations([], project_id)
|
|
174
|
+
expect(result).to eq(200)
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
describe '#translation_batch_operations' do
|
|
179
|
+
it 'when request are valid', :default do
|
|
180
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations")
|
|
181
|
+
result = @crowdin.translation_batch_operations([], project_id)
|
|
182
|
+
expect(result).to eq(200)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
describe '#search_translations' do
|
|
187
|
+
it 'when request are valid', :default do
|
|
188
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/translations")
|
|
189
|
+
result = @crowdin.search_translations({})
|
|
190
|
+
expect(result).to eq(200)
|
|
191
|
+
end
|
|
192
|
+
end
|
|
193
|
+
end
|
|
168
194
|
end
|