crowdin-api 1.14.0 → 1.15.1

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +1 -0
  3. data/.rubocop.yml +4 -0
  4. data/.rubocop_todo.yml +1 -0
  5. data/AGENTS.md +63 -0
  6. data/CLAUDE.md +1 -0
  7. data/Gemfile.lock +7 -7
  8. data/README.md +1 -1
  9. data/crowdin-api.gemspec +1 -1
  10. data/lib/crowdin-api/api_resources/advisor.rb +86 -0
  11. data/lib/crowdin-api/api_resources/ai.rb +974 -0
  12. data/lib/crowdin-api/api_resources/applications.rb +247 -10
  13. data/lib/crowdin-api/api_resources/bundles.rb +45 -29
  14. data/lib/crowdin-api/api_resources/clients.rb +23 -0
  15. data/lib/crowdin-api/api_resources/custom_spellcheckers.rb +36 -0
  16. data/lib/crowdin-api/api_resources/dictionaries.rb +5 -5
  17. data/lib/crowdin-api/api_resources/distributions.rb +15 -15
  18. data/lib/crowdin-api/api_resources/external_qa_checks.rb +36 -0
  19. data/lib/crowdin-api/api_resources/fields.rb +78 -0
  20. data/lib/crowdin-api/api_resources/glossaries.rb +62 -50
  21. data/lib/crowdin-api/api_resources/integrations.rb +201 -0
  22. data/lib/crowdin-api/api_resources/labels.rb +32 -0
  23. data/lib/crowdin-api/api_resources/languages.rb +16 -0
  24. data/lib/crowdin-api/api_resources/machine_translation_engines.rb +17 -0
  25. data/lib/crowdin-api/api_resources/notifications.rb +15 -6
  26. data/lib/crowdin-api/api_resources/organization.rb +33 -0
  27. data/lib/crowdin-api/api_resources/organization_webhooks.rb +71 -0
  28. data/lib/crowdin-api/api_resources/placeholders.rb +182 -0
  29. data/lib/crowdin-api/api_resources/projects.rb +137 -41
  30. data/lib/crowdin-api/api_resources/reports.rb +310 -26
  31. data/lib/crowdin-api/api_resources/screenshots.rb +48 -0
  32. data/lib/crowdin-api/api_resources/security_logs.rb +63 -0
  33. data/lib/crowdin-api/api_resources/source_files.rb +370 -65
  34. data/lib/crowdin-api/api_resources/source_strings.rb +62 -0
  35. data/lib/crowdin-api/api_resources/storages.rb +11 -11
  36. data/lib/crowdin-api/api_resources/string_comments.rb +46 -0
  37. data/lib/crowdin-api/api_resources/string_corrections.rb +21 -6
  38. data/lib/crowdin-api/api_resources/string_translations.rb +96 -0
  39. data/lib/crowdin-api/api_resources/style_guides.rb +71 -0
  40. data/lib/crowdin-api/api_resources/tasks.rb +140 -10
  41. data/lib/crowdin-api/api_resources/teams.rb +99 -0
  42. data/lib/crowdin-api/api_resources/translation_memory.rb +138 -0
  43. data/lib/crowdin-api/api_resources/translation_status.rb +65 -0
  44. data/lib/crowdin-api/api_resources/translations.rb +122 -2
  45. data/lib/crowdin-api/api_resources/users.rb +136 -6
  46. data/lib/crowdin-api/api_resources/vendors.rb +2 -0
  47. data/lib/crowdin-api/api_resources/webhooks.rb +16 -0
  48. data/lib/crowdin-api/api_resources/workflows.rb +24 -0
  49. data/lib/crowdin-api/client/version.rb +1 -1
  50. data/lib/crowdin-api/core/request.rb +1 -1
  51. data/lib/crowdin-api.rb +3 -1
  52. data/spec/api_resources/advisor_spec.rb +45 -0
  53. data/spec/api_resources/ai_spec.rb +863 -0
  54. data/spec/api_resources/applications_spec.rb +138 -0
  55. data/spec/api_resources/bundles_spec.rb +8 -0
  56. data/spec/api_resources/clients_spec.rb +13 -0
  57. data/spec/api_resources/custom_spellcheckers_spec.rb +21 -0
  58. data/spec/api_resources/external_qa_checks_spec.rb +21 -0
  59. data/spec/api_resources/fields_spec.rb +45 -0
  60. data/spec/api_resources/glossaries_spec.rb +18 -0
  61. data/spec/api_resources/integrations_spec.rb +117 -0
  62. data/spec/api_resources/organization_spec.rb +21 -0
  63. data/spec/api_resources/organization_webhooks_spec.rb +45 -0
  64. data/spec/api_resources/placeholders_spec.rb +103 -0
  65. data/spec/api_resources/projects_spec.rb +58 -0
  66. data/spec/api_resources/reports_spec.rb +221 -0
  67. data/spec/api_resources/security_logs_spec.rb +39 -0
  68. data/spec/api_resources/source_files_spec.rb +182 -0
  69. data/spec/api_resources/source_strings_spec.rb +26 -0
  70. data/spec/api_resources/string_comments_spec.rb +18 -0
  71. data/spec/api_resources/string_corrections_spec.rb +25 -19
  72. data/spec/api_resources/string_translations_spec.rb +26 -0
  73. data/spec/api_resources/style_guides_spec.rb +45 -0
  74. data/spec/api_resources/tasks_spec.rb +60 -0
  75. data/spec/api_resources/teams_spec.rb +42 -0
  76. data/spec/api_resources/translation_memory_spec.rb +58 -0
  77. data/spec/api_resources/translation_status_spec.rb +26 -0
  78. data/spec/api_resources/translations_spec.rb +42 -0
  79. data/spec/api_resources/users_spec.rb +84 -0
  80. data/spec/api_resources/workflows_spec.rb +10 -0
  81. metadata +29 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 98a60b3487c1824a37ef3519089f1e48e7de773f35734a54a981365707bbd80a
