crowdin-api 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +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,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,27 @@
|
|
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 = Crowdin::Client.new { |cfg| cfg.organization_domain = 'domain' } if spec.metadata[:enterprise]
|
25
|
+
@crowdin = Crowdin::Client.new if spec.metadata[:default]
|
26
|
+
end
|
27
|
+
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.3.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-05-13 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,63 @@ 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/dictionaries.rb
|
188
|
+
- lib/crowdin-api/api_resources/distributions.rb
|
189
|
+
- lib/crowdin-api/api_resources/glossaries.rb
|
190
|
+
- lib/crowdin-api/api_resources/labels.rb
|
191
|
+
- lib/crowdin-api/api_resources/languages.rb
|
192
|
+
- lib/crowdin-api/api_resources/machine_translation_engines.rb
|
193
|
+
- lib/crowdin-api/api_resources/projects.rb
|
194
|
+
- lib/crowdin-api/api_resources/reports.rb
|
195
|
+
- lib/crowdin-api/api_resources/screenshots.rb
|
196
|
+
- lib/crowdin-api/api_resources/source_files.rb
|
197
|
+
- lib/crowdin-api/api_resources/source_strings.rb
|
198
|
+
- lib/crowdin-api/api_resources/storages.rb
|
199
|
+
- lib/crowdin-api/api_resources/string_comments.rb
|
200
|
+
- lib/crowdin-api/api_resources/string_translations.rb
|
201
|
+
- lib/crowdin-api/api_resources/tasks.rb
|
202
|
+
- lib/crowdin-api/api_resources/teams.rb
|
203
|
+
- lib/crowdin-api/api_resources/translation_memory.rb
|
204
|
+
- lib/crowdin-api/api_resources/translation_status.rb
|
205
|
+
- lib/crowdin-api/api_resources/translations.rb
|
206
|
+
- lib/crowdin-api/api_resources/users.rb
|
207
|
+
- lib/crowdin-api/api_resources/vendors.rb
|
208
|
+
- lib/crowdin-api/api_resources/webhooks.rb
|
209
|
+
- lib/crowdin-api/api_resources/workflows.rb
|
211
210
|
- lib/crowdin-api/client/client.rb
|
212
211
|
- lib/crowdin-api/client/configuration.rb
|
213
212
|
- lib/crowdin-api/client/version.rb
|
214
213
|
- lib/crowdin-api/core/errors.rb
|
215
214
|
- lib/crowdin-api/core/errors_raisers.rb
|
216
215
|
- lib/crowdin-api/core/request.rb
|
217
|
-
- lib/crowdin-api/core/
|
218
|
-
- spec/
|
219
|
-
- spec/
|
216
|
+
- lib/crowdin-api/core/send_request.rb
|
217
|
+
- spec/api_resources/dictionaries_spec.rb
|
218
|
+
- spec/api_resources/distributions_spec.rb
|
219
|
+
- spec/api_resources/glossaries_spec.rb
|
220
|
+
- spec/api_resources/labels_spec.rb
|
221
|
+
- spec/api_resources/languages_spec.rb
|
222
|
+
- spec/api_resources/machine_translation_engines_spec.rb
|
223
|
+
- spec/api_resources/projects_spec.rb
|
224
|
+
- spec/api_resources/reports_spec.rb
|
225
|
+
- spec/api_resources/screenshots_spec.rb
|
226
|
+
- spec/api_resources/source_files_spec.rb
|
227
|
+
- spec/api_resources/source_strings_spec.rb
|
228
|
+
- spec/api_resources/storages_spec.rb
|
229
|
+
- spec/api_resources/string_comments_spec.rb
|
230
|
+
- spec/api_resources/string_translations_spec.rb
|
231
|
+
- spec/api_resources/tasks_spec.rb
|
232
|
+
- spec/api_resources/teams_spec.rb
|
233
|
+
- spec/api_resources/translation_memory_spec.rb
|
234
|
+
- spec/api_resources/translation_status_spec.rb
|
235
|
+
- spec/api_resources/translations_spec.rb
|
236
|
+
- spec/api_resources/users_spec.rb
|
237
|
+
- spec/api_resources/vendors_spec.rb
|
238
|
+
- spec/api_resources/webhooks_spec.rb
|
239
|
+
- spec/api_resources/workflows_spec.rb
|
220
240
|
- spec/spec_helper.rb
|
241
|
+
- spec/unit/client_spec.rb
|
221
242
|
homepage: https://github.com/crowdin/crowdin-api-client-ruby
|
222
243
|
licenses:
|
223
244
|
- MIT
|
data/bin/setup
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Crowdin
|
4
|
-
module ApiResources
|
5
|
-
module Languages
|
6
|
-
def list_languages(query = {})
|
7
|
-
request = Web::Request.new(
|
8
|
-
self,
|
9
|
-
:get,
|
10
|
-
'/languages',
|
11
|
-
query
|
12
|
-
)
|
13
|
-
|
14
|
-
request.perform
|
15
|
-
end
|
16
|
-
|
17
|
-
#
|
18
|
-
# Add custom language.
|
19
|
-
#
|
20
|
-
# === Parameters
|
21
|
-
#
|
22
|
-
# * +:name+ [String] - Language name
|
23
|
-
# * +:code+ [String] - Custom language code
|
24
|
-
# * +:localeCode+ [String] - Custom language locale code
|
25
|
-
# * +:textDirection+ [String ltr/rtl] - Text direction in custom language
|
26
|
-
# * +:pluralCategoryNames+ [String] - Array with category names
|
27
|
-
# * +:threeLettersCode+ [String] - Custom language 3 letters code. Format: ISO 6393 code
|
28
|
-
#
|
29
|
-
# === Example
|
30
|
-
#
|
31
|
-
# crowdin.add_custom_language(name: 'your_name', code: 'your_code' ..)
|
32
|
-
#
|
33
|
-
def add_custom_language(query = {})
|
34
|
-
request = Web::Request.new(
|
35
|
-
self,
|
36
|
-
:post,
|
37
|
-
'/languages',
|
38
|
-
query
|
39
|
-
)
|
40
|
-
|
41
|
-
request.perform
|
42
|
-
end
|
43
|
-
|
44
|
-
def get_language(language_id = nil)
|
45
|
-
language_id || raise_parameter_is_required_error(:language_id)
|
46
|
-
|
47
|
-
request = Web::Request.new(
|
48
|
-
self,
|
49
|
-
:get,
|
50
|
-
"/languages/#{language_id}"
|
51
|
-
)
|
52
|
-
|
53
|
-
request.perform
|
54
|
-
end
|
55
|
-
|
56
|
-
def delete_custom_language(language_id = nil)
|
57
|
-
language_id || raise_parameter_is_required_error(:language_id)
|
58
|
-
|
59
|
-
request = Web::Request.new(
|
60
|
-
self,
|
61
|
-
:delete,
|
62
|
-
"/languages/#{language_id}"
|
63
|
-
)
|
64
|
-
|
65
|
-
request.perform
|
66
|
-
end
|
67
|
-
|
68
|
-
def edit_custom_language(language_id = nil)
|
69
|
-
language_id || raise_parameter_is_required_error(:language_id)
|
70
|
-
|
71
|
-
request = Web::Request.new(
|
72
|
-
self,
|
73
|
-
:patch,
|
74
|
-
"/languages/#{language_id}",
|
75
|
-
query
|
76
|
-
)
|
77
|
-
|
78
|
-
request.perform
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Crowdin
|
4
|
-
module ApiResources
|
5
|
-
# -- For Enterprise mode only --
|
6
|
-
module MachineTranslationEngines
|
7
|
-
def list_mts(query = {})
|
8
|
-
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
9
|
-
|
10
|
-
request = Web::Request.new(
|
11
|
-
self,
|
12
|
-
:get,
|
13
|
-
'/mts',
|
14
|
-
query
|
15
|
-
)
|
16
|
-
|
17
|
-
request.perform
|
18
|
-
end
|
19
|
-
|
20
|
-
def add_mt(query = {})
|
21
|
-
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
22
|
-
|
23
|
-
request = Web::Request.new(
|
24
|
-
self,
|
25
|
-
:post,
|
26
|
-
'/mts',
|
27
|
-
query
|
28
|
-
)
|
29
|
-
|
30
|
-
request.perform
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_mt(mt_id = nil)
|
34
|
-
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
35
|
-
mt_id || raise_parameter_is_required_error(:mt_id)
|
36
|
-
|
37
|
-
request = Web::Request.new(
|
38
|
-
self,
|
39
|
-
:get,
|
40
|
-
"/mts/#{mt_id}"
|
41
|
-
)
|
42
|
-
|
43
|
-
request.perform
|
44
|
-
end
|
45
|
-
|
46
|
-
def delete_mt(mt_id = nil)
|
47
|
-
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
48
|
-
mt_id || raise_parameter_is_required_error(:mt_id)
|
49
|
-
|
50
|
-
request = Web::Request.new(
|
51
|
-
self,
|
52
|
-
:delete,
|
53
|
-
"/mts/#{mt_id}"
|
54
|
-
)
|
55
|
-
|
56
|
-
request.perform
|
57
|
-
end
|
58
|
-
|
59
|
-
def edit_mt(mt_id = nil, query = {})
|
60
|
-
config.enterprise_mode? || raise_only_for_enterprise_mode_error
|
61
|
-
mt_id || raise_parameter_is_required_error(:mt_id)
|
62
|
-
|
63
|
-
request = Web::Request.new(
|
64
|
-
self,
|
65
|
-
:patch,
|
66
|
-
"/mts/#{mt_id}",
|
67
|
-
query
|
68
|
-
)
|
69
|
-
|
70
|
-
request.perform
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|