deepl-rb 3.10.0 → 4.0.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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +313 -1
  4. data/README.md +225 -309
  5. data/Rakefile +17 -8
  6. data/VERSION +1 -1
  7. data/deepl-rb.gemspec +73 -86
  8. data/lib/deepl/admin_client.rb +39 -14
  9. data/lib/deepl/api.rb +3 -17
  10. data/lib/deepl/app_info.rb +0 -1
  11. data/lib/deepl/client.rb +399 -84
  12. data/lib/deepl/configuration.rb +19 -70
  13. data/lib/deepl/exceptions/authorization_failed.rb +1 -1
  14. data/lib/deepl/exceptions/connection_error.rb +10 -7
  15. data/lib/deepl/exceptions/limit_exceeded.rb +1 -1
  16. data/lib/deepl/exceptions/quota_exceeded.rb +1 -1
  17. data/lib/deepl/exceptions/request_entity_too_large.rb +1 -2
  18. data/lib/deepl/exceptions/request_error.rb +7 -0
  19. data/lib/deepl/exceptions/server_error.rb +2 -1
  20. data/lib/deepl/exceptions/translation_memory_job_error.rb +32 -0
  21. data/lib/deepl/exceptions/validation_error.rb +3 -2
  22. data/lib/deepl/requests/base.rb +129 -51
  23. data/lib/deepl/requests/correct.rb +2 -8
  24. data/lib/deepl/requests/document/upload.rb +29 -26
  25. data/lib/deepl/requests/glossary/base.rb +30 -0
  26. data/lib/deepl/requests/glossary/create.rb +18 -22
  27. data/lib/deepl/requests/glossary/destroy.rb +4 -16
  28. data/lib/deepl/requests/glossary/entries.rb +6 -14
  29. data/lib/deepl/requests/glossary/find.rb +3 -13
  30. data/lib/deepl/requests/glossary/language_pairs.rb +2 -2
  31. data/lib/deepl/requests/glossary/list.rb +2 -2
  32. data/lib/deepl/requests/languages.rb +6 -11
  33. data/lib/deepl/requests/languages_for_resource.rb +2 -0
  34. data/lib/deepl/requests/multilingual_glossary/create.rb +8 -0
  35. data/lib/deepl/requests/multilingual_glossary/destroy_dictionary.rb +4 -0
  36. data/lib/deepl/requests/multilingual_glossary/entries.rb +5 -3
  37. data/lib/deepl/requests/multilingual_glossary/helpers.rb +22 -14
  38. data/lib/deepl/requests/rephrase.rb +3 -1
  39. data/lib/deepl/requests/spoken_terms/create.rb +5 -0
  40. data/lib/deepl/requests/spoken_terms/destroy_term_list.rb +1 -0
  41. data/lib/deepl/requests/spoken_terms/entries.rb +1 -0
  42. data/lib/deepl/requests/spoken_terms/helpers.rb +9 -2
  43. data/lib/deepl/requests/style_profile/create.rb +5 -0
  44. data/lib/deepl/requests/style_profile/list.rb +2 -2
  45. data/lib/deepl/requests/style_rule/create.rb +25 -1
  46. data/lib/deepl/requests/style_rule/create_custom_instruction.rb +7 -0
  47. data/lib/deepl/requests/style_rule/helpers.rb +13 -4
  48. data/lib/deepl/requests/style_rule/list.rb +2 -0
  49. data/lib/deepl/requests/style_rule/update.rb +1 -0
  50. data/lib/deepl/requests/style_rule/update_custom_instruction.rb +2 -0
  51. data/lib/deepl/requests/translate.rb +20 -36
  52. data/lib/deepl/requests/translation_memory/create_export.rb +6 -1
  53. data/lib/deepl/requests/translation_memory/create_import.rb +10 -0
  54. data/lib/deepl/requests/translation_memory/download_export.rb +0 -4
  55. data/lib/deepl/requests/translation_memory/list.rb +2 -2
  56. data/lib/deepl/requests/translation_memory/segments.rb +2 -2
  57. data/lib/deepl/requests/translation_memory/storage_base.rb +5 -9
  58. data/lib/deepl/requests/write_improvements.rb +7 -0
  59. data/lib/deepl/resources/document_handle.rb +1 -26
  60. data/lib/deepl/resources/document_translation_status.rb +0 -12
  61. data/lib/deepl/resources/language.rb +4 -10
  62. data/lib/deepl/resources/multilingual_glossary.rb +4 -4
  63. data/lib/deepl/resources/style_rule.rb +1 -23
  64. data/lib/deepl/resources/translation_memory_job.rb +3 -4
  65. data/lib/deepl/resources/usage.rb +5 -38
  66. data/lib/deepl/utils/client_builder.rb +44 -9
  67. data/lib/deepl/utils/glossary_entries.rb +30 -0
  68. data/lib/deepl/utils/http_client_builder.rb +50 -13
  69. data/lib/deepl/utils/output_path.rb +25 -0
  70. data/lib/deepl/utils/term_validator.rb +3 -3
  71. data/lib/deepl/utils/translation_memory_operations.rb +230 -0
  72. data/lib/deepl.rb +6 -171
  73. data/lib/http_client_options.rb +2 -2
  74. data/lib/version.rb +1 -1
  75. data/upgrading_to_v4.md +374 -0
  76. metadata +9 -50
  77. data/.gitlab-ci.yml +0 -197
  78. data/lib/deepl/deprecation.rb +0 -42
  79. data/lib/deepl/document_api.rb +0 -150
  80. data/lib/deepl/exceptions/not_supported.rb +0 -20
  81. data/lib/deepl/glossary_api.rb +0 -38
  82. data/lib/deepl/style_rule_api.rb +0 -72
  83. data/lib/deepl/translation_memory_api.rb +0 -389
  84. data/license_checker.sh +0 -8
  85. data/spec/fixtures.rb +0 -33
  86. data/spec/offline/admin_client_spec.rb +0 -551
  87. data/spec/offline/client_spec.rb +0 -273
  88. data/spec/offline/configuration_spec.rb +0 -164
  89. data/spec/offline/constants_spec.rb +0 -180
  90. data/spec/offline/correct_text_spec.rb +0 -50
  91. data/spec/offline/deprecation_spec.rb +0 -32
  92. data/spec/offline/errors_spec.rb +0 -92
  93. data/spec/offline/glossaries_spec.rb +0 -98
  94. data/spec/offline/http_client_spec.rb +0 -319
  95. data/spec/offline/languages_spec.rb +0 -155
  96. data/spec/offline/module_methods_spec.rb +0 -13
  97. data/spec/offline/multilingual_glossaries_spec.rb +0 -358
  98. data/spec/offline/offline_helper.rb +0 -71
  99. data/spec/offline/rephrase_text_spec.rb +0 -73
  100. data/spec/offline/spoken_terms_spec.rb +0 -215
  101. data/spec/offline/style_profiles_spec.rb +0 -266
  102. data/spec/offline/style_rules_spec.rb +0 -318
  103. data/spec/offline/translate_document_spec.rb +0 -606
  104. data/spec/offline/translate_text_spec.rb +0 -286
  105. data/spec/offline/translation_memories_client_spec.rb +0 -256
  106. data/spec/offline/translation_memories_spec.rb +0 -463
  107. data/spec/offline/usage_spec.rb +0 -151
  108. data/spec/real_api/admin_client_spec.rb +0 -77
  109. data/spec/real_api/correct_text_spec.rb +0 -20
  110. data/spec/real_api/glossaries_spec.rb +0 -28
  111. data/spec/real_api/languages_spec.rb +0 -27
  112. data/spec/real_api/multilingual_glossaries_spec.rb +0 -53
  113. data/spec/real_api/proxy_spec.rb +0 -41
  114. data/spec/real_api/real_api_helper.rb +0 -65
  115. data/spec/real_api/rephrase_text_spec.rb +0 -16
  116. data/spec/real_api/spoken_terms_spec.rb +0 -56
  117. data/spec/real_api/style_profiles_spec.rb +0 -46
  118. data/spec/real_api/style_rules_spec.rb +0 -46
  119. data/spec/real_api/translate_document_spec.rb +0 -18
  120. data/spec/real_api/translate_text_spec.rb +0 -16
  121. data/spec/real_api/translation_memories_spec.rb +0 -56
  122. data/spec/real_api/usage_spec.rb +0 -20
  123. data/spec/spec_helper.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55285686ffe869d89ccd6e47ad9f205d7877e70322de92a3a2a1c7abd9ccfd19