4
- data.tar.gz: 0e5642b1b3446d55602f34ec4820b82e5d686e4002df0158371031141480bde1
3
+ metadata.gz: 21f8a0a899fd0d59b872935a464f73a5f0026da44f78e7b62fbc5abb5523b49f
4
+ data.tar.gz: 75f680385d8530a0f9e62f1fd7c8281a7f6e30746cf6ce04338b15cd3278f553
5
5
  SHA512:
6
- metadata.gz: a6ee9691d7ce60578c6438bf58874262edaa4dc8100723a2c9ad56b70828c97367a332401a47b9f098408d48dec4324714d83e5a1f73f3a2d683c829f3dc792f
7
- data.tar.gz: cc3e2fbdc50836e014496c9990be79492817c878a8758b35044e5cecedf670eeed33390fb42ab1d32e5d52b9873344ee88a3fc11942e4a7513a1e3adf66269d5
6
+ metadata.gz: 2a2c397685ef9171d27a06f5dd616b1acce0338d9bc1c216e0bc4b20cfd966a3e431167000f6c3305b613299ad219ae65942f3d672c85c705f8340cbffc74ee7
7
+ data.tar.gz: a918231fc47c1bee0849b9c270c2e27bbf1f0bc72adf10aec3ae3238bd6fb5e17d0b2819868a281cf266a8787cbf33de420268a221f2f90cc561daa2ec1aa828
@@ -21,6 +21,7 @@ jobs:
21
21
 
22
22
  - name: Cleanup the Readme
23
23
  run: |
24
+ sed -i '/<p align="center">/,/<\/p>/d' README.md
24
25
  sed -i /\<div/d README.md
25
26
  sed -i /\<\\/div/d README.md
26
27
 
data/.rubocop.yml CHANGED
@@ -10,3 +10,7 @@ Gemspec/DevelopmentDependencies:
10
10
  Metrics/BlockLength:
11
11
  Exclude:
12
12
  - 'spec/**/*'
13
+
14
+ Metrics/ModuleLength:
15
+ Exclude:
16
+ - 'lib/crowdin-api/api_resources/**/*'
data/.rubocop_todo.yml CHANGED
@@ -119,6 +119,7 @@ Metrics/PerceivedComplexity:
119
119
  # Offense count: 1
120
120
  Naming/AccessorMethodName:
121
121
  Exclude:
