crowdin-api 1.2.0 → 1.4.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 +102 -43
- data/README.md +37 -6
- data/bin/crowdin-console +1 -1
- data/crowdin-api.gemspec +1 -2
- data/lib/crowdin-api/api_resources/bundles.rb +81 -0
- 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 +64 -91
- 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 +41 -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 +134 -39
- data/lib/crowdin-api/client/configuration.rb +12 -12
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/errors.rb +1 -0
- data/lib/crowdin-api/core/errors_raisers.rb +1 -1
- data/lib/crowdin-api/core/fetch_all_extensions.rb +14 -0
- data/lib/crowdin-api/core/request.rb +50 -90
- data/lib/crowdin-api/core/send_request.rb +67 -0
- data/lib/crowdin-api.rb +18 -24
- data/spec/api_resources/bundles_spec.rb +61 -0
- 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 +184 -0
- data/spec/api_resources/source_strings_spec.rb +51 -0
- data/spec/api_resources/storages_spec.rb +41 -0
- data/spec/api_resources/string_comments_spec.rb +51 -0
- data/spec/api_resources/string_translations_spec.rb +141 -0
- data/spec/api_resources/tasks_spec.rb +79 -0
- data/spec/api_resources/teams_spec.rb +100 -0
- data/spec/api_resources/translation_memory_spec.rb +114 -0
- data/spec/api_resources/translation_status_spec.rb +61 -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 +23 -2
- data/spec/unit/client_spec.rb +85 -0
- metadata +67 -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,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
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Users do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#get_authenticated_user' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/user")
|
8
|
+
get_authenticated_user = @crowdin.get_authenticated_user
|
9
|
+
expect(get_authenticated_user).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#list_project_members' do
|
14
|
+
it 'when request are valid', :default do
|
15
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/members")
|
16
|
+
list_project_members = @crowdin.list_project_members({}, project_id)
|
17
|
+
expect(list_project_members).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get_member_info' do
|
22
|
+
let(:member_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}/members/#{member_id}")
|
26
|
+
get_member_info = @crowdin.get_member_info(member_id, project_id)
|
27
|
+
expect(get_member_info).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'Enterprise endpoints' do
|
33
|
+
describe '#add_project_member' do
|
34
|
+
it 'when request are valid', :enterprise do
|
35
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/members")
|
36
|
+
add_project_member = @crowdin.add_project_member({}, project_id)
|
37
|
+
expect(add_project_member).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#get_project_member_permissions' do
|
42
|
+
let(:member_id) { 1 }
|
43
|
+
|
44
|
+
it 'when request are valid', :enterprise do
|
45
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/members/#{member_id}")
|
46
|
+
get_project_member_permissions = @crowdin.get_project_member_permissions(member_id, project_id)
|
47
|
+
expect(get_project_member_permissions).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe '#replace_project_permissions' do
|
52
|
+
let(:member_id) { 1 }
|
53
|
+
|
54
|
+
it 'when request are valid', :enterprise do
|
55
|
+
stub_request(:put, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/members/#{member_id}")
|
56
|
+
replace_project_permissions = @crowdin.replace_project_permissions(member_id, {}, project_id)
|
57
|
+
expect(replace_project_permissions).to eq(200)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#delete_member_from_project' do
|
62
|
+
let(:member_id) { 1 }
|
63
|
+
|
64
|
+
it 'when request are valid', :enterprise do
|
65
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/members/#{member_id}")
|
66
|
+
delete_member_from_project = @crowdin.delete_member_from_project(member_id, {}, project_id)
|
67
|
+
expect(delete_member_from_project).to eq(200)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#list_users' do
|
72
|
+
it 'when request are valid', :enterprise do
|
73
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/users")
|
74
|
+
list_users = @crowdin.list_users
|
75
|
+
expect(list_users).to eq(200)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe '#invite_user' do
|
80
|
+
it 'when request are valid', :enterprise do
|
81
|
+
stub_request(:post, "https://domain.api.crowdin.com/#{target_api_url}/users")
|
82
|
+
invite_user = @crowdin.invite_user
|
83
|
+
expect(invite_user).to eq(200)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
describe '#get_user' do
|
88
|
+
let(:user_id) { 1 }
|
89
|
+
|
90
|
+
it 'when request are valid', :enterprise do
|
91
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/users/#{user_id}")
|
92
|
+
get_user = @crowdin.get_user(user_id)
|
93
|
+
expect(get_user).to eq(200)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
describe '#delete_user' do
|
98
|
+
let(:user_id) { 1 }
|
99
|
+
|
100
|
+
it 'when request are valid', :enterprise do
|
101
|
+
stub_request(:delete, "https://domain.api.crowdin.com/#{target_api_url}/users/#{user_id}")
|
102
|
+
delete_user = @crowdin.delete_user(user_id)
|
103
|
+
expect(delete_user).to eq(200)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
describe '#edit_user' do
|
108
|
+
let(:user_id) { 1 }
|
109
|
+
|
110
|
+
it 'when request are valid', :enterprise do
|
111
|
+
stub_request(:patch, "https://domain.api.crowdin.com/#{target_api_url}/users/#{user_id}")
|
112
|
+
edit_user = @crowdin.edit_user(user_id)
|
113
|
+
expect(edit_user).to eq(200)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Vendors do
|
4
|
+
describe 'Enterprise endpoints' do
|
5
|
+
describe '#list_vendors' do
|
6
|
+
it 'when request are valid', :enterprise do
|
7
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/vendors")
|
8
|
+
list_vendors = @crowdin.list_vendors
|
9
|
+
expect(list_vendors).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::Webhooks do
|
4
|
+
describe 'Default endpoints' do
|
5
|
+
describe '#list_webhooks' do
|
6
|
+
it 'when request are valid', :default do
|
7
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/webhooks")
|
8
|
+
list_webhooks = @crowdin.list_webhooks({}, project_id)
|
9
|
+
expect(list_webhooks).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#add_webhook' do
|
14
|
+
it 'when request are valid', :default do
|
15
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/webhooks")
|
16
|
+
add_webhook = @crowdin.add_webhook({}, project_id)
|
17
|
+
expect(add_webhook).to eq(200)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#get_webhook' do
|
22
|
+
let(:webhook_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}/webhooks/#{webhook_id}")
|
26
|
+
get_webhook = @crowdin.get_webhook(webhook_id, project_id)
|
27
|
+
expect(get_webhook).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#delete_webhook' do
|
32
|
+
let(:webhook_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}/webhooks/#{webhook_id}")
|
36
|
+
delete_webhook = @crowdin.delete_webhook(webhook_id, project_id)
|
37
|
+
expect(delete_webhook).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#edit_webhook' do
|
42
|
+
let(:webhook_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}/webhooks/#{webhook_id}")
|
46
|
+
edit_webhook = @crowdin.edit_webhook(webhook_id, {}, project_id)
|
47
|
+
expect(edit_webhook).to eq(200)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Crowdin::ApiResources::Workflows do
|
4
|
+
describe 'Enterprise endpoints' do
|
5
|
+
describe '#list_workflow_steps' do
|
6
|
+
it 'when request are valid', :enterprise do
|
7
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/workflow-steps")
|
8
|
+
list_workflow_steps = @crowdin.list_workflow_steps({}, project_id)
|
9
|
+
expect(list_workflow_steps).to eq(200)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#get_workflow_step' do
|
14
|
+
let(:step_id) { 1 }
|
15
|
+
|
16
|
+
it 'when request are valid', :enterprise do
|
17
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/projects/#{project_id}/workflow-steps/#{step_id}")
|
18
|
+
get_workflow_step = @crowdin.get_workflow_step(step_id, project_id)
|
19
|
+
expect(get_workflow_step).to eq(200)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#list_workflow_templates' do
|
24
|
+
it 'when request are valid', :enterprise do
|
25
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/workflow-templates")
|
26
|
+
list_workflow_templates = @crowdin.list_workflow_templates
|
27
|
+
expect(list_workflow_templates).to eq(200)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#get_workflow_template' do
|
32
|
+
let(:template_id) { 1 }
|
33
|
+
|
34
|
+
it 'when request are valid', :enterprise do
|
35
|
+
stub_request(:get, "https://domain.api.crowdin.com/#{target_api_url}/workflow-templates/#{template_id}")
|
36
|
+
get_workflow_template = @crowdin.get_workflow_template(template_id)
|
37
|
+
expect(get_workflow_template).to eq(200)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,30 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
|
-
SimpleCov.start
|
5
|
-
|
6
4
|
require 'codecov'
|
5
|
+
|
6
|
+
SimpleCov.start
|
7
7
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
8
8
|
|
9
|
+
require 'webmock/rspec'
|
9
10
|
require 'crowdin-api'
|
11
|
+
|
12
|
+
RSpec.shared_context 'crowdin_client_options' do
|
13
|
+
let(:api_token) { 'api_token' }
|
14
|
+
let(:project_id) { 1 }
|
15
|
+
let(:organization_domain) { 'domain' }
|
16
|
+
let(:full_organization_domain) { 'domain.com' }
|
17
|
+
let(:target_api_url) { 'api/v2' }
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.include_context 'crowdin_client_options'
|
22
|
+
|
23
|
+
config.before(:each) do |spec|
|
24
|
+
@crowdin = if spec.metadata[:enterprise]
|
25
|
+
Crowdin::Client.new { |cfg| cfg.organization_domain = organization_domain }
|
26
|
+
else # default
|
27
|
+
Crowdin::Client.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe 'Crowdin Client' do
|
4
|
+
it 'should have a list of API Resources' do
|
5
|
+
expect(Crowdin::API_RESOURCES_MODULES).to_not be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should have a list of Error Raisers' do
|
9
|
+
expect(Crowdin::ERROR_RAISERS_MODULES).to_not be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should have a version' do
|
13
|
+
expect(Crowdin::Client::VERSION).to_not be_nil
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'Crowdin Client with a default options' do
|
17
|
+
it 'should have a RestClient connection', :default do
|
18
|
+
expect(@crowdin.connection.class).to eq(RestClient::Resource)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have options and headers for RestClient', :default do
|
22
|
+
expect(@crowdin.options.class).to eq(Hash)
|
23
|
+
expect(@crowdin.options).to include(:headers)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should have a Config instance', :default do
|
27
|
+
expect(@crowdin.config.class).to eq(Crowdin::Configuration)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should have a disabled Logger by default', :default do
|
31
|
+
expect(@crowdin.logger_enabled?).to be_falsey
|
32
|
+
expect(@crowdin.logger).to be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have a disabled Enterprise mode by default', :default do
|
36
|
+
expect(@crowdin.enterprise_mode?).to be_falsey
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have a default target api url', :default do
|
40
|
+
expect(@crowdin.config.target_api_url).to eq('/api/v2')
|
41
|
+
end
|
42
|
+
it 'should have a default base url', :default do
|
43
|
+
expect(@crowdin.config.base_url).to eq('https://api.crowdin.com')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'Crowdin Client with enabled Logger' do
|
48
|
+
before do
|
49
|
+
@crowdin = Crowdin::Client.new do |config|
|
50
|
+
config.enable_logger = true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should have a Logger instance' do
|
55
|
+
expect(@crowdin.logger_enabled?).to be_truthy
|
56
|
+
expect(@crowdin.logger.class).to eq(Logger)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe 'Crowdin Client with enabled Enterprise mode' do
|
61
|
+
before do
|
62
|
+
@crowdin = Crowdin::Client.new do |config|
|
63
|
+
config.organization_domain = organization_domain
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should have a generated Enterprise url' do
|
68
|
+
expect(@crowdin.enterprise_mode?).to be_truthy
|
69
|
+
expect(@crowdin.config.base_url).to eq("https://#{organization_domain}.api.crowdin.com")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'Crowdin Client with enabled Enterprise mode and specified full organization domain' do
|
74
|
+
before do
|
75
|
+
@crowdin = Crowdin::Client.new do |config|
|
76
|
+
config.organization_domain = full_organization_domain
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should have a generated Enterprise url' do
|
81
|
+
expect(@crowdin.enterprise_mode?).to be_truthy
|
82
|
+
expect(@crowdin.config.base_url).to eq("https://#{full_organization_domain}")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crowdin-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Crowdin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: open-uri
|
@@ -84,6 +84,20 @@ dependencies:
|
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: 0.6.0
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: pry
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - "~>"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 0.14.1
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - "~>"
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: 0.14.1
|
87
101
|
- !ruby/object:Gem::Dependency
|
88
102
|
name: rake
|
89
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -132,20 +146,6 @@ dependencies:
|
|
132
146
|
- - "~>"
|
133
147
|
- !ruby/object:Gem::Version
|
134
148
|
version: '1.23'
|
135
|
-
- !ruby/object:Gem::Dependency
|
136
|
-
name: sinatra
|
137
|
-
requirement: !ruby/object:Gem::Requirement
|
138
|
-
requirements:
|
139
|
-
- - "~>"
|
140
|
-
- !ruby/object:Gem::Version
|
141
|
-
version: '2.1'
|
142
|
-
type: :development
|
143
|
-
prerelease: false
|
144
|
-
version_requirements: !ruby/object:Gem::Requirement
|
145
|
-
requirements:
|
146
|
-
- - "~>"
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '2.1'
|
149
149
|
- !ruby/object:Gem::Dependency
|
150
150
|
name: webmock
|
151
151
|
requirement: !ruby/object:Gem::Requirement
|
@@ -182,42 +182,66 @@ files:
|
|
182
182
|
- README.md
|
183
183
|
- Rakefile
|
184
184
|
- bin/crowdin-console
|
185
|
-
- bin/setup
|
186
185
|
- crowdin-api.gemspec
|
187
186
|
- lib/crowdin-api.rb
|
188
|
-
- lib/crowdin-api/
|
189
|
-
- lib/crowdin-api/
|
190
|
-
- lib/crowdin-api/
|
191
|
-
- lib/crowdin-api/
|
192
|
-
- lib/crowdin-api/
|
193
|
-
- lib/crowdin-api/
|
194
|
-
- lib/crowdin-api/
|
195
|
-
- lib/crowdin-api/
|
196
|
-
- lib/crowdin-api/
|
197
|
-
- lib/crowdin-api/
|
198
|
-
- lib/crowdin-api/
|
199
|
-
- lib/crowdin-api/
|
200
|
-
- lib/crowdin-api/
|
201
|
-
- lib/crowdin-api/
|
202
|
-
- lib/crowdin-api/
|
203
|
-
- lib/crowdin-api/
|
204
|
-
- lib/crowdin-api/
|
205
|
-
- lib/crowdin-api/
|
206
|
-
- lib/crowdin-api/
|
207
|
-
- lib/crowdin-api/
|
208
|
-
- lib/crowdin-api/
|
209
|
-
- lib/crowdin-api/
|
210
|
-
- lib/crowdin-api/
|
187
|
+
- lib/crowdin-api/api_resources/bundles.rb
|
188
|
+
- lib/crowdin-api/api_resources/dictionaries.rb
|
189
|
+
- lib/crowdin-api/api_resources/distributions.rb
|
190
|
+
- lib/crowdin-api/api_resources/glossaries.rb
|
191
|
+
- lib/crowdin-api/api_resources/labels.rb
|
192
|
+
- lib/crowdin-api/api_resources/languages.rb
|
193
|
+
- lib/crowdin-api/api_resources/machine_translation_engines.rb
|
194
|
+
- lib/crowdin-api/api_resources/projects.rb
|
195
|
+
- lib/crowdin-api/api_resources/reports.rb
|
196
|
+
- lib/crowdin-api/api_resources/screenshots.rb
|
197
|
+
- lib/crowdin-api/api_resources/source_files.rb
|
198
|
+
- lib/crowdin-api/api_resources/source_strings.rb
|
199
|
+
- lib/crowdin-api/api_resources/storages.rb
|
200
|
+
- lib/crowdin-api/api_resources/string_comments.rb
|
201
|
+
- lib/crowdin-api/api_resources/string_translations.rb
|
202
|
+
- lib/crowdin-api/api_resources/tasks.rb
|
203
|
+
- lib/crowdin-api/api_resources/teams.rb
|
204
|
+
- lib/crowdin-api/api_resources/translation_memory.rb
|
205
|
+
- lib/crowdin-api/api_resources/translation_status.rb
|
206
|
+
- lib/crowdin-api/api_resources/translations.rb
|
207
|
+
- lib/crowdin-api/api_resources/users.rb
|
208
|
+
- lib/crowdin-api/api_resources/vendors.rb
|
209
|
+
- lib/crowdin-api/api_resources/webhooks.rb
|
210
|
+
- lib/crowdin-api/api_resources/workflows.rb
|
211
211
|
- lib/crowdin-api/client/client.rb
|
212
212
|
- lib/crowdin-api/client/configuration.rb
|
213
213
|
- lib/crowdin-api/client/version.rb
|
214
214
|
- lib/crowdin-api/core/errors.rb
|
215
215
|
- lib/crowdin-api/core/errors_raisers.rb
|
216
|
+
- lib/crowdin-api/core/fetch_all_extensions.rb
|
216
217
|
- lib/crowdin-api/core/request.rb
|
217
|
-
- lib/crowdin-api/core/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
218
|
+
- lib/crowdin-api/core/send_request.rb
|
219
|
+
- spec/api_resources/bundles_spec.rb
|
220
|
+
- spec/api_resources/dictionaries_spec.rb
|
221
|
+
- spec/api_resources/distributions_spec.rb
|
222
|
+
- spec/api_resources/glossaries_spec.rb
|
223
|
+
- spec/api_resources/labels_spec.rb
|
224
|
+
- spec/api_resources/languages_spec.rb
|
225
|
+
- spec/api_resources/machine_translation_engines_spec.rb
|
226
|
+
- spec/api_resources/projects_spec.rb
|
227
|
+
- spec/api_resources/reports_spec.rb
|
228
|
+
- spec/api_resources/screenshots_spec.rb
|
229
|
+
- spec/api_resources/source_files_spec.rb
|
230
|
+
- spec/api_resources/source_strings_spec.rb
|
231
|
+
- spec/api_resources/storages_spec.rb
|
232
|
+
- spec/api_resources/string_comments_spec.rb
|
233
|
+
- spec/api_resources/string_translations_spec.rb
|
234
|
+
- spec/api_resources/tasks_spec.rb
|
235
|
+
- spec/api_resources/teams_spec.rb
|
236
|
+
- spec/api_resources/translation_memory_spec.rb
|
237
|
+
- spec/api_resources/translation_status_spec.rb
|
238
|
+
- spec/api_resources/translations_spec.rb
|
239
|
+
- spec/api_resources/users_spec.rb
|
240
|
+
- spec/api_resources/vendors_spec.rb
|
241
|
+
- spec/api_resources/webhooks_spec.rb
|
242
|
+
- spec/api_resources/workflows_spec.rb
|
220
243
|
- spec/spec_helper.rb
|
244
|
+
- spec/unit/client_spec.rb
|
221
245
|
homepage: https://github.com/crowdin/crowdin-api-client-ruby
|
222
246
|
licenses:
|
223
247
|
- MIT
|