crowdin-api 1.14.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -0
  3. data/.rubocop_todo.yml +1 -0
  4. data/AGENTS.md +63 -0
  5. data/CLAUDE.md +1 -0
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/lib/crowdin-api/api_resources/advisor.rb +86 -0
  9. data/lib/crowdin-api/api_resources/ai.rb +974 -0
  10. data/lib/crowdin-api/api_resources/applications.rb +247 -10
  11. data/lib/crowdin-api/api_resources/bundles.rb +45 -29
  12. data/lib/crowdin-api/api_resources/clients.rb +23 -0
  13. data/lib/crowdin-api/api_resources/custom_spellcheckers.rb +36 -0
  14. data/lib/crowdin-api/api_resources/dictionaries.rb +5 -5
  15. data/lib/crowdin-api/api_resources/distributions.rb +15 -15
  16. data/lib/crowdin-api/api_resources/external_qa_checks.rb +36 -0
  17. data/lib/crowdin-api/api_resources/fields.rb +78 -0
  18. data/lib/crowdin-api/api_resources/glossaries.rb +62 -50
  19. data/lib/crowdin-api/api_resources/integrations.rb +201 -0
  20. data/lib/crowdin-api/api_resources/labels.rb +32 -0
  21. data/lib/crowdin-api/api_resources/languages.rb +16 -0
  22. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +17 -0
  23. data/lib/crowdin-api/api_resources/notifications.rb +15 -6
  24. data/lib/crowdin-api/api_resources/organization.rb +33 -0
  25. data/lib/crowdin-api/api_resources/organization_webhooks.rb +71 -0
  26. data/lib/crowdin-api/api_resources/placeholders.rb +182 -0
  27. data/lib/crowdin-api/api_resources/projects.rb +137 -41
  28. data/lib/crowdin-api/api_resources/reports.rb +310 -26
  29. data/lib/crowdin-api/api_resources/screenshots.rb +48 -0
  30. data/lib/crowdin-api/api_resources/security_logs.rb +63 -0
  31. data/lib/crowdin-api/api_resources/source_files.rb +370 -65
  32. data/lib/crowdin-api/api_resources/source_strings.rb +62 -0
  33. data/lib/crowdin-api/api_resources/storages.rb +11 -11
  34. data/lib/crowdin-api/api_resources/string_comments.rb +46 -0
  35. data/lib/crowdin-api/api_resources/string_corrections.rb +21 -6
  36. data/lib/crowdin-api/api_resources/string_translations.rb +96 -0
  37. data/lib/crowdin-api/api_resources/style_guides.rb +71 -0
  38. data/lib/crowdin-api/api_resources/tasks.rb +140 -10
  39. data/lib/crowdin-api/api_resources/teams.rb +99 -0
  40. data/lib/crowdin-api/api_resources/translation_memory.rb +138 -0
  41. data/lib/crowdin-api/api_resources/translation_status.rb +65 -0
  42. data/lib/crowdin-api/api_resources/translations.rb +122 -2
  43. data/lib/crowdin-api/api_resources/users.rb +136 -6
  44. data/lib/crowdin-api/api_resources/vendors.rb +2 -0
  45. data/lib/crowdin-api/api_resources/webhooks.rb +16 -0
  46. data/lib/crowdin-api/api_resources/workflows.rb +24 -0
  47. data/lib/crowdin-api/client/version.rb +1 -1
  48. data/lib/crowdin-api/core/request.rb +1 -1
  49. data/lib/crowdin-api.rb +3 -1
  50. data/spec/api_resources/advisor_spec.rb +45 -0
  51. data/spec/api_resources/ai_spec.rb +863 -0
  52. data/spec/api_resources/applications_spec.rb +138 -0
  53. data/spec/api_resources/bundles_spec.rb +8 -0
  54. data/spec/api_resources/clients_spec.rb +13 -0
  55. data/spec/api_resources/custom_spellcheckers_spec.rb +21 -0
  56. data/spec/api_resources/external_qa_checks_spec.rb +21 -0
  57. data/spec/api_resources/fields_spec.rb +45 -0
  58. data/spec/api_resources/glossaries_spec.rb +18 -0
  59. data/spec/api_resources/integrations_spec.rb +117 -0
  60. data/spec/api_resources/organization_spec.rb +21 -0
  61. data/spec/api_resources/organization_webhooks_spec.rb +45 -0
  62. data/spec/api_resources/placeholders_spec.rb +103 -0
  63. data/spec/api_resources/projects_spec.rb +58 -0
  64. data/spec/api_resources/reports_spec.rb +221 -0
  65. data/spec/api_resources/security_logs_spec.rb +39 -0
  66. data/spec/api_resources/source_files_spec.rb +182 -0
  67. data/spec/api_resources/source_strings_spec.rb +26 -0
  68. data/spec/api_resources/string_comments_spec.rb +18 -0
  69. data/spec/api_resources/string_corrections_spec.rb +25 -19
  70. data/spec/api_resources/string_translations_spec.rb +26 -0
  71. data/spec/api_resources/style_guides_spec.rb +45 -0
  72. data/spec/api_resources/tasks_spec.rb +60 -0
  73. data/spec/api_resources/teams_spec.rb +42 -0
  74. data/spec/api_resources/translation_memory_spec.rb +58 -0
  75. data/spec/api_resources/translation_status_spec.rb +26 -0
  76. data/spec/api_resources/translations_spec.rb +42 -0
  77. data/spec/api_resources/users_spec.rb +84 -0
  78. data/spec/api_resources/workflows_spec.rb +10 -0
  79. metadata +27 -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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Crowdin
4
4
  class Client
5
- VERSION = '1.14.0'
5
+ VERSION = '1.15.0'
6
6
  end
7
7
  end
@@ -26,7 +26,7 @@ module Crowdin
26
26
  end
27
27
 
28
28
  def delete
29
- connection.delete(prepare_payload(payload[:params]))
29
+ connection.delete(prepare_payload(payload[:params]).merge(payload[:headers]))
30
30
  end
31
31
 
32
32
  def process_with_body
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].freeze
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
@@ -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