122
+ - 'lib/crowdin-api/api_resources/organization.rb'
122
123
  - 'lib/crowdin-api/api_resources/users.rb'
123
124
 
124
125
  # Offense count: 1
data/AGENTS.md ADDED
@@ -0,0 +1,63 @@
1
+ # AGENTS.md
2
+
3
+ Ruby client for the Crowdin API v2 and Crowdin Enterprise API v2 (gem: `crowdin-api`, namespace `Crowdin`).
4
+
5
+ The gemspec requires Ruby >= 2.4 while CI tests 3.0–3.3 — stay conservative with syntax (no pattern matching, no endless methods).
6
+
7
+ ## Layout
8
+
9
+ - `lib/crowdin-api.rb` — entry point; the `API_RESOURCES_MODULES` array plus requires
10
+ - `lib/crowdin-api/client/client.rb` — `Crowdin::Client`; mixes every resource module in
11
+ - `lib/crowdin-api/api_resources/<name>.rb` — one module per API resource, plain instance methods
12
+ - `lib/crowdin-api/core/` — request/response plumbing, errors, `fetch_all`, GraphQL
13
+ - `spec/api_resources/<name>_spec.rb` — 1:1 with resources; WebMock, no fixtures directory
14
+
15
+ ## Commands
16
+
17
+ - Install: `bundle install`
18
+ - Test (all): `bundle exec rspec` (or `bundle exec rake`)
19
+ - Test (one file): `bundle exec rspec spec/api_resources/<name>_spec.rb`
20
+ - Lint (CI runs this before the specs): `bundle exec rubocop`
21
+ - Lint autofix: `bundle exec rubocop -a`
22
+
23
+ ## Adding or changing an endpoint
24
+
25
+ Fetch the endpoint spec first (see Crowdin API reference below). Then:
26
+
27
+ 1. Implement the method in `lib/crowdin-api/api_resources/<snake_case>.rb` (`# frozen_string_literal: true`, then `module Crowdin` > `module ApiResources` > `module <CamelCase>`):
28
+ - Argument order: required path ids, then the `query`/`body` hash, then optional `destination` (file downloads), then `project_id = config.project_id` last. RuboCop caps optional parameters at 4 and this pattern already uses them all.
29
+ - Guards: `project_id || raise_project_id_is_required_error`; Enterprise-only methods start with `enterprise_mode? || raise_only_for_enterprise_mode_error` and sit under a `# -- For Enterprise mode only --` comment.
30
+ - Body: build `Web::Request.new(connection, :get, "#{config.target_api_url}/projects/#{project_id}/...", { params: query })` and return `Web::SendRequest.new(request).perform` (pass `destination` as the second argument to `SendRequest` for downloads).
31
+ - Name list endpoints `list_*` — `fetch_all` refuses anything else (and hard-codes extra args for `list_terms` and `list_file_revisions` in `client.rb`).
32
+ - Doc comment: two `{https://support.crowdin.com/developer/... API Documentation}` links (base and enterprise) plus YARD `@param` lines.
33
+ 2. For a new resource, append the CamelCase symbol to `Crowdin::API_RESOURCES_MODULES` in `lib/crowdin-api.rb`. The file name must be the exact snake_case of that symbol: the require loop swallows `LoadError` silently and a mismatch surfaces later as an unrelated `NameError` from `const_get`. `client.rb` needs no edit — the include loop picks the module up.
34
+ 3. Spec in `spec/api_resources/<snake_case>_spec.rb`: tag examples `:default` or `:enterprise` — `spec_helper.rb` prebuilds `@crowdin` and sets the WebMock host (`https://api.crowdin.com` vs `https://domain.api.crowdin.com`) from the tag. House idiom: `stub_request(...)` with no `.to_return`, then `expect(result).to eq(200)` — `perform` returns the HTTP status for an empty body, a parsed Hash otherwise, and an error String on failure (HTTP errors are returned, not raised).
35
+
36
+ A complete new resource touches exactly 3 files: the resource module, `lib/crowdin-api.rb`, and the spec.
37
+
38
+ ## Crowdin API reference
39
+
40
+ Before implementing or changing any endpoint, fetch its spec from the llms.txt indexes (pick by environment, then project type):
41
+
42
+ - https://support.crowdin.com/_llms-txt/api/crowdin/file-based.txt — Crowdin API, file-based projects (start here)
43
+ - https://support.crowdin.com/_llms-txt/api/crowdin/string-based.txt — Crowdin API, string-based projects
44
+ - https://support.crowdin.com/_llms-txt/api/enterprise/file-based.txt — Crowdin Enterprise API, file-based projects
45
+ - https://support.crowdin.com/_llms-txt/api/enterprise/string-based.txt — Crowdin Enterprise API, string-based projects
46
+
47
+ Each index links one spec file per route (e.g. `.../api.projects.strings.get.txt`) with the exact request and response shapes.
48
+
49
+ ## Conventions
50
+
51
+ - Conventional Commits for commit messages and PR titles; CI lints PR titles.
52
+ - PRs target `main`. CI runs RuboCop before the specs, so a lint failure blocks the test result.
53
+ - Keep the public API backward compatible.
54
+ - Never bump the version by hand — the Release workflow rewrites `lib/crowdin-api/client/version.rb`, the README install line, and `Gemfile.lock` together.
55
+
56
+ ## PR checklist
57
+
58
+ A change is ready when:
59
+
60
+ 1. `bundle exec rubocop` is clean,
61
+ 2. `bundle exec rspec` passes,
62
+ 3. every new or changed endpoint method has a spec (tagged `:default`, plus `:enterprise` where the API differs), and
63
+ 4. every new or changed public method carries the two API documentation links.
data/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ AGENTS.md
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- crowdin-api (1.14.0)
4
+ crowdin-api (1.15.1)
5
5
  open-uri (>= 0.1.0, < 0.2.0)