4
- data.tar.gz: 8db6f78d464b9d5297e1f85003d7922aff67e46514461ede9394dce077972aea
3
+ metadata.gz: 3e58aaed0989a238b2f7a3062b94ec66d426ad9e254021d2c4a14c0c89bbe3c0
4
+ data.tar.gz: 1f89378d339b5ac7aa6c2b4cee8e66eca2a1bd9b5791d0727008a0fe77805cdc
5
5
  SHA512:
6
- metadata.gz: 78ae4eb854f61524d3b1c88ab057ce0947706c0b88a413605bd5a85cabf923a26c3b08874654fcb165294acf9635b6038228aca355c653be2cf572d70d844670
7
- data.tar.gz: d36d518ff006bfd930aee06881768b7d105f5ac55d2c7d43ca1d8d0bd1c9f3044de0d61589e66e7b40baf603a87fdbb7dcba9c46d7b22380e806f402715b0c95
6
+ metadata.gz: f8115cff6a8568a22408ebaeb9b107faa9e3d78a33e3a1c60f5c3b83193482d14ed8bfa1aabe7756ea14213f196f74e892a04cd3026b68ffcda45644796fa2b8
7
+ data.tar.gz: 980567bf7a28d3332d06d7f29c86ac3c0be00a08d3597e1c9ec16e4598da0862f51cb6020631c1a275c193f54d24935a3b29a08a39a6f0254ff52175fff9d4ba
data/.rubocop.yml CHANGED
@@ -9,7 +9,7 @@ AllCops:
9
9
  Exclude:
10
10
  - deepl-rb.gemspec
11
11
  - vendor/**/*
12
- TargetRubyVersion: 2.7.5
12
+ TargetRubyVersion: 3.0
13
13
 
14
14
  Metrics/BlockLength:
15
15
  Exclude:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,317 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [4.0.0] - 2026-11-24
10
+ ### Added
11
+ - Added v2 glossaries to `DeepL::Client`: `create_glossary(name, source_lang, target_lang,
12
+ entries, **options)`, `create_glossary_from_csv(name, source_lang, target_lang, csv,
13
+ **options)`, `list_glossaries`, `get_glossary(glossary)`, `get_glossary_entries(glossary)`,
14
+ `delete_glossary(glossary)` and `get_glossary_languages`. A glossary argument is an ID or a
15
+ `DeepL::Resources::Glossary`; the entries are returned as a hash and `delete_glossary` returns
16
+ `nil`. Please refer to the README for usage instructions.
17
+ - Added the migration guide [Upgrading to 4.0.0](upgrading_to_v4.md), which lists every breaking
18
+ change of this release with before and after code.
19
+
20
+ ### Changed
21
+ - **Breaking:** `DeepL::Client#create_translation_memory_import` and
22
+ `#import_translation_memory_from_filepath` take the keyword `extra_body_parameters:` instead
23
+ of `**options`. Migration: send fields the library does not model with `extra_body_parameters:`;
24
+ any other option raises `ArgumentError`.
25
+ - **Breaking:** Every `DeepL::Client` method that takes options accepts only the options it documents. Any
26
+ other option, also a misspelled one, raises `ArgumentError` naming it before a request is sent.
27
+ Previously, text translation, rephrasing, correction and the glossary, spoken terms, style rule
28
+ and style profile methods sent it as a body field, and document translation and translation
29
+ memory import dropped it. This includes `show_billed_characters` (always sent as `true`) and
30
+ `glossary_id` for text translation. Migration: fix misspelled options, and send fields the
31
+ library does not model with `extra_body_parameters:`.
32
+ - **Breaking:** `DeepL::Resources::Usage#any_limit_reached?` is replaced by `#any_character_limit_reached?`.
33
+ It returns `true` if the account's character limit (`character`) or this API key's character
34
+ limit (`api_key_character`) is reached; the speech minutes are not considered. Migration:
35
+ rename the call; check the speech minute details with `limit_reached?` directly.
36
+ - **Breaking:** Ruby 3.0 or later is now required; the gem declares `required_ruby_version >= 3.0`. Migration:
37
+ on Ruby 2.x, upgrade to Ruby 3.0 or later, or stay on deepl-rb 3.x.
38
+ - **Breaking:** Network failures always raise `DeepL::Exceptions::ConnectionError`, with the original error as
39
+ `cause`; the removed module-level API raised the original error. Migration: rescue
40
+ `DeepL::Exceptions::ConnectionError` (or `DeepL::Exceptions::Error`).
41
+ - **Breaking:** `DeepL::Resources::Language#supports_formality?` returns `nil` for a source language; the
42
+ removed `DeepL.languages` raised `DeepL::Exceptions::NotSupported`. Migration: check for `nil`.
43
+ - **Breaking:** `DeepL::Resources::StyleRule#configured_rules` returns the hash the API sends (category ->
44
+ rule -> value, string keys) instead of a `DeepL::Resources::ConfiguredRules` object, so
45
+ categories beyond the seven fixed readers are kept and absent categories are not filled with
46
+ `{}`. Migration: replace `configured_rules.numbers` with
47
+ `configured_rules.fetch('numbers', {})`, likewise for the other categories.
48
+ - **Breaking:** `DeepL::Resources::TranslationMemoryJob#finished?` (and `TranslationMemoryJobResult#finished?`)
49
+ is `false` for the status `downloaded`, which the API does not send, so
50
+ `wait_until_translation_memory_job_done` keeps polling on it instead of returning the job.
51
+ Migration: none for jobs the API returns; code that built a job with status `downloaded` itself
52
+ should use `completed`.
53
+ - **Breaking:** Requests that create a resource are retried only when the request was not processed: after
54
+ HTTP 429 and transient network failures while connecting, before the request is sent, such as DNS
55
+ resolution errors, refused connections, unreachable hosts or networks, connection timeouts and
56
+ resets during the TLS or proxy handshake. `create_developer_key` already was for DNS resolution
57
+ errors, refused connections and connection timeouts. This covers `create_glossary`,
58
+ `create_glossary_from_csv`, `create_multilingual_glossary`,
59
+ `create_multilingual_glossary_from_csv`, `create_spoken_terms`, `create_style_rule`,
60
+ `create_style_rule_custom_instruction`, `create_style_profile`, the document upload of
61
+ `translate_document` and `translate_document_upload`, and the job creation of
62
+ `create_translation_memory_import`, `create_translation_memory_export`,
63
+ `import_translation_memory_from_filepath` and `export_translation_memory_to_filepath`. Previously
64
+ they were also retried after any 5xx reply and every other transient network failure, so a retry
65
+ could create a second resource. A 5xx reply now raises `DeepL::Exceptions::ServerError` with
66
+ `should_retry?` false at once. Migration: if you retry these calls yourself, check first whether
67
+ the resource was created.
68
+ - **Breaking:** A `DeepL::Exceptions::ConnectionError` of a request that creates a resource,
69
+ `create_developer_key` included, has `should_retry?` `true` when the response failed after its
70
+ headers arrived (body cut off before its `Content-Length`, reset or read timeout), and the
71
+ library does not retry it; in 3.10.0 `create_developer_key` raised it with `should_retry?`
72
+ `false` and the other create requests retried it, and a connection closed before the response
73
+ now has `should_retry?` `false`. Migration: if you retry on `should_retry?`, check first
74
+ whether the resource was created.
75
+ - **Breaking:** `DeepL::Exceptions::ValidationError` is now an `ArgumentError` instead of a
76
+ `DeepL::Exceptions::Error`, so `rescue ArgumentError` catches every invalid argument, also an
77
+ invalid glossary or spoken terms term or a malformed glossary entry. Migration: rescue
78
+ `ArgumentError` (or `DeepL::Exceptions::ValidationError`) instead of `DeepL::Exceptions::Error`
79
+ for these. It no longer has `http_status_code` or `should_retry?`, and its constructor takes
80
+ only a message.
81
+ - **Breaking:** The translation memory methods raise `ArgumentError` instead of `DeepL::Exceptions::Error`
82
+ for an empty translation memory ID or job ID (or a `TranslationMemory` or
83
+ `TranslationMemoryJob` without one) and an empty upload URL. An export job with an empty or no
84
+ download URL still raises `DeepL::Exceptions::Error`. Migration: rescue `ArgumentError` for
85
+ these.
86
+ - **Breaking:** The multilingual glossary methods raise `ArgumentError` before any request for an empty
87
+ glossary ID or a `MultilingualGlossary` without one (previously sent to `/v3/glossaries/`), an
88
+ empty name (`create_multilingual_glossary`, `create_multilingual_glossary_from_csv`,
89
+ `update_multilingual_glossary_name`), an empty `source_lang` or `target_lang` of
90
+ `delete_multilingual_glossary_dictionary`, an empty `dictionaries` array of
91
+ `create_multilingual_glossary`, and a dictionary whose entries (not given as CSV) are empty.
92
+ Migration: pass a non-empty value; these calls previously failed at the API or sent an empty
93
+ value.
94
+ - **Breaking:** The spoken terms and style rule methods raise `ArgumentError` before any request for an empty
95
+ ID or a `SpokenTerms`, `StyleRule` or `CustomInstruction` without one. Previously the request
96
+ was sent to `/v3/spoken-terms/` or `/v3/style_rules/`, and a `nil` instruction ID of
97
+ `get_style_rule_custom_instruction`, `update_style_rule_custom_instruction` and
98
+ `delete_style_rule_custom_instruction` dropped the path segment. Migration: pass a non-empty ID.
99
+ - **Breaking:** `create_style_rule`, `update_style_rule_name`, `create_style_rule_custom_instruction` and
100
+ `update_style_rule_custom_instruction` raise `ArgumentError` before any request for an empty
101
+ name, language, label or prompt. Migration: pass a non-empty value.
102
+ - **Breaking:** `translate_text` and `rephrase_text` raise `ArgumentError` before any request for an empty
103
+ text: an empty string, an empty array or an array with an empty string, as `correct_text`
104
+ already did. Migration: drop empty texts before the call.
105
+ - **Breaking:** `translate_text`, `translate_document` and `translate_document_upload` raise `ArgumentError`
106
+ before any request for an empty or `nil` `target_lang`, an empty `source_lang` (pass `nil` to
107
+ detect it), and a `translation_memory_threshold` set without `translation_memory` or outside
108
+ 0 to 100 (`translate_document` wraps it in `DeepL::Exceptions::DocumentTranslationError`).
109
+ Document translation with the `glossary` option now requires `source_lang` like
110
+ `glossary_ids`. Migration: pass valid values; these calls previously sent
111
+ the value and failed at the API, or ignored the threshold.
112
+ - **Breaking:** `translate_text`, `translate_document` and `translate_document_upload` raise
113
+ `ArgumentError` before any request when `glossary`, `style_rule`, `style_profile` or
114
+ `translation_memory` is an empty ID or a resource object without its ID, or when `glossary_ids`
115
+ has an empty entry or a glossary without its ID (`translate_document` wraps it in
116
+ `DeepL::Exceptions::DocumentTranslationError`). They were sent as an empty or `null` field, or
117
+ left out (a glossary object without its ID), and failed at the API or were ignored. `nil` for
118
+ one of the four options still leaves it unset.
119
+ Migration: pass a non-empty ID or a resource object returned by the API.
120
+ - **Breaking:** `translate_document` raises `DeepL::Exceptions::DocumentTranslationError` (with
121
+ `document_handle` `nil` and the `ArgumentError` as `cause`) for an unknown option, which
122
+ 3.10.0 dropped, and checks before the upload that the directory of `output_path` exists and is
123
+ writable; previously the document was uploaded and translated and the download failed. A
124
+ missing input file still raises `ArgumentError`. Migration: rescue
125
+ `DeepL::Exceptions::DocumentTranslationError`.
126
+ - **Breaking:** `translate_document_download` no longer overwrites an existing file. Before the request it
127
+ raises `Errno::EEXIST` if `output_path` exists and `Errno::ENOENT` or `Errno::EACCES` if its
128
+ directory is missing or not writable. Migration: delete the file first or pass a new path.
129
+ - **Breaking:** `download_translation_memory_export` no longer overwrites an existing file: before the request
130
+ it raises `Errno::EEXIST` if `output_path` exists and `Errno::ENOENT` or `Errno::EACCES` if its
131
+ directory is missing or not writable. A failure writing the file now raises the `Errno` error
132
+ instead of `DeepL::Exceptions::Error`. Migration: delete the file first or pass a new path, and
133
+ rescue `SystemCallError`.
134
+ - **Breaking:** `export_translation_memory_to_filepath` no longer overwrites an existing file: it raises an
135
+ error (`DeepL::Exceptions::TranslationMemoryJobError`, see below) before creating the export
136
+ job if `output_path` exists or its directory is not writable, as it already did for a missing
137
+ directory. Migration: delete the
138
+ file first or pass a new path.
139
+ - **Breaking:** `create_translation_memory_import` raises `ArgumentError` before any request for an empty
140
+ `file_name` or a `content_length` that is not positive, and
141
+ `import_translation_memory_from_filepath` rejects an empty input file before any request
142
+ (`DeepL::Exceptions::TranslationMemoryJobError`, see below); previously the import job was
143
+ created. Migration: pass a non-empty file.
144
+ - **Breaking:** The messages of `AuthorizationFailed`, `RequestEntityTooLarge`, `LimitExceeded`,
145
+ `QuotaExceeded` and `ServerError` now end with the API's error message from the response
146
+ body (`<fixed text>: <API message>`), as the other HTTP errors already did; without one the
147
+ fixed text stays. The `RequestEntityTooLarge` message no longer claims a limit of 50 text
148
+ parts. Migration: code that compares these messages should check the error class instead.
149
+ - **Breaking:** `import_translation_memory_from_filepath` and `export_translation_memory_to_filepath` wrap
150
+ every failure except a missing input file in the new
151
+ `DeepL::Exceptions::TranslationMemoryJobError` (a `DeepL::Exceptions::Error`), with the
152
+ original error as `cause`. Its `job_id` is the ID of the job, set as soon as the job was
153
+ created; its `job` is the last `TranslationMemoryJob` status fetched, `nil` before the first
154
+ status check. `http_status_code` and `should_retry?` are copied from a DeepL error cause.
155
+ Previously the underlying error was raised (`DeepL::Exceptions::Error` or one of its
156
+ subclasses). Migration: rescue
157
+ `DeepL::Exceptions::TranslationMemoryJobError` (or `DeepL::Exceptions::Error`) and inspect
158
+ `cause`, `job_id` and `job`.
159
+ - **Breaking:** `DeepL::AdminClient#set_developer_key_usage_limits` raises `ArgumentError` naming the keyword
160
+ for any limit keyword other than `characters:`, `speech_to_text_milliseconds:` and
161
+ `speech_to_speech_milliseconds:` (also `key_id:`), before a request is sent. Previously any
162
+ keyword was sent as a body field, so a misspelled limit such as `character: 0` changed
163
+ nothing. Migration: fix misspelled limits; send other fields with `extra_body_parameters:`.
164
+ - **Breaking:** `DeepL::Client#download_translation_memory_export` no longer accepts a download URL
165
+ string, only the `DeepL::Resources::TranslationMemoryJob`; a string raises `NoMethodError`.
166
+ Migration: pass the job returned by
167
+ `wait_until_translation_memory_job_done` instead of `job.result.download_url`.
168
+ - **Breaking:** `DeepL::Client.new`, `DeepL::AdminClient.new` and the proxy of
169
+ `DeepL::HTTPClientOptions` accept a proxy URL only with the `http` or `https` scheme and raise
170
+ `ArgumentError` for any other scheme, a missing one included (e.g. `socks5://`, `//host:port`).
171
+ An `https` proxy URL is now connected to over TLS. It needs net-http 0.5.0 or later (bundled
172
+ from Ruby 3.4) and an `https` server URL, and raises `ArgumentError` otherwise. Previously any
173
+ scheme was accepted and the proxy, an `https` one included, was used as a plain HTTP proxy, so
174
+ its credentials were sent unencrypted. Net::HTTP does not verify the certificate of an `https`
175
+ proxy. A proxy URL with an empty host (`http://`, `http://:8080`) and a proxy hash with a blank
176
+ `proxy_addr` also raise `ArgumentError`; they were accepted, and an empty host connected to the
177
+ local machine on some platforms. Migration: use `http://` for a plain HTTP proxy; for an
178
+ `https` proxy on Ruby 3.0-3.3, add `gem 'net-http', '>= 0.5'`; give the proxy a host.
179
+ - **Breaking:** `DeepL::AdminClient#create_developer_key` is now retried after every transient
180
+ network failure raised while connecting, before the request is sent: besides DNS resolution
181
+ errors, refused connections and connection timeouts also an unreachable host or network,
182
+ `Errno::ETIMEDOUT`, `Errno::ECONNRESET` or `Errno::ECONNABORTED` from connect, and a reset during
183
+ the TLS or proxy handshake. The same errors on an established connection are not retried. It
184
+ raised `DeepL::Exceptions::ConnectionError` with `should_retry?` false at once before. The other
185
+ requests that create a resource already retried these failures in 3.10.0 and still do.
186
+ Migration: none needed; code that retries `create_developer_key` itself after such an error now
187
+ sees the library's retries first.
188
+ - **Breaking:** the multilingual glossary methods that take a dictionary
189
+ (`create_multilingual_glossary`, `..._from_csv`, `update_multilingual_glossary`,
190
+ `update_multilingual_glossary_dictionary`, `replace_multilingual_glossary_dictionary`) and
191
+ `get_multilingual_glossary_dictionary_entries` raise `ArgumentError` before any request for a
192
+ `nil` or empty `source_lang` or `target_lang`; `create_spoken_terms`, `update_spoken_terms`,
193
+ `replace_spoken_terms_list`, `get_spoken_terms_entries` and `delete_spoken_terms_list` for a `nil`
194
+ or empty `lang`; and `create_style_rule_custom_instruction`,
195
+ `update_style_rule_custom_instruction` and the `custom_instructions` of `create_style_rule` for an
196
+ empty `source_language` (`nil` still leaves it out). They sent the request with the empty or
197
+ `null` language and the API rejected it. Migration: pass the language, or `nil` where it is
198
+ optional; rescue `ArgumentError` instead of the API error.
199
+ - **Breaking:** `DeepL::Client.new` and `DeepL::AdminClient.new` treat `nil` for `max_retries:`,
200
+ `timeout:` and `send_platform_info:` as the default (5, 10 seconds, `true`), like an omitted
201
+ keyword. Previously `timeout: nil` used Net::HTTP's 60-second timeouts and
202
+ `send_platform_info: nil` left the OS and Ruby versions out of the `User-Agent`. Migration:
203
+ pass `send_platform_info: false` to leave them out.
204
+ - **Breaking:** the library no longer checks argument types by hand. `app_info:` of a type other
205
+ than `DeepL::AppInfo` or a hash no longer raises `ArgumentError`, and a glossary entry whose
206
+ terms are not strings (for example `{ 'a' => 1 }`) no longer raises
207
+ `DeepL::Exceptions::ValidationError`; such a value fails as Ruby fails or is sent as its string
208
+ form. Value checks are unchanged: an entry that is not two terms, an empty or invalid term and
209
+ a duplicate source term still raise `DeepL::Exceptions::ValidationError`. Migration: pass the
210
+ documented types.
211
+ - **Breaking:** `DeepL::Client#get_multilingual_glossary_dictionary_entries` raises
212
+ `DeepL::Exceptions::NotFound` with `http_status_code` `nil` and `response` `nil` if the API
213
+ answers HTTP 200 with no entries for the language pair; the error carried that response and
214
+ status 200 before. The message is unchanged. The API answers a missing dictionary with HTTP
215
+ 404, which raises `DeepL::Exceptions::NotFound` with status 404 and the response, as before.
216
+ Migration: code that read `http_status_code` or `response` of this error checks the error
217
+ class instead.
218
+ - **Breaking:** `DeepL::Client#translate_document_upload` raises `Errno::EISDIR` before any
219
+ request when `input_path` is a directory; it raised `DeepL::Exceptions::ConnectionError` after
220
+ connecting before. Migration: rescue `SystemCallError` for unreadable input paths.
221
+ - **Breaking:** `DeepL::Client#create_multilingual_glossary`, `#update_multilingual_glossary`,
222
+ `#update_multilingual_glossary_dictionary` and `#replace_multilingual_glossary_dictionary` raise
223
+ `ArgumentError` before any request when a dictionary hash gives its entries as an empty or
224
+ whitespace-only CSV string (`entries_format: 'csv'`). Previously the request was sent and the
225
+ API rejected it. `#create_multilingual_glossary_from_csv` is unchanged.
226
+ Migration: pass a non-empty value; rescue `ArgumentError` instead of the API error.
227
+ - **Breaking:** `DeepL::Client#rephrase_text` and `#correct_text` raise `ArgumentError` before a request when
228
+ `target_lang` is an empty string. Previously `''` was sent. `nil` still keeps the language of
229
+ the text.
230
+ Migration: pass a non-empty value; rescue `ArgumentError` instead of the API error.
231
+ - **Breaking:** `DeepL::Client#update_multilingual_glossary_dictionary_from_csv` and
232
+ `#replace_multilingual_glossary_dictionary_from_csv` raise `ArgumentError` before a request
233
+ when the CSV content (after reading an IO) is empty or whitespace only. Previously it was sent.
234
+ Migration: pass a non-empty value; rescue `ArgumentError` instead of the API error.
235
+
236
+ ### Removed
237
+ - **Breaking:** `DeepL::Resources::TranslationMemoryJobResult::STATUS_DOWNLOADED`. `downloaded` is not a job
238
+ status of the API. Migration: compare with `STATUS_COMPLETED` (or call `done?`) instead.
239
+ - **Breaking:** `DeepL::Resources::ConfiguredRules`. `StyleRule#configured_rules` is now a hash (see Changed).
240
+ Migration: read the categories from the hash.
241
+ - **Breaking:** The `glossary_id` option of text translation (`DeepL::Client#translate_text`,
242
+ `DeepL.translate`), deprecated in 3.10.0. Use `glossary` instead, which takes the glossary ID or
243
+ a glossary object. `glossary_id` now raises `ArgumentError` like any other unknown option.
244
+ - **Breaking:** The `glossary_id` option of document translation (`DeepL::Client#translate_document`,
245
+ `#translate_document_upload`, `DeepL.document.upload`), deprecated in 3.10.0. Use `glossary`
246
+ instead. `glossary_id` now raises `ArgumentError` like any other unknown option.
247
+ - **Breaking:** `DeepL::Resources::Usage#character_count`, `#character_limit` and `#quota_exceeded?`,
248
+ deprecated in 3.10.0. Use `character.count`, `character.limit` and
249
+ `character.limit_reached?` (or `any_character_limit_reached?`) instead.
250
+ - **Breaking:** `DeepL::Resources::Usage#document` and `#team_document`: the API no longer returns them.
251
+ `document_*` and `team_document_*` fields in a usage response are ignored. Migration: drop
252
+ these reads.
253
+ - **Breaking:** `DeepL::Resources::DocumentHandle#wait_until_document_translation_finished`, deprecated in
254
+ 3.10.0. Use `DeepL::Client#translate_document_wait_until_done`, which raises
255
+ `DeepL::Exceptions::Error` with the API's message if the translation fails or `timeout_s`
256
+ expires.
257
+ - **Breaking:** `DeepL::Resources::DocumentTranslationStatus#successful?`, deprecated in 3.10.0. Use `#done?`
258
+ instead.
259
+ - **Breaking:** The module-level API, deprecated in 3.10.0: `DeepL.configure`, `DeepL.configuration`,
260
+ `DeepL.api`, `DeepL.http_client` and `DeepL.with_session`, with the global configuration and
261
+ connection, its `DEEPL_AUTH_KEY` and `DEEPL_SERVER_URL` fallbacks and its 60-second default
262
+ timeout. Create a `DeepL::Client` instead, see "Migrating from the module-level API" in the
263
+ README: `DeepL::Client.new(auth_key, server_url:, headers:, max_retries:, timeout:, proxy:,
264
+ send_platform_info:, app_info:, http_client_options:, logger:)`. The client reads no
265
+ environment variables and defaults to a 10-second timeout.
266
+ - **Breaking:** `DeepL::Configuration` is no longer public, and `version=` and `max_doc_status_queries=` are
267
+ removed with it. Pass the options to `DeepL::Client.new`.
268
+ - **Breaking:** `DeepL.translate`. Use `DeepL::Client#translate_text`, which returns an array for an array of
269
+ texts, also for a one-element array.
270
+ - **Breaking:** `DeepL.rephrase`. Use `DeepL::Client#rephrase_text(text, target_lang, writing_style:, tone:)`,
271
+ which returns an array for an array of texts and does not send options set to `nil`.
272
+ - **Breaking:** `DeepL.usage`. Use `DeepL::Client#get_usage`.
273
+ - **Breaking:** `DeepL.languages`. Use `DeepL::Client#get_source_languages` or `#get_target_languages`.
274
+ - **Breaking:** `DeepL.document` and `DeepL::DocumentApi`. Use `DeepL::Client#translate_document` (returns the
275
+ final `DocumentTranslationStatus` instead of the number of bytes written, and raises
276
+ `ArgumentError` for a missing input file), `#translate_document_upload` (`filename:` keyword),
277
+ `#translate_document_get_status`, `#translate_document_wait_until_done` and
278
+ `#translate_document_download` (returns `nil`).
279
+ - **Breaking:** `DeepL.style_rules` and `DeepL::StyleRuleApi`. Use the style rule methods of
280
+ `DeepL::Client` (`get_all_style_rules`, `create_style_rule`, ...). They take `source_language:`
281
+ as a keyword and the delete methods return `nil`.
282
+ - **Breaking:** `DeepL.translation_memories` and `DeepL::TranslationMemoryApi`. Use the translation memory
283
+ methods of `DeepL::Client` (`list_translation_memories`, ...). A missing input file raises
284
+ `ArgumentError`, other local file failures raise `DeepL::Exceptions::Error`, and a non-2xx
285
+ reply of a storage URL raises `DeepL::Exceptions::Error` with `http_status_code`.
286
+ - **Breaking:** `DeepL.glossaries` and `DeepL::GlossaryApi`. Use the v2 glossary methods of `DeepL::Client`:
287
+ `create` becomes `create_glossary` (entries as a hash; for CSV use
288
+ `create_glossary_from_csv`), `list` `list_glossaries`, `find` `get_glossary`, `entries`
289
+ `get_glossary_entries` (returns a hash of source term to target term instead of pairs),
290
+ `destroy` `delete_glossary` (returns `nil` instead of the ID) and `language_pairs`
291
+ `get_glossary_languages`.
292
+ - **Breaking:** Per-call additional HTTP headers. Use the `headers:` option of `DeepL::Client.new`.
293
+ - **Breaking:** `DeepL::Exceptions::NotSupported`, deprecated in 3.10.0. Nothing raises it any more.
294
+ Migration: drop the `rescue`; `Language#supports_formality?` returns `nil` instead (see Changed).
295
+
296
+ ### Fixed
297
+ - `DeepL::Client.new` and `DeepL::AdminClient.new` remove trailing slashes from `server_url`, so a
298
+ URL ending in `/` no longer makes every request go to a `//v2/...` or `//v3/...` path, which the
299
+ API does not serve (HTTP 301 or 404), and `inspect` shows the URL without the slash.
300
+ - **Breaking:** `DeepL::Client.new` and `DeepL::AdminClient.new` accept the `proxy` as a `URI` and as a hash
301
+ with symbol keys (`proxy_addr:`, `proxy_port:`), and raise `ArgumentError` for any other proxy
302
+ value, such as a hash without both keys. Previously such a proxy was ignored without an error
303
+ and the client connected directly. The same applies to the proxy of
304
+ `DeepL::HTTPClientOptions`. Migration: pass a proxy URL, or a hash with both `proxy_addr` and
305
+ `proxy_port`.
306
+ - **Breaking:** `DeepL::Client.new` and `DeepL::AdminClient.new` raise `ArgumentError` naming `server_url`
307
+ when it is not an absolute `http` or `https` URL with a host (e.g. `localhost:3000`,
308
+ `ftp://x.test` or `''`). Previously the client was built and failed on the first request, or
309
+ `URI::InvalidURIError` was raised. Migration: pass the full URL, e.g.
310
+ `http://localhost:3000`.
311
+ - `DeepL::Client#translate_document_upload` (and `#translate_document`): a `nil` value in
312
+ `extra_body_parameters` removes the form field of that name, the library's own field included.
313
+ Previously it was sent as an empty field. JSON request bodies still send `nil` as `null`.
314
+ - `DeepL::Client#create_translation_memory_export` (also used by
315
+ `#export_translation_memory_to_filepath`) sends the export request without a body or
316
+ `Content-Type` (`Content-Length: 0`), as the API defines it. Previously it sent `{}` as a JSON
317
+ body.
318
+ - The gem no longer contains the specs (`spec/`), `.gitlab-ci.yml` and `license_checker.sh`.
319
+
9
320
  ## [3.10.0] - 2026-11-02
10
321
  TL;DR: new `DeepL::Client`, an instance-based client, and `DeepL::AdminClient` for the Admin API.
11
322
  New APIs on `DeepL::Client`: multilingual glossaries, style profiles, spoken terms and text correction.
@@ -565,7 +876,8 @@ The change in major version is only due to the change in maintainership, there i
565
876
  ### Fixed
566
877
  - Make RequestEntityTooLarge error message more clear
567
878
 
568
- [Unreleased]: https://github.com/DeepL/deepl-rb/compare/v3.10.0...HEAD
879
+ [Unreleased]: https://github.com/DeepL/deepl-rb/compare/v4.0.0...HEAD
880
+ [4.0.0]: https://github.com/DeepL/deepl-rb/compare/v3.10.0...v4.0.0
569
881
  [3.10.0]: https://github.com/DeepL/deepl-rb/compare/v3.9.0...v3.10.0
570
882
  [3.9.0]: https://github.com/DeepL/deepl-rb/compare/v3.8.0...v3.9.0
571
883
  [3.8.0]: https://github.com/DeepL/deepl-rb/compare/v3.7.0...v3.8.0