crowdin-api 1.13.0 → 1.15.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.yml +4 -0
- data/.rubocop_todo.yml +1 -0
- data/AGENTS.md +63 -0
- data/CLAUDE.md +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +23 -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 +252 -15
- 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/client.rb +3 -8
- data/lib/crowdin-api/client/version.rb +1 -1
- data/lib/crowdin-api/core/graphql_extensions.rb +22 -0
- data/lib/crowdin-api/core/request.rb +1 -1
- data/lib/crowdin-api.rb +4 -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
- data/spec/unit/client_spec.rb +47 -0
- metadata +28 -1
|
@@ -5,6 +5,8 @@ module Crowdin
|
|
|
5
5
|
module Workflows
|
|
6
6
|
# -- For Enterprise mode only --
|
|
7
7
|
|
|
8
|
+
# @param query [Hash] Request Query Parameters
|
|
9
|
+
# * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.workflow-steps.getMany Enterprise API Documentation}
|
|
8
10
|
def list_workflow_steps(query = {}, project_id = config.project_id)
|
|
9
11
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
|
10
12
|
project_id || raise_project_id_is_required_error
|
|
@@ -18,6 +20,8 @@ module Crowdin
|
|
|
18
20
|
Web::SendRequest.new(request).perform
|
|
19
21
|
end
|
|
20
22
|
|
|
23
|
+
# @param step_id [Integer] Workflow Step Identifier
|
|
24
|
+
# * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.workflow-steps.get Enterprise API Documentation}
|
|
21
25
|
def get_workflow_step(step_id = nil, project_id = config.project_id)
|
|
22
26
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
|
23
27
|
step_id || raise_parameter_is_required_error(:step_id)
|
|
@@ -31,6 +35,8 @@ module Crowdin
|
|
|
31
35
|
Web::SendRequest.new(request).perform
|
|
32
36
|
end
|
|
33
37
|
|
|
38
|
+
# @param query [Hash] Request Query Parameters
|
|
39
|
+
# * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.workflow-templates.getMany Enterprise API Documentation}
|
|
34
40
|
def list_workflow_templates(query = {})
|
|
35
41
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
|
36
42
|
|
|
@@ -43,6 +49,8 @@ module Crowdin
|
|
|
43
49
|
Web::SendRequest.new(request).perform
|
|
44
50
|
end
|
|
45
51
|
|
|
52
|
+
# @param template_id [Integer] Workflow Template Identifier
|
|
53
|
+
# * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.workflow-templates.get Enterprise API Documentation}
|
|
46
54
|
def get_workflow_template(template_id = nil)
|
|
47
55
|
enterprise_mode? || raise_only_for_enterprise_mode_error
|
|
48
56
|
template_id || raise_parameter_is_required_error(:template_id)
|
|
@@ -54,6 +62,22 @@ module Crowdin
|
|
|
54
62
|
)
|
|
55
63
|
Web::SendRequest.new(request).perform
|
|
56
64
|
end
|
|
65
|
+
|
|
66
|
+
# @param step_id [Integer] Workflow Step Identifier
|
|
67
|
+
# @param query [Hash] Request Query Parameters
|
|
68
|
+
# * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.workflow-steps.strings.getMany Enterprise API Documentation}
|
|
69
|
+
def list_workflow_step_strings(step_id, query = {}, project_id = config.project_id)
|
|
70
|
+
enterprise_mode? || raise_only_for_enterprise_mode_error
|
|
71
|
+
project_id || raise_project_id_is_required_error
|
|
72
|
+
|
|
73
|
+
request = Web::Request.new(
|
|
74
|
+
connection,
|
|
75
|
+
:get,
|
|
76
|
+
"#{config.target_api_url}/projects/#{project_id}/workflow-steps/#{step_id}/strings",
|
|
77
|
+
{ params: query }
|
|
78
|
+
)
|
|
79
|
+
Web::SendRequest.new(request).perform
|
|
80
|
+
end
|
|
57
81
|
end
|
|
58
82
|
end
|
|
59
83
|
end
|
|
@@ -31,15 +31,10 @@ module Crowdin
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
include Web::FetchAllExtensions
|
|
34
|
+
include Web::GraphqlExtensions
|
|
34
35
|
|
|
35
|
-
#
|
|
36
|
-
attr_reader :config
|
|
37
|
-
# Instance with established connection through RestClient to the Crowdin API
|
|
38
|
-
attr_reader :connection
|
|
39
|
-
# Instance with options and headers for RestClient connection
|
|
40
|
-
attr_reader :options
|
|
41
|
-
# Logger instance
|
|
42
|
-
attr_reader :logger
|
|
36
|
+
# Client configuration, connection, request options, and logger instances
|
|
37
|
+
attr_reader :config, :connection, :options, :logger
|
|
43
38
|
|
|
44
39
|
def initialize(&block)
|
|
45
40
|
build_configuration(&block)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Crowdin
|
|
4
|
+
module Web
|
|
5
|
+
module GraphqlExtensions
|
|
6
|
+
def graphql(query = nil, **request_options)
|
|
7
|
+
url = request_options.delete(:url)
|
|
8
|
+
graphql_query = query || request_options
|
|
9
|
+
|
|
10
|
+
response = ::RestClient::Request.execute(
|
|
11
|
+
{
|
|
12
|
+
method: :post,
|
|
13
|
+
url: url || "#{config.base_url}/api/graphql",
|
|
14
|
+
payload: graphql_query.to_json
|
|
15
|
+
}.merge(options)
|
|
16
|
+
) { |res, _, _| res }
|
|
17
|
+
|
|
18
|
+
response.body.empty? ? response.code : JSON.parse(response.body)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/crowdin-api.rb
CHANGED
|
@@ -6,7 +6,9 @@ module Crowdin
|
|
|
6
6
|
StringTranslations StringComments Screenshots Glossaries TranslationMemory
|
|
7
7
|
MachineTranslationEngines Reports Tasks Users Teams Vendors Webhooks
|
|
8
8
|
Dictionaries Distributions Labels TranslationStatus Bundles Notifications
|
|
9
|
-
Applications StringCorrections
|
|
9
|
+
Applications StringCorrections Ai Advisor Integrations
|
|
10
|
+
OrganizationWebhooks Placeholders SecurityLogs StyleGuides Clients CustomSpellcheckers
|
|
11
|
+
ExternalQaChecks Fields Organization].freeze
|
|
10
12
|
|
|
11
13
|
# Error Raisers modules
|
|
12
14
|
ERROR_RAISERS_MODULES = %i[ApiErrorsRaiser ClientErrorsRaiser].freeze
|
|
@@ -23,6 +25,7 @@ require 'crowdin-api/core/errors_raisers'
|
|
|
23
25
|
require 'crowdin-api/core/request'
|
|
24
26
|
require 'crowdin-api/core/send_request'
|
|
25
27
|
require 'crowdin-api/core/fetch_all_extensions'
|
|
28
|
+
require 'crowdin-api/core/graphql_extensions'
|
|
26
29
|
|
|
27
30
|
# API modules
|
|
28
31
|
Crowdin::API_RESOURCES_MODULES.each do |api_resource|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
describe Crowdin::ApiResources::Advisor do
|
|
4
|
+
describe 'Default endpoints' do
|
|
5
|
+
describe '#create_advisor_check' do
|
|
6
|
+
it 'when request are valid', :default do
|
|
7
|
+
stub_request(:post, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/advisors/checks")
|
|
8
|
+
result = @crowdin.create_advisor_check({}, project_id)
|
|
9
|
+
expect(result).to eq(200)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '#get_advisor_check_status' do
|
|
14
|
+
it 'when request are valid', :default do
|
|
15
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/advisors/checks/1")
|
|
16
|
+
result = @crowdin.get_advisor_check_status(1, project_id)
|
|
17
|
+
expect(result).to eq(200)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe '#list_advisor_insights' do
|
|
22
|
+
it 'when request are valid', :default do
|
|
23
|
+
stub_request(:get, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/advisors/insights")
|
|
24
|
+
result = @crowdin.list_advisor_insights({}, project_id)
|
|
25
|
+
expect(result).to eq(200)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
describe '#edit_advisor_insight' do
|
|
30
|
+
it 'when request are valid', :default do
|
|
31
|
+
stub_request(:patch, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/advisors/insights/1")
|
|
32
|
+
result = @crowdin.edit_advisor_insight(1, [], project_id)
|
|
33
|
+
expect(result).to eq(200)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe '#create_or_update_application_advisor_insight' do
|
|
38
|
+
it 'when request are valid', :default do
|
|
39
|
+
stub_request(:put, "https://api.crowdin.com/#{target_api_url}/projects/#{project_id}/applications/1/modules/1/advisors/insights")
|
|
40
|
+
result = @crowdin.create_or_update_application_advisor_insight(1, 1, {}, project_id)
|
|
41
|
+
expect(result).to eq(200)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|