6
6
  rest-client (>= 2.0.0, < 2.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.6)
12
- public_suffix (>= 2.0.2, < 6.0)
11
+ addressable (2.9.0)
12
+ public_suffix (>= 2.0.2, < 8.0)
13
13
  ast (2.4.2)
14
14
  coderay (1.1.3)
15
15
  crack (0.4.5)
@@ -46,7 +46,7 @@ GEM
46
46
  http-cookie (>= 1.0.2, < 2.0)
47
47
  mime-types (>= 1.16, < 4.0)
48
48
  netrc (~> 0.8)
49
- rexml (3.2.6)
49
+ rexml (3.4.4)
50
50
  rspec (3.13.0)
51
51
  rspec-core (~> 3.13.0)
52
52
  rspec-expectations (~> 3.13.0)
@@ -77,7 +77,7 @@ GEM
77
77
  docile (~> 1.1)
78
78
  simplecov-html (~> 0.11)
79
79
  simplecov_json_formatter (~> 0.1)
80
- simplecov-cobertura (2.1.0)
80
+ simplecov-cobertura (3.2.0)
81
81
  rexml
82
82
  simplecov (~> 0.19)
83
83
  simplecov-html (0.12.3)
@@ -90,7 +90,7 @@ GEM
90
90
  addressable (>= 2.8.0)
91
91
  crack (>= 0.3.2)
92
92
  hashdiff (>= 0.4.0, < 2.0.0)
93
- yard (0.9.36)
93
+ yard (0.9.45)
94
94
 
95
95
  PLATFORMS
96
96
  arm64-darwin-23
@@ -104,7 +104,7 @@ DEPENDENCIES
104
104
  rspec (~> 3.10)
105
105
  rubocop (~> 1.23)
106
106
  simplecov (~> 0.22)
107
- simplecov-cobertura (~> 2.1)
107
+ simplecov-cobertura (~> 3.1)
108
108
  webmock (~> 3.14)
109
109
  yard (~> 0.9.36)
110
110
 
data/README.md CHANGED
@@ -35,7 +35,7 @@ Crowdin API is a full-featured RESTful API that helps you to integrate localizat
35
35
  Add this line to your application's Gemfile:
36
36
 
37
37
  ```gemfile
38
- gem 'crowdin-api', '~> 1.14.0'
38
+ gem 'crowdin-api', '~> 1.15.1'
39
39
  ```
40
40
 
41
41
  And then execute:
