crowdin-api 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +96 -31
- data/README.md +8 -6
- data/bin/crowdin-console +1 -1
- data/crowdin-api.gemspec +1 -2
- data/lib/crowdin-api/{api-resources → api_resources}/dictionaries.rb +8 -10
- data/lib/crowdin-api/{api-resources → api_resources}/distributions.rb +25 -32
- data/lib/crowdin-api/{api-resources → api_resources}/glossaries.rb +64 -82
- data/lib/crowdin-api/{api-resources → api_resources}/labels.rb +28 -47
- data/lib/crowdin-api/api_resources/languages.rb +61 -0
- data/lib/crowdin-api/api_resources/machine_translation_engines.rb +79 -0
- data/lib/crowdin-api/api_resources/projects.rb +124 -0
- data/lib/crowdin-api/api_resources/reports.rb +120 -0
- data/lib/crowdin-api/{api-resources → api_resources}/screenshots.rb +47 -61
- data/lib/crowdin-api/{api-resources → api_resources}/source_files.rb +68 -131
- data/lib/crowdin-api/{api-resources → api_resources}/source_strings.rb +19 -24
- data/lib/crowdin-api/api_resources/storages.rb +54 -0
- data/lib/crowdin-api/{api-resources → api_resources}/string_comments.rb +18 -23
- data/lib/crowdin-api/{api-resources → api_resources}/string_translations.rb +63 -90
- data/lib/crowdin-api/{api-resources → api_resources}/tasks.rb +30 -41
- data/lib/crowdin-api/api_resources/teams.rb +135 -0
- data/lib/crowdin-api/{api-resources → api_resources}/translation_memory.rb +38 -52
- data/lib/crowdin-api/{api-resources → api_resources}/translation_status.rb +24 -30
- data/lib/crowdin-api/{api-resources → api_resources}/translations.rb +40 -58
- data/lib/crowdin-api/api_resources/users.rb +161 -0
- data/lib/crowdin-api/api_resources/vendors.rb +21 -0
- data/lib/crowdin-api/{api-resources → api_resources}/webhooks.rb +19 -24
- data/lib/crowdin-api/api_resources/workflows.rb +59 -0
- data/lib/crowdin-api/client/client.rb +51 -42
- data/lib/crowdin-api/client/configuration.rb +12 -12
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors_raisers.rb +1 -1
- data/lib/crowdin-api/core/request.rb +53 -88
- data/lib/crowdin-api/core/send_request.rb +67 -0
- data/lib/crowdin-api.rb +17 -24
- data/spec/api_resources/dictionaries_spec.rb +23 -0
- data/spec/api_resources/distributions_spec.rb +71 -0
- data/spec/api_resources/glossaries_spec.rb +167 -0
- data/spec/api_resources/labels_spec.rb +71 -0
- data/spec/api_resources/languages_spec.rb +51 -0
- data/spec/api_resources/machine_translation_engines_spec.rb +63 -0
- data/spec/api_resources/projects_spec.rb +215 -0
- data/spec/api_resources/reports_spec.rb +95 -0
- data/spec/api_resources/screenshots_spec.rb +134 -0
- data/spec/api_resources/source_files_spec.rb +13 -0
- data/spec/api_resources/source_strings_spec.rb +51 -0
- data/spec/api_resources/storages_spec.rb +13 -0
- data/spec/api_resources/string_comments_spec.rb +13 -0
- data/spec/api_resources/string_translations_spec.rb +13 -0
- data/spec/api_resources/tasks_spec.rb +79 -0
- data/spec/api_resources/teams_spec.rb +13 -0
- data/spec/api_resources/translation_memory_spec.rb +13 -0
- data/spec/api_resources/translation_status_spec.rb +15 -0
- data/spec/api_resources/translations_spec.rb +107 -0
- data/spec/api_resources/users_spec.rb +117 -0
- data/spec/api_resources/vendors_spec.rb +13 -0
- data/spec/api_resources/webhooks_spec.rb +51 -0
- data/spec/api_resources/workflows_spec.rb +41 -0
- data/spec/spec_helper.rb +20 -2
- data/spec/unit/client_spec.rb +85 -0
- metadata +64 -43
- data/bin/setup +0 -6
- data/lib/crowdin-api/api-resources/languages.rb +0 -82
- data/lib/crowdin-api/api-resources/machine_translation_engines.rb +0 -74
- data/lib/crowdin-api/api-resources/projects.rb +0 -148
- data/lib/crowdin-api/api-resources/reports.rb +0 -138
- data/lib/crowdin-api/api-resources/storages.rb +0 -106
- data/lib/crowdin-api/api-resources/teams.rb +0 -144
- data/lib/crowdin-api/api-resources/users.rb +0 -129
- data/lib/crowdin-api/api-resources/vendors.rb +0 -21
- data/lib/crowdin-api/api-resources/workflows.rb +0 -62
- data/lib/crowdin-api/core/utils.rb +0 -10
- data/spec/client/client-instance_spec.rb +0 -14
- data/spec/client/configuration-instance_spec.rb +0 -72
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Reports do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#generate_report' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports")
|
8
|
+
generate_report = @crowdin.generate_report({}, project_id)
|
9
|
+
expect(generate_report).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#check_report_generation_status' do
|
14
|
+
let(:report_id) { 1 }
|
15
|
+
|
16
|
+
it 'when request are valid', :default do
|
17
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/#{report_id}")
|
18
|
+
check_report_generation_status = @crowdin.check_report_generation_status(report_id, project_id)
|
19
|
+
expect(check_report_generation_status).to eq(200)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#download_report' do
|
24
|
+
let(:report_id) { 1 }
|
25
|
+
|
26
|
+
it 'when request are valid', :default do
|
27
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/reports/#{report_id}/download")
|
28
|
+
download_report = @crowdin.download_report(report_id, nil, project_id)
|
29
|
+
expect(download_report).to eq(200)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'Enterprise endpoints' do
|
35
|
+
describe '#generate_group_report' do
|
36
|
+
let(:group_id) { 1 }
|
37
|
+
|
38
|
+
it 'when request are valid', :enterprise do
|
39
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/groups/#{group_id}/reports")
|
40
|
+
generate_group_report = @crowdin.generate_group_report(group_id, project_id)
|
41
|
+
expect(generate_group_report).to eq(200)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#check_group_report_generation_status' do
|
46
|
+
let(:group_id) { 1 }
|
47
|
+
let(:report_id) { 1 }
|
48
|
+
|
49
|
+
it 'when request are valid', :enterprise do
|
50
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/groups/#{group_id}/reports/#{report_id}")
|
51
|
+
check_group_report_generation_status = @crowdin.check_group_report_generation_status(group_id, report_id)
|
52
|
+
expect(check_group_report_generation_status).to eq(200)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#download_group_report' do
|
57
|
+
let(:group_id) { 1 }
|
58
|
+
let(:report_id) { 1 }
|
59
|
+
|
60
|
+
it 'when request are valid', :enterprise do
|
61
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/groups/#{group_id}/reports/#{report_id}/download")
|
62
|
+
download_group_report = @crowdin.download_group_report(group_id, project_id)
|
63
|
+
expect(download_group_report).to eq(200)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#generate_organization_report' do
|
68
|
+
it 'when request are valid', :enterprise do
|
69
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/reports")
|
70
|
+
generate_organization_report = @crowdin.generate_organization_report
|
71
|
+
expect(generate_organization_report).to eq(200)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#check_organization_report_generation_status' do
|
76
|
+
let(:report_id) { 1 }
|
77
|
+
|
78
|
+
it 'when request are valid', :enterprise do
|
79
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/#{report_id}")
|
80
|
+
check_organization_report_generation_status = @crowdin.check_organization_report_generation_status(report_id)
|
81
|
+
expect(check_organization_report_generation_status).to eq(200)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#download_organization_report' do
|
86
|
+
let(:report_id) { 1 }
|
87
|
+
|
88
|
+
it 'when request are valid', :enterprise do
|
89
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/reports/#{report_id}/download")
|
90
|
+
download_organization_report = @crowdin.download_organization_report(report_id)
|
91
|
+
expect(download_organization_report).to eq(200)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Screenshots do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_screenshots' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots")
|
8
|
+
list_screenshots = @crowdin.list_screenshots({}, project_id)
|
9
|
+
expect(list_screenshots).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#add_screenshot' do
|
14
|
+
it 'when request are valid', :default do
|
15
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots")
|
16
|
+
add_screenshot = @crowdin.add_screenshot({}, project_id)
|
17
|
+
expect(add_screenshot).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get_screenshot' do
|
22
|
+
let(:screenshot_id) { 1 }
|
23
|
+
|
24
|
+
it 'when request are valid', :default do
|
25
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}")
|
26
|
+
get_screenshot = @crowdin.get_screenshot(screenshot_id, project_id)
|
27
|
+
expect(get_screenshot).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#update_screenshot' do
|
32
|
+
let(:screenshot_id) { 1 }
|
33
|
+
|
34
|
+
it 'when request are valid', :default do
|
35
|
+
stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}")
|
36
|
+
update_screenshot = @crowdin.update_screenshot(screenshot_id, {}, project_id)
|
37
|
+
expect(update_screenshot).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#delete_screenshot' do
|
42
|
+
let(:screenshot_id) { 1 }
|
43
|
+
|
44
|
+
it 'when request are valid', :default do
|
45
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}")
|
46
|
+
delete_screenshot = @crowdin.delete_screenshot(screenshot_id, project_id)
|
47
|
+
expect(delete_screenshot).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#edit_screenshot' do
|
52
|
+
let(:screenshot_id) { 1 }
|
53
|
+
|
54
|
+
it 'when request are valid', :default do
|
55
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}")
|
56
|
+
edit_screenshot = @crowdin.edit_screenshot(screenshot_id, {}, project_id)
|
57
|
+
expect(edit_screenshot).to eq(200)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#list_tags' do
|
62
|
+
let(:screenshot_id) { 1 }
|
63
|
+
|
64
|
+
it 'when request are valid', :default do
|
65
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags")
|
66
|
+
list_tags = @crowdin.list_tags(screenshot_id, {}, project_id)
|
67
|
+
expect(list_tags).to eq(200)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#replace_tags' do
|
72
|
+
let(:screenshot_id) { 1 }
|
73
|
+
|
74
|
+
it 'when request are valid', :default do
|
75
|
+
stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags")
|
76
|
+
replace_tags = @crowdin.replace_tags(screenshot_id, {}, project_id)
|
77
|
+
expect(replace_tags).to eq(200)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#add_tag' do
|
82
|
+
let(:screenshot_id) { 1 }
|
83
|
+
|
84
|
+
it 'when request are valid', :default do
|
85
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags")
|
86
|
+
add_tag = @crowdin.add_tag(screenshot_id, {}, project_id)
|
87
|
+
expect(add_tag).to eq(200)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe '#clear_tags' do
|
92
|
+
let(:screenshot_id) { 1 }
|
93
|
+
|
94
|
+
it 'when request are valid', :default do
|
95
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags")
|
96
|
+
clear_tags = @crowdin.clear_tags(screenshot_id, project_id)
|
97
|
+
expect(clear_tags).to eq(200)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe '#get_tag' do
|
102
|
+
let(:screenshot_id) { 1 }
|
103
|
+
let(:tag_id) { 1 }
|
104
|
+
|
105
|
+
it 'when request are valid', :default do
|
106
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags/#{tag_id}")
|
107
|
+
get_tag = @crowdin.get_tag(screenshot_id, tag_id, project_id)
|
108
|
+
expect(get_tag).to eq(200)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
describe '#delete_tag' do
|
113
|
+
let(:screenshot_id) { 1 }
|
114
|
+
let(:tag_id) { 1 }
|
115
|
+
|
116
|
+
it 'when request are valid', :default do
|
117
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags/#{tag_id}")
|
118
|
+
delete_tag = @crowdin.delete_tag(screenshot_id, tag_id, project_id)
|
119
|
+
expect(delete_tag).to eq(200)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#edit_tag' do
|
124
|
+
let(:screenshot_id) { 1 }
|
125
|
+
let(:tag_id) { 1 }
|
126
|
+
|
127
|
+
it 'when request are valid', :default do
|
128
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/screenshots/#{screenshot_id}/tags/#{tag_id}")
|
129
|
+
edit_tag = @crowdin.edit_tag(screenshot_id, tag_id, {}, project_id)
|
130
|
+
expect(edit_tag).to eq(200)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::SourceFiles do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_branches' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches")
|
8
|
+
list_branches = @crowdin.list_branches({}, project_id)
|
9
|
+
expect(list_branches).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::SourceStrings do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_strings' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings")
|
8
|
+
list_strings = @crowdin.list_strings({}, project_id)
|
9
|
+
expect(list_strings).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#add_string' do
|
14
|
+
it 'when request are valid', :default do
|
15
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings")
|
16
|
+
add_string = @crowdin.add_string({}, project_id)
|
17
|
+
expect(add_string).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get_string' do
|
22
|
+
let(:string_id) { 1 }
|
23
|
+
|
24
|
+
it 'when request are valid', :default do
|
25
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/#{string_id}")
|
26
|
+
get_string = @crowdin.get_string(string_id, {}, project_id)
|
27
|
+
expect(get_string).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#delete_string' do
|
32
|
+
let(:string_id) { 1 }
|
33
|
+
|
34
|
+
it 'when request are valid', :default do
|
35
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/#{string_id}")
|
36
|
+
delete_string = @crowdin.delete_string(string_id, project_id)
|
37
|
+
expect(delete_string).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#edit_string' do
|
42
|
+
let(:string_id) { 1 }
|
43
|
+
|
44
|
+
it 'when request are valid', :default do
|
45
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/strings/#{string_id}")
|
46
|
+
edit_string = @crowdin.edit_string(string_id, {}, project_id)
|
47
|
+
expect(edit_string).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Storages do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_storages' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/storages")
|
8
|
+
list_storages = @crowdin.list_storages
|
9
|
+
expect(list_storages).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::StringComments do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_string_comments' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/comments")
|
8
|
+
list_string_comments = @crowdin.list_string_comments({}, project_id)
|
9
|
+
expect(list_string_comments).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::StringTranslations do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_translation_approvals' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/approvals")
|
8
|
+
list_translation_approvals = @crowdin.list_translation_approvals({}, project_id)
|
9
|
+
expect(list_translation_approvals).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Tasks do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_tasks' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks")
|
8
|
+
list_tasks = @crowdin.list_tasks({}, project_id)
|
9
|
+
expect(list_tasks).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#add_task' do
|
14
|
+
it 'when request are valid', :default do
|
15
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks")
|
16
|
+
add_task = @crowdin.add_task({}, project_id)
|
17
|
+
expect(add_task).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#export_task_strings' do
|
22
|
+
let(:task_id) { 1 }
|
23
|
+
|
24
|
+
it 'when request are valid', :default do
|
25
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks/#{task_id}/exports")
|
26
|
+
export_task_strings = @crowdin.export_task_strings(task_id, nil, project_id)
|
27
|
+
expect(export_task_strings).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#get_task' do
|
32
|
+
let(:task_id) { 1 }
|
33
|
+
|
34
|
+
it 'when request are valid', :default do
|
35
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks/#{task_id}")
|
36
|
+
get_task = @crowdin.get_task(task_id, project_id)
|
37
|
+
expect(get_task).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#delete_task' do
|
42
|
+
let(:task_id) { 1 }
|
43
|
+
|
44
|
+
it 'when request are valid', :default do
|
45
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks/#{task_id}")
|
46
|
+
delete_task = @crowdin.delete_task(task_id, project_id)
|
47
|
+
expect(delete_task).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#edit_task' do
|
52
|
+
let(:task_id) { 1 }
|
53
|
+
|
54
|
+
it 'when request are valid', :default do
|
55
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/tasks/#{task_id}")
|
56
|
+
edit_task = @crowdin.edit_task(task_id, {}, project_id)
|
57
|
+
expect(edit_task).to eq(200)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#list_user_tasks' do
|
62
|
+
it 'when request are valid', :default do
|
63
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/user/tasks")
|
64
|
+
list_user_tasks = @crowdin.list_user_tasks({})
|
65
|
+
expect(list_user_tasks).to eq(200)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#edit_task_archived_status' do
|
70
|
+
let(:task_id) { 1 }
|
71
|
+
|
72
|
+
it 'when request are valid', :default do
|
73
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/user/tasks/#{task_id}")
|
74
|
+
edit_task_archived_status = @crowdin.edit_task_archived_status(task_id, {})
|
75
|
+
expect(edit_task_archived_status).to eq(200)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Teams do
|
4
|
+
describe 'Enterprise endpoints' do
|
5
|
+
describe '#add_team_to_project' do
|
6
|
+
it 'when request are valid', :enterprise do
|
7
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/teams")
|
8
|
+
add_team_to_project = @crowdin.add_team_to_project({}, project_id)
|
9
|
+
expect(add_team_to_project).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::TranslationMemory do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_tms' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/tms")
|
8
|
+
list_tms = @crowdin.list_tms
|
9
|
+
expect(list_tms).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::TranslationStatus do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#get_branch_progress' do
|
6
|
+
let(:branch_id) { 1 }
|
7
|
+
|
8
|
+
it 'when request are valid', :default do
|
9
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/branches/#{branch_id}/languages/progress")
|
10
|
+
get_branch_progress = @crowdin.get_branch_progress(branch_id, {}, project_id)
|
11
|
+
expect(get_branch_progress).to eq(200)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Translations do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#pre_translation_status' do
|
6
|
+
let(:pre_translation_id) { 1 }
|
7
|
+
|
8
|
+
it 'when request are valid', :default do
|
9
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/pre-translations/#{pre_translation_id}")
|
10
|
+
pre_translation_status = @crowdin.pre_translation_status(pre_translation_id, project_id)
|
11
|
+
expect(pre_translation_status).to eq(200)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#apply_pre_translation' do
|
16
|
+
it 'when request are valid', :default do
|
17
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/pre-translations")
|
18
|
+
apply_pre_translation = @crowdin.apply_pre_translation({}, project_id)
|
19
|
+
expect(apply_pre_translation).to eq(200)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#build_project_directory_translation' do
|
24
|
+
let(:directory_id) { 1 }
|
25
|
+
|
26
|
+
it 'when request are valid', :default do
|
27
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/directories/#{directory_id}")
|
28
|
+
build_project_directory_translation = @crowdin.build_project_directory_translation(directory_id, {}, project_id)
|
29
|
+
expect(build_project_directory_translation).to eq(200)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe '#build_project_file_translation' do
|
34
|
+
let(:file_id) { 1 }
|
35
|
+
|
36
|
+
it 'when request are valid', :default do
|
37
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/files/#{file_id}")
|
38
|
+
build_project_file_translation = @crowdin.build_project_file_translation(file_id, {}, nil, project_id)
|
39
|
+
expect(build_project_file_translation).to eq(200)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe '#list_project_builds' do
|
44
|
+
it 'when request are valid', :default do
|
45
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds")
|
46
|
+
list_project_builds = @crowdin.list_project_builds({}, project_id)
|
47
|
+
expect(list_project_builds).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#build_project_translation' do
|
52
|
+
it 'when request are valid', :default do
|
53
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds")
|
54
|
+
build_project_translation = @crowdin.build_project_translation({}, project_id)
|
55
|
+
expect(build_project_translation).to eq(200)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe '#upload_translations' do
|
60
|
+
let(:language_id) { 1 }
|
61
|
+
|
62
|
+
it 'when request are valid', :default do
|
63
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/#{language_id}")
|
64
|
+
upload_translations = @crowdin.upload_translations(language_id, {}, project_id)
|
65
|
+
expect(upload_translations).to eq(200)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
describe '#download_project_translations' do
|
70
|
+
let(:build_id) { 1 }
|
71
|
+
|
72
|
+
it 'when request are valid', :default do
|
73
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/#{build_id}/download")
|
74
|
+
download_project_translations = @crowdin.download_project_translations(build_id, nil, project_id)
|
75
|
+
expect(download_project_translations).to eq(200)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#check_project_build_status' do
|
80
|
+
let(:build_id) { 1 }
|
81
|
+
|
82
|
+
it 'when request are valid', :default do
|
83
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/#{build_id}")
|
84
|
+
check_project_build_status = @crowdin.check_project_build_status(build_id, project_id)
|
85
|
+
expect(check_project_build_status).to eq(200)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe '#cancel_build' do
|
90
|
+
let(:build_id) { 1 }
|
91
|
+
|
92
|
+
it 'when request are valid', :default do
|
93
|
+
stub_request(:delete, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/builds/#{build_id}")
|
94
|
+
cancel_build = @crowdin.cancel_build(build_id, project_id)
|
95
|
+
expect(cancel_build).to eq(200)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
describe '#export_project_translation' do
|
100
|
+
it 'when request are valid', :default do
|
101
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/translations/exports")
|
102
|
+
export_project_translation = @crowdin.export_project_translation({}, nil, project_id)
|
103
|
+
expect(export_project_translation).to eq(200)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|