data/crowdin-api.gemspec CHANGED
@@ -28,6 +28,6 @@ Gem::Specification.new do |gem|
28
28
  gem.add_development_dependency 'rspec', '~> 3.10'
29
29
  gem.add_development_dependency 'rubocop', '~> 1.23'
30
30
  gem.add_development_dependency 'simplecov', '~> 0.22'
31
- gem.add_development_dependency 'simplecov-cobertura', '~> 2.1'
31
+ gem.add_development_dependency 'simplecov-cobertura', '~> 3.1'
32
32
  gem.add_development_dependency 'webmock', '~> 3.14'
33
33
  end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Crowdin
4
+ module ApiResources
5
+ module Advisor
6
+ # @param body [Hash] Request Body
7
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.advisors.checks.post API Documentation}
8
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.advisors.checks.post Enterprise API Documentation}
9
+ def create_advisor_check(body = {}, project_id = config.project_id)
10
+ project_id || raise_project_id_is_required_error
11
+
12
+ request = Web::Request.new(
13
+ connection,
14
+ :post,
15
+ "#{config.target_api_url}/projects/#{project_id}/advisors/checks",
16
+ { params: body }
17
+ )
18
+ Web::SendRequest.new(request).perform
19
+ end
20
+
21
+ # @param check_id [String] Advisor Check Identifier, consists of 36 characters
22
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.advisors.checks.get API Documentation}
23
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.advisors.checks.get Enterprise API Documentation}
24
+ def get_advisor_check_status(check_id, project_id = config.project_id)
25
+ project_id || raise_project_id_is_required_error
26
+
27
+ request = Web::Request.new(
28
+ connection,
29
+ :get,
30
+ "#{config.target_api_url}/projects/#{project_id}/advisors/checks/#{check_id}"
31
+ )
32
+ Web::SendRequest.new(request).perform
33
+ end
34
+
35
+ # @param query [Hash] Request Query Parameters
36
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.advisors.insights.getMany API Documentation}
37
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.advisors.insights.getMany Enterprise API Documentation}
38
+ def list_advisor_insights(query = {}, project_id = config.project_id)
39
+ project_id || raise_project_id_is_required_error
40
+
41
+ request = Web::Request.new(
42
+ connection,
43
+ :get,
44
+ "#{config.target_api_url}/projects/#{project_id}/advisors/insights",
45
+ { params: query }
46
+ )
47
+ Web::SendRequest.new(request).perform
48
+ end
49
+
50
+ # @param insight_id [Integer] Insight Identifier
51
+ # @param body [Array] Request Body
52
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.advisors.insights.patch API Documentation}
53
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.advisors.insights.patch Enterprise API Documentation}
54
+ def edit_advisor_insight(insight_id, body = [], project_id = config.project_id)
55
+ project_id || raise_project_id_is_required_error
56
+
57
+ request = Web::Request.new(
58
+ connection,
59
+ :patch,
60
+ "#{config.target_api_url}/projects/#{project_id}/advisors/insights/#{insight_id}",
61
+ { params: body }
62
+ )
63
+ Web::SendRequest.new(request).perform
64
+ end
65
+
66
+ # @param application_identifier [String] applicationIdentifier
67
+ # @param module_key [String] moduleKey
68
+ # @param body [Hash] Request Body
69
+ # * {https://support.crowdin.com/developer/api/v2/#operation/api.projects.applications.modules.advisors.insights.put API Documentation}
70
+ # * {https://support.crowdin.com/developer/enterprise/api/v2/#operation/api.projects.applications.modules.advisors.insights.put Enterprise API Documentation}
71
+ def create_or_update_application_advisor_insight(application_identifier, module_key, body = {},
72
+ project_id = config.project_id)
73
+ project_id || raise_project_id_is_required_error
74
+
75
+ endpoint = "projects/#{project_id}/applications/#{application_identifier}/modules/#{module_key}/advisors/insights"
76
+ request = Web::Request.new(
77
+ connection,
78
+ :put,
79
+ "#{config.target_api_url}/#{endpoint}",
80
+ { params: body }
81
+ )
82
+ Web::SendRequest.new(request).perform
83
+ end
84
+ end
85
+ end
86
+ end