deepl-rb 3.9.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 (215) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +27 -1
  3. data/CHANGELOG.md +741 -18
  4. data/Gemfile +4 -0
  5. data/README.md +1001 -327
  6. data/Rakefile +29 -7
  7. data/VERSION +1 -1
  8. data/deepl-rb.gemspec +75 -88
  9. data/lib/deepl/admin_client.rb +208 -0
  10. data/lib/deepl/api.rb +18 -8
  11. data/lib/deepl/app_info.rb +19 -0
  12. data/lib/deepl/client.rb +1284 -0
  13. data/lib/deepl/configuration.rb +27 -32
  14. data/lib/deepl/constants/admin_usage_group_by.rb +13 -0
  15. data/lib/deepl/constants/custom_tag_usage_aggregate_by.rb +13 -0
  16. data/lib/deepl/constants/document_status_code.rb +17 -0
  17. data/lib/deepl/constants/language_include.rb +17 -0
  18. data/lib/deepl/constants/language_resource_name.rb +21 -0
  19. data/lib/deepl/constants/tag_handling_version.rb +14 -0
  20. data/lib/deepl/exceptions/authorization_failed.rb +1 -1
  21. data/lib/deepl/exceptions/bad_request.rb +1 -3
  22. data/lib/deepl/exceptions/connection_error.rb +40 -0
  23. data/lib/deepl/exceptions/document_not_ready_error.rb +17 -0
  24. data/lib/deepl/exceptions/document_translation_error.rb +17 -1
  25. data/lib/deepl/exceptions/error.rb +13 -1
  26. data/lib/deepl/exceptions/limit_exceeded.rb +1 -1
  27. data/lib/deepl/exceptions/not_found.rb +8 -3
  28. data/lib/deepl/exceptions/quota_exceeded.rb +1 -1
  29. data/lib/deepl/exceptions/request_entity_too_large.rb +1 -2
  30. data/lib/deepl/exceptions/request_error.rb +26 -2
  31. data/lib/deepl/exceptions/server_error.rb +9 -2
  32. data/lib/deepl/exceptions/translation_memory_job_error.rb +32 -0
  33. data/lib/deepl/exceptions/validation_error.rb +15 -0
  34. data/lib/deepl/requests/admin/base.rb +94 -0
  35. data/lib/deepl/requests/admin/create_developer_key.rb +38 -0
  36. data/lib/deepl/requests/admin/custom_tag_usage_analytics.rb +38 -0
  37. data/lib/deepl/requests/admin/list_developer_keys.rb +28 -0
  38. data/lib/deepl/requests/admin/update_developer_key.rb +35 -0
  39. data/lib/deepl/requests/admin/usage_analytics.rb +36 -0
  40. data/lib/deepl/requests/base.rb +313 -65
  41. data/lib/deepl/requests/correct.rb +51 -0
  42. data/lib/deepl/requests/document/download.rb +11 -3
  43. data/lib/deepl/requests/document/get_status.rb +2 -2
  44. data/lib/deepl/requests/document/upload.rb +56 -20
  45. data/lib/deepl/requests/glossary/base.rb +30 -0
  46. data/lib/deepl/requests/glossary/create.rb +18 -18
  47. data/lib/deepl/requests/glossary/destroy.rb +4 -16
  48. data/lib/deepl/requests/glossary/entries.rb +6 -14
  49. data/lib/deepl/requests/glossary/find.rb +3 -13
  50. data/lib/deepl/requests/glossary/language_pairs.rb +22 -6
  51. data/lib/deepl/requests/glossary/list.rb +2 -2
  52. data/lib/deepl/requests/language_resources.rb +41 -0
  53. data/lib/deepl/requests/languages.rb +25 -6
  54. data/lib/deepl/requests/languages_for_resource.rb +56 -0
  55. data/lib/deepl/requests/multilingual_glossary/create.rb +45 -0
  56. data/lib/deepl/requests/multilingual_glossary/destroy.rb +36 -0
  57. data/lib/deepl/requests/multilingual_glossary/destroy_dictionary.rb +55 -0
  58. data/lib/deepl/requests/multilingual_glossary/entries.rb +68 -0
  59. data/lib/deepl/requests/multilingual_glossary/find.rb +35 -0
  60. data/lib/deepl/requests/multilingual_glossary/helpers.rb +71 -0
  61. data/lib/deepl/requests/multilingual_glossary/list.rb +39 -0
  62. data/lib/deepl/requests/multilingual_glossary/replace_dictionary.rb +41 -0
  63. data/lib/deepl/requests/multilingual_glossary/update.rb +40 -0
  64. data/lib/deepl/requests/rephrase.rb +8 -10
  65. data/lib/deepl/requests/spoken_terms/create.rb +42 -0
  66. data/lib/deepl/requests/spoken_terms/destroy.rb +36 -0
  67. data/lib/deepl/requests/spoken_terms/destroy_term_list.rb +42 -0
  68. data/lib/deepl/requests/spoken_terms/entries.rb +47 -0
  69. data/lib/deepl/requests/spoken_terms/find.rb +35 -0
  70. data/lib/deepl/requests/spoken_terms/helpers.rb +74 -0
  71. data/lib/deepl/requests/spoken_terms/list.rb +35 -0
  72. data/lib/deepl/requests/spoken_terms/replace_term_list.rb +41 -0
  73. data/lib/deepl/requests/spoken_terms/update.rb +40 -0
  74. data/lib/deepl/requests/style_profile/base.rb +83 -0
  75. data/lib/deepl/requests/style_profile/create.rb +40 -0
  76. data/lib/deepl/requests/style_profile/destroy.rb +34 -0
  77. data/lib/deepl/requests/style_profile/find.rb +33 -0
  78. data/lib/deepl/requests/style_profile/list.rb +43 -0
  79. data/lib/deepl/requests/style_profile/update.rb +35 -0
  80. data/lib/deepl/requests/style_rule/create.rb +24 -0
  81. data/lib/deepl/requests/style_rule/create_custom_instruction.rb +11 -2
  82. data/lib/deepl/requests/style_rule/destroy.rb +4 -2
  83. data/lib/deepl/requests/style_rule/destroy_custom_instruction.rb +5 -3
  84. data/lib/deepl/requests/style_rule/find.rb +4 -2
  85. data/lib/deepl/requests/style_rule/find_custom_instruction.rb +5 -3
  86. data/lib/deepl/requests/style_rule/helpers.rb +44 -0
  87. data/lib/deepl/requests/style_rule/list.rb +3 -1
  88. data/lib/deepl/requests/style_rule/update.rb +5 -2
  89. data/lib/deepl/requests/style_rule/update_configured_rules.rb +4 -2
  90. data/lib/deepl/requests/style_rule/update_custom_instruction.rb +7 -3
  91. data/lib/deepl/requests/translate.rb +43 -27
  92. data/lib/deepl/requests/translation_memory/base.rb +1 -4
  93. data/lib/deepl/requests/translation_memory/create_export.rb +7 -2
  94. data/lib/deepl/requests/translation_memory/create_import.rb +11 -1
  95. data/lib/deepl/requests/translation_memory/destroy.rb +1 -1
  96. data/lib/deepl/requests/translation_memory/find.rb +1 -1
  97. data/lib/deepl/requests/translation_memory/find_job.rb +1 -1
  98. data/lib/deepl/requests/translation_memory/list.rb +4 -3
  99. data/lib/deepl/requests/translation_memory/segments.rb +5 -4
  100. data/lib/deepl/requests/translation_memory/storage_base.rb +37 -9
  101. data/lib/deepl/requests/translation_memory/upload_file.rb +1 -1
  102. data/lib/deepl/requests/usage.rb +28 -1
  103. data/lib/deepl/requests/write_improvements.rb +42 -0
  104. data/lib/deepl/resources/admin_usage_report.rb +73 -0
  105. data/lib/deepl/resources/custom_tag_usage_report.rb +59 -0
  106. data/lib/deepl/resources/developer_key.rb +57 -0
  107. data/lib/deepl/resources/document_handle.rb +8 -34
  108. data/lib/deepl/resources/document_translation_status.rb +14 -7
  109. data/lib/deepl/resources/language.rb +5 -3
  110. data/lib/deepl/resources/language_resource.rb +57 -0
  111. data/lib/deepl/resources/language_support.rb +56 -0
  112. data/lib/deepl/resources/multilingual_glossary.rb +112 -0
  113. data/lib/deepl/resources/spoken_terms.rb +61 -0
  114. data/lib/deepl/resources/style_profile.rb +44 -0
  115. data/lib/deepl/resources/style_rule.rb +4 -23
  116. data/lib/deepl/resources/text.rb +18 -2
  117. data/lib/deepl/resources/translation_memory.rb +8 -2
  118. data/lib/deepl/resources/translation_memory_import.rb +1 -1
  119. data/lib/deepl/resources/translation_memory_job.rb +26 -7
  120. data/lib/deepl/resources/translation_memory_segments.rb +8 -6
  121. data/lib/deepl/resources/usage.rb +61 -5
  122. data/lib/deepl/utils/client_builder.rb +89 -0
  123. data/lib/deepl/utils/document_poller.rb +70 -0
  124. data/lib/deepl/utils/exception_builder.rb +3 -2
  125. data/lib/deepl/utils/glossary_entries.rb +30 -0
  126. data/lib/deepl/utils/http_client_builder.rb +116 -0
  127. data/lib/deepl/utils/number_parser.rb +34 -0
  128. data/lib/deepl/utils/output_path.rb +25 -0
  129. data/lib/deepl/utils/term_validator.rb +33 -0
  130. data/lib/deepl/utils/time_parser.rb +14 -0
  131. data/lib/deepl/utils/translation_memory_operations.rb +230 -0
  132. data/lib/deepl.rb +68 -108
  133. data/lib/http_client_options.rb +21 -1
  134. data/lib/version.rb +1 -1
  135. data/upgrading_to_v4.md +374 -0
  136. metadata +84 -85
  137. data/.circleci/config.yml +0 -27
  138. data/.github/workflows/add_issues_to_kanban.yml +0 -16
  139. data/.gitlab-ci.yml +0 -179
  140. data/lib/deepl/document_api.rb +0 -131
  141. data/lib/deepl/exceptions/not_supported.rb +0 -14
  142. data/lib/deepl/glossary_api.rb +0 -38
  143. data/lib/deepl/style_rule_api.rb +0 -61
  144. data/lib/deepl/translation_memory_api.rb +0 -309
  145. data/license_checker.sh +0 -8
  146. data/spec/api/api_spec.rb +0 -20
  147. data/spec/api/configuration_spec.rb +0 -122
  148. data/spec/api/deepl_spec.rb +0 -262
  149. data/spec/constants/constants_spec.rb +0 -158
  150. data/spec/integration_tests/document_api_spec.rb +0 -211
  151. data/spec/integration_tests/document_error_paths_spec.rb +0 -33
  152. data/spec/integration_tests/glossary_api_spec.rb +0 -114
  153. data/spec/integration_tests/glossary_error_paths_spec.rb +0 -107
  154. data/spec/integration_tests/integration_test_utils.rb +0 -178
  155. data/spec/integration_tests/languages_api_spec.rb +0 -54
  156. data/spec/integration_tests/languages_error_paths_spec.rb +0 -25
  157. data/spec/integration_tests/rephrase_api_spec.rb +0 -90
  158. data/spec/integration_tests/rephrase_error_paths_spec.rb +0 -53
  159. data/spec/integration_tests/smoke_test_spec.rb +0 -24
  160. data/spec/integration_tests/style_rule_api_spec.rb +0 -117
  161. data/spec/integration_tests/style_rule_error_paths_spec.rb +0 -45
  162. data/spec/integration_tests/translate_api_spec.rb +0 -117
  163. data/spec/integration_tests/translate_error_paths_spec.rb +0 -48
  164. data/spec/integration_tests/translation_memory_api_spec.rb +0 -244
  165. data/spec/integration_tests/translation_memory_error_paths_spec.rb +0 -87
  166. data/spec/integration_tests/usage_api_spec.rb +0 -29
  167. data/spec/integration_tests/usage_error_paths_spec.rb +0 -18
  168. data/spec/requests/document/upload_spec.rb +0 -130
  169. data/spec/requests/extra_body_parameters_types_spec.rb +0 -82
  170. data/spec/requests/glossary/create_spec.rb +0 -44
  171. data/spec/requests/glossary/destroy_spec.rb +0 -27
  172. data/spec/requests/glossary/entries_spec.rb +0 -27
  173. data/spec/requests/glossary/find_spec.rb +0 -28
  174. data/spec/requests/glossary/language_pairs_spec.rb +0 -27
  175. data/spec/requests/glossary/list_spec.rb +0 -27
  176. data/spec/requests/languages_spec.rb +0 -27
  177. data/spec/requests/rephrase_spec.rb +0 -46
  178. data/spec/requests/style_rule/create_custom_instruction_spec.rb +0 -30
  179. data/spec/requests/style_rule/create_spec.rb +0 -29
  180. data/spec/requests/style_rule/destroy_custom_instruction_spec.rb +0 -28
  181. data/spec/requests/style_rule/destroy_spec.rb +0 -27
  182. data/spec/requests/style_rule/find_custom_instruction_spec.rb +0 -29
  183. data/spec/requests/style_rule/find_spec.rb +0 -28
  184. data/spec/requests/style_rule/list_spec.rb +0 -27
  185. data/spec/requests/style_rule/update_configured_rules_spec.rb +0 -31
  186. data/spec/requests/style_rule/update_custom_instruction_spec.rb +0 -32
  187. data/spec/requests/style_rule/update_spec.rb +0 -29
  188. data/spec/requests/translate_spec.rb +0 -338
  189. data/spec/requests/translation_memory/create_export_spec.rb +0 -37
  190. data/spec/requests/translation_memory/create_import_spec.rb +0 -61
  191. data/spec/requests/translation_memory/destroy_spec.rb +0 -36
  192. data/spec/requests/translation_memory/download_export_spec.rb +0 -54
  193. data/spec/requests/translation_memory/find_job_spec.rb +0 -37
  194. data/spec/requests/translation_memory/find_spec.rb +0 -36
  195. data/spec/requests/translation_memory/list_spec.rb +0 -27
  196. data/spec/requests/translation_memory/segments_spec.rb +0 -58
  197. data/spec/requests/translation_memory/upload_file_spec.rb +0 -55
  198. data/spec/requests/usage_spec.rb +0 -27
  199. data/spec/resources/custom_instruction_spec.rb +0 -32
  200. data/spec/resources/glossary_spec.rb +0 -38
  201. data/spec/resources/language_pair_spec.rb +0 -23
  202. data/spec/resources/language_spec.rb +0 -45
  203. data/spec/resources/style_rule_spec.rb +0 -68
  204. data/spec/resources/text_spec.rb +0 -23
  205. data/spec/resources/translation_memory_export_spec.rb +0 -38
  206. data/spec/resources/translation_memory_import_spec.rb +0 -30
  207. data/spec/resources/translation_memory_job_spec.rb +0 -109
  208. data/spec/resources/translation_memory_segments_spec.rb +0 -78
  209. data/spec/resources/translation_memory_spec.rb +0 -52
  210. data/spec/resources/usage_spec.rb +0 -35
  211. data/spec/spec_helper.rb +0 -62
  212. data/spec/support/live_mock_server.rb +0 -12
  213. data/spec/support/managed_glossary.rb +0 -65
  214. data/spec/support/managed_style_rule.rb +0 -17
  215. data/spec/support/managed_translation_memory.rb +0 -55
data/CHANGELOG.md CHANGED
@@ -6,6 +6,727 @@ 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
+
320
+ ## [3.10.0] - 2026-11-02
321
+ TL;DR: new `DeepL::Client`, an instance-based client, and `DeepL::AdminClient` for the Admin API.
322
+ New APIs on `DeepL::Client`: multilingual glossaries, style profiles, spoken terms and text correction.
323
+ Read Changed and Deprecated before upgrading; no public API is removed in this release.
324
+
325
+ ### Added
326
+ - Added `DeepL::Resources::DocumentTranslationStatus#done?` (the status is `done`).
327
+ - `DeepL::Resources::DocumentHandle.new(document_id, document_key)` creates a handle from a
328
+ stored ID and key; the request and response arguments are now optional.
329
+ - `DeepL::Exceptions::DocumentTranslationError` copies `http_status_code` and `should_retry?`
330
+ from the DeepL error it wraps.
331
+ - `DeepL::Exceptions::Error.new` accepts the keywords `http_status_code:` and `should_retry:`.
332
+ - Added `DeepL::Client#get_usage`, which returns the same `DeepL::Resources::Usage` as
333
+ `DeepL.usage`. Please refer to the README for usage instructions.
334
+ - Added translation memories to `DeepL::Client`: `list_translation_memories(page: nil,
335
+ page_size: nil)`, `get_translation_memory(translation_memory)`,
336
+ `delete_translation_memory(translation_memory)`,
337
+ `list_translation_memory_segments(translation_memory, page_size: nil, page_cursor: nil,
338
+ filter_text: nil, filter_case_sensitive: nil)`, `create_translation_memory_import(file_name,
339
+ content_length, content_type: nil, display_name: nil, **options)`,
340
+ `upload_translation_memory_file(translation_memory_import, content, content_type: nil)`,
341
+ `import_translation_memory_from_filepath(input_path, display_name: nil, content_type: nil,
342
+ timeout_s: nil, **options)`, `create_translation_memory_export(translation_memory)`,
343
+ `download_translation_memory_export(job, output_path)`,
344
+ `export_translation_memory_to_filepath(translation_memory, output_path, timeout_s: nil)`,
345
+ `get_translation_memory_job(job)` and `wait_until_translation_memory_job_done(job,
346
+ timeout_s: nil)`. Keywords left `nil` are not sent; the delete and download methods return
347
+ `nil`. Please refer to the README for usage instructions. A missing input file raises
348
+ `ArgumentError` before any request; other local file failures raise
349
+ `DeepL::Exceptions::Error` with the original error as `cause`. A non-2xx response from the
350
+ pre-signed storage URL (upload or export download) raises `DeepL::Exceptions::Error` with
351
+ `http_status_code`, `should_retry?` true for 429 and 5xx.
352
+ - `DeepL.translation_memories.import_from_filepath` accepts `content_type:`, declared in the
353
+ import job and sent with the upload, and `extra_body_parameters:`.
354
+ `DeepL.translation_memories.create_import` accepts `extra_body_parameters:`.
355
+ - Added `DeepL::Resources::TranslationMemoryJob#done?` (the status is `completed`) and `#ok?`
356
+ (the status is not `failed` or `expired`, also true while the job runs). `finished?` stays
357
+ true for any terminal status.
358
+ - Added style rule lists (`/v3/style_rules`) to `DeepL::Client`:
359
+ `get_all_style_rules(page: nil, page_size: nil, detailed: nil)`,
360
+ `create_style_rule(name, language, configured_rules: nil, custom_instructions: nil,
361
+ **options)`, `get_style_rule(style_rule)`, `update_style_rule_name(style_rule, name,
362
+ **options)`, `update_style_rule_configured_rules(style_rule, configured_rules, **options)`,
363
+ `delete_style_rule(style_rule)`, `create_style_rule_custom_instruction(style_rule, label,
364
+ prompt, source_language: nil, **options)`, `get_style_rule_custom_instruction(style_rule,
365
+ instruction_id)`, `update_style_rule_custom_instruction(style_rule, instruction_id, label,
366
+ prompt, source_language: nil, **options)` and
367
+ `delete_style_rule_custom_instruction(style_rule, instruction_id)`. Keywords left `nil` are
368
+ not sent; the delete methods return `nil`. Please refer to the README for usage
369
+ instructions.
370
+ - The style rule operations, in `DeepL::Client` and in `DeepL.style_rules`, take a style rule
371
+ list as its ID or a `DeepL::Resources::StyleRule`, and a custom instruction as its ID or a
372
+ `DeepL::Resources::CustomInstruction`.
373
+ - Added the language operations to `DeepL::Client`: `get_source_languages`,
374
+ `get_target_languages`, `get_language_resources` and `get_languages_for_resource(resource,
375
+ include: nil)`. `include:` takes one value or an array and is sent as one `include` query
376
+ parameter per value; without it none is sent. Source and target languages keep their
377
+ upper-case codes; `get_languages_for_resource` returns the codes as the API sends them.
378
+ `get_languages_for_resource` returns `DeepL::Resources::LanguageSupport` objects
379
+ (source/target usability, status and per-feature support); `get_language_resources` returns
380
+ `DeepL::Resources::LanguageResource` objects with each feature's source and/or target
381
+ language requirement.
382
+ - Added `DeepL::Constants::LanguageResourceName` (`TRANSLATE_TEXT`, `TRANSLATE_DOCUMENT`,
383
+ `GLOSSARY`, `VOICE`, `WRITE`, `STYLE_RULES`, `TRANSLATION_MEMORY`) and
384
+ `DeepL::Constants::LanguageInclude` (`BETA`, `EXTERNAL`). Other strings are still accepted
385
+ and sent unchanged.
386
+ - Added document translation to `DeepL::Client`: `translate_document(input_path,
387
+ output_path, source_lang, target_lang, timeout_s: nil, **options)`,
388
+ `translate_document_upload(input_path, source_lang, target_lang, **options)`,
389
+ `translate_document_get_status(handle)`, `translate_document_wait_until_done(handle,
390
+ timeout_s: nil)` and `translate_document_download(handle, output_path)`. The file name is
391
+ the `filename:` option. `translate_document` returns the final status and wraps every
392
+ failure in `DeepL::Exceptions::DocumentTranslationError`; `translate_document_wait_until_done`
393
+ raises `DeepL::Exceptions::Error` with the API's message when the translation fails, and both
394
+ raise when `timeout_s` expires. `translate_document` and `translate_document_upload` raise
395
+ `ArgumentError` for a missing input file before any request; `translate_document` does not
396
+ wrap it in `DocumentTranslationError`.
397
+ - Added `DeepL::Exceptions::DocumentNotReadyError` (a `ServerError`), raised for HTTP 503 on a
398
+ document download.
399
+ - Added `DeepL::Exceptions::DocumentTranslationError#document_handle`, the handle of the
400
+ uploaded document (`nil` if the upload failed).
401
+ - Added `DeepL::Resources::DocumentTranslationStatus#ok?` (the translation has not failed) and
402
+ `DeepL::Constants::DocumentStatusCode` (`QUEUED`, `TRANSLATING`, `DONE`, `ERROR`).
403
+ - Added `DeepL::Client#translate_text(text, source_lang, target_lang, **options)`. It takes
404
+ the options of `DeepL.translate` as keyword arguments and returns one
405
+ `DeepL::Resources::Text` for a string and an array for an array, also for a one-element
406
+ array.
407
+ - Added `DeepL::Client#rephrase_text(text, target_lang = nil, writing_style: nil, tone: nil,
408
+ **options)` and `DeepL::Client#correct_text(text, target_lang = nil, **options)`. The
409
+ writing style and tone are keyword arguments, `extra_body_parameters:` is applied last, and
410
+ both return one `DeepL::Resources::Text` for a string and an array for an array, also for a
411
+ one-element array.
412
+ - Added `target_language` (`String`) to `DeepL::Resources::Text` for rephrase and correct
413
+ results. It is `nil` for text translation results and when the response does not contain
414
+ it or contains an unexpected value.
415
+ - Added the `glossary` option to text translation and document translation
416
+ (`DeepL.document.upload` and `translate_document`). It takes a glossary ID or a
417
+ `DeepL::Resources::Glossary` or `DeepL::Resources::MultilingualGlossary` object and is sent
418
+ as `glossary_id`.
419
+ - Added `billed_characters` (`Integer`) and `tag_handling_version` (`String`) to
420
+ `DeepL::Resources::Text` for text translation results. They are `nil` when the response
421
+ does not contain them or contains an unexpected value.
422
+ - Added `DeepL::Constants::TagHandlingVersion` (`V1`, `V2`) for the `tag_handling_version`
423
+ option.
424
+ - Added `DeepL::Client`, a client instance that owns its configuration and HTTP connection
425
+ and reads no environment variables: `DeepL::Client.new(auth_key, server_url:, headers:,
426
+ max_retries:, timeout:, proxy:, send_platform_info:, app_info:, http_client_options:,
427
+ logger:)`. Its operations follow in later changes. New public types: `DeepL::Client` and
428
+ `DeepL::AppInfo` (`app_name`, `app_version`).
429
+ - Added the client options `headers:` (sent with every DeepL API request; a header of the same
430
+ name, in any casing, replaces the library's, including `Authorization` and `User-Agent`,
431
+ except `Content-Type`, `Content-Length`, `Transfer-Encoding` and `Host`), `timeout:` (seconds
432
+ per attempt, default 10, applied to opening, reading and writing) and `proxy:` (a proxy URL,
433
+ also accepted as the `proxy` of `DeepL::HTTPClientOptions`; its user info never shows in
434
+ `inspect` output or error messages). The module configuration has `headers` and `timeout`
435
+ (default 60) attributes too.
436
+ - Added `DeepL::Client.free_account_auth_key?(key)`.
437
+ - Added `DeepL::Exceptions::ConnectionError`, raised by `DeepL::Client` and
438
+ `DeepL::AdminClient` for network failures without an HTTP response (DNS, connection, TLS,
439
+ timeout) after the retries; the original exception is its `cause`. The module-level API still
440
+ raises the original network errors.
441
+ - Added `DeepL::Exceptions::ValidationError`, a `DeepL::Exceptions::Error` raised before any
442
+ request for an invalid glossary or spoken terms term and an unsupported `DeepL.languages`
443
+ `type`.
444
+ - Added `http_status_code` (`Integer`, `nil` without a response) to
445
+ `DeepL::Exceptions::Error`. `RequestError#request` now returns the failed request, and the
446
+ message of a `RequestError` for an unmapped status contains the status and the API's
447
+ message instead of `Unknown error.`.
448
+ - Added the `style_profile` option to text translation (`DeepL.translate`) and document
449
+ translation (`DeepL.document.upload` and `translate_document`). It takes a style profile
450
+ ID string or a `DeepL::Resources::StyleProfile` object and is sent as `style_profile_id`.
451
+ - Added support for style profiles (`/v3/style_profiles`) to `DeepL::Client`:
452
+ `create_style_profile(name, **options)`, `list_style_profiles(page:, page_size:)`,
453
+ `get_style_profile(style_profile)`, `update_style_profile(style_profile, **options)` and
454
+ `delete_style_profile(style_profile)` (returns `nil`). A style profile links glossaries,
455
+ style rule lists and translation memories; it is given as its ID or a
456
+ `DeepL::Resources::StyleProfile`, whose ID is `style_profile_id`. The component lists
457
+ (`glossary_ids`, `style_rule_ids`, `translation_memory_ids`) take IDs or the
458
+ `Glossary`, `MultilingualGlossary`, `StyleRule` and `TranslationMemory` objects, which are
459
+ sent as their IDs. In create and update, keywords left `nil` are not sent; an empty string
460
+ clears `description` or `industry`, and an empty array unlinks all components of that
461
+ kind. Please refer to the README for usage instructions.
462
+ - Added support for spoken terms collections (`/v3/spoken-terms`) to `DeepL::Client`:
463
+ `create_spoken_terms(name, term_lists, **options)`, `list_spoken_terms`,
464
+ `get_spoken_terms(spoken_terms)`, `update_spoken_terms(spoken_terms, name:, term_lists:,
465
+ **options)`, `delete_spoken_terms(spoken_terms)`, `get_spoken_terms_entries(spoken_terms,
466
+ lang)`, `replace_spoken_terms_list(spoken_terms, entries, **options)` and
467
+ `delete_spoken_terms_list(spoken_terms, lang)`. A collection is given as its ID or a
468
+ `DeepL::Resources::SpokenTerms` (`spoken_terms_id`, `name`, `creation_time`, `term_lists`);
469
+ the terms of a language as a `DeepL::Resources::SpokenTermsEntries` or a hash with `:lang`
470
+ and `:entries`. Terms are arrays of strings and are stripped and checked like glossary terms
471
+ before they are sent. The delete methods return `nil`. Please refer to the README for usage
472
+ instructions. Collection IDs are URL-encoded in the request paths. `creation_time` is a UTC
473
+ `Time` when the timestamp has no offset and `nil` when it is malformed.
474
+ - Added `DeepL::AdminClient` for the Admin API. It must be created with an admin
475
+ API key, accepts the options of `DeepL::Client` and supports managing developer keys
476
+ (`create_developer_key(label: nil)`, `list_developer_keys`, `deactivate_developer_key`,
477
+ `rename_developer_key`, `set_developer_key_usage_limits`) and retrieving usage analytics
478
+ (`get_usage_analytics`, `get_custom_tag_usage_analytics`). The four methods that send a
479
+ body accept `extra_body_parameters:`, added to the request body last.
480
+ `create_developer_key` is retried only when the request was not sent (HTTP 429, DNS
481
+ resolution errors, refused connections and connection timeouts), and the raised error's
482
+ `should_retry?` is true only when the request was not sent.
483
+ `DeveloperKey#label`, `DeveloperKey#usage_limits`, `KeyUsage#api_key_label`,
484
+ `AdminUsageReport#total_usage`, `#start_date`, `#end_date` and
485
+ `AdminUsageBreakdown#speech_to_speech_minutes` and
486
+ `CustomTagUsageBreakdown#speech_to_speech_minutes` are `nil` when the response does not
487
+ contain them.
488
+ `set_developer_key_usage_limits` changes only the given limits, including
489
+ `speech_to_speech_milliseconds`. New public types: `DeepL::AdminClient`,
490
+ `DeepL::Resources::DeveloperKey`, `DeepL::Resources::DeveloperKeyUsageLimits`,
491
+ `DeepL::Resources::AdminUsageReport`, `DeepL::Resources::AdminUsageBreakdown`,
492
+ `DeepL::Resources::KeyUsage`, `DeepL::Resources::CustomTagUsageReport`,
493
+ `DeepL::Resources::CustomTagUsageBreakdown`, `DeepL::Resources::CustomTagUsage`,
494
+ `DeepL::Constants::AdminUsageGroupBy` and `DeepL::Constants::CustomTagUsageAggregateBy`.
495
+ The usage breakdown includes `speech_to_speech_minutes`.
496
+ - Added support for multilingual glossaries (`/v3/glossaries`) to `DeepL::Client`:
497
+ `create_multilingual_glossary(name, dictionaries, **options)`,
498
+ `create_multilingual_glossary_from_csv(name, source_lang, target_lang, csv, **options)`,
499
+ `list_multilingual_glossaries`, `get_multilingual_glossary(glossary)`,
500
+ `update_multilingual_glossary(glossary, name: nil, dictionaries: nil, **options)` (sends
501
+ only the keywords given, `{}` without any), `update_multilingual_glossary_name`,
502
+ `update_multilingual_glossary_dictionary(glossary, dictionary, **options)`,
503
+ `update_multilingual_glossary_dictionary_from_csv`,
504
+ `replace_multilingual_glossary_dictionary(glossary, dictionary, **options)`,
505
+ `replace_multilingual_glossary_dictionary_from_csv`,
506
+ `get_multilingual_glossary_dictionary_entries(glossary, source_lang, target_lang)`,
507
+ `delete_multilingual_glossary_dictionary(glossary, source_lang, target_lang)` and
508
+ `delete_multilingual_glossary(glossary)`. A glossary is given as its ID or a
509
+ `DeepL::Resources::MultilingualGlossary`; the ID is URL-encoded in the request paths. A
510
+ dictionary is a `DeepL::Resources::MultilingualGlossaryDictionaryEntries` (`source_lang`,
511
+ `target_lang` and `entries`, a hash of source term to target term; constructible with
512
+ `.new` from a hash, source/target pairs or a TSV string) or a hash
513
+ with the same keys. A source term that appears twice (after stripping) or a pair that is not
514
+ exactly two strings raises `DeepL::Exceptions::ValidationError` before any request.
515
+ Entries given as a TSV string are parsed into pairs, and each term is stripped and checked
516
+ like terms given as pairs; a line that is not exactly two tab-separated terms raises
517
+ `DeepL::Exceptions::ValidationError`. CSV content is sent as given.
518
+ Entries given as a hash or pairs are sent as TSV, also with `entries_format: 'csv'`.
519
+ `get_multilingual_glossary_dictionary_entries` returns one dictionary
520
+ and raises `DeepL::Exceptions::NotFound` if the glossary has none for the language pair;
521
+ the delete methods return `nil`. `creation_time` is a UTC `Time`, `nil` when malformed.
522
+ Please refer to the README for usage instructions.
523
+ - Added the `enable_watermark` option to `DeepL.document.upload` and
524
+ `DeepL.document.translate_document`. When `true`, the API adds a "Translated by DeepL"
525
+ watermark to `docx` and `pdf` output. Previously the option was silently dropped.
526
+ - `DeepL.usage` now returns each usage type as a `DeepL::Resources::Usage::Detail` (`count`,
527
+ `limit`, `limit_reached?`), like the other DeepL client libraries: `character`, `document`,
528
+ `team_document`, and for API Pro users `api_key_character`, `speech_to_text_minutes` and
529
+ `speech_to_speech_minutes`. API Pro users also get `start_time` and `end_time` (as `Time`)
530
+ and `products` (an array of `DeepL::Resources::UsageProduct`). Fields missing from the
531
+ response are `nil`. The new `any_limit_reached?` checks the character, document and team
532
+ document limits, not the API Pro ones. `character_count`, `character_limit`,
533
+ `quota_exceeded?` and `to_s` are unchanged.
534
+
535
+ ### Changed
536
+ - Text translation accepts a glossary without a source language: the `glossary_ids`
537
+ option no longer requires `source_lang`, and the API detects the source language.
538
+ Document translation with `glossary_ids` still requires `source_lang`.
539
+ - Text translation now always sends `show_billed_characters: true`, so every result has
540
+ `billed_characters`; previously it was sent only when set.
541
+ - Requests of the module-level API now time out after `config.timeout` seconds per attempt
542
+ (default 60, or the backoff interval if longer), applied to opening, reading and writing;
543
+ previously Net::HTTP's 60-second defaults applied and could not be set. Timeouts given in
544
+ `DeepL::HTTPClientOptions` still take precedence.
545
+ - `DeepL.languages` and `DeepL.glossaries.language_pairs` now use the `GET /v3/languages`
546
+ endpoint instead of the deprecated `GET /v2/languages` and `GET /v2/glossary-language-pairs`
547
+ endpoints. Public method signatures and return types are unchanged. An unsupported `type`
548
+ option now raises `DeepL::Exceptions::ValidationError` before any request; previously the
549
+ API answered with `DeepL::Exceptions::BadRequest`.
550
+ - Language lists returned by `DeepL.languages` and `DeepL.glossaries.language_pairs` may now
551
+ include additional languages that the v2 endpoints did not list.
552
+ - `DeepL.translation_memories.export_to_filepath` now checks the output directory before
553
+ creating the export job and raises `Errno::ENOENT` if it does not exist; previously the same
554
+ error came after the export finished. `DeepL::Client#export_translation_memory_to_filepath`
555
+ raises `DeepL::Exceptions::Error` instead.
556
+ - Glossary terms given as `[source, target]` pairs are now stripped of surrounding whitespace
557
+ before they are sent; previously they were sent as given.
558
+ - Every 5xx reply is now retried; previously only 429 and 500 were, and 502, 503, 504 and other
559
+ 5xx replies were raised at once.
560
+ - Query values are now encoded per RFC 3986, with a space as `%20`; previously as `+`.
561
+ - `DeepL.document.translate_document` and `DocumentHandle#wait_until_document_translation_finished`
562
+ now poll until the translation is done or failed; previously they stopped after 11 status
563
+ requests (about 50 seconds) and `translate_document` then downloaded the unfinished document.
564
+ A configured `max_doc_status_queries` still limits the requests; `translate_document` then
565
+ raises `DocumentTranslationError`.
566
+ - A malformed API response (invalid JSON, missing or mistyped fields) now raises
567
+ `DeepL::Exceptions::Error` for every request; previously `JSON::ParserError`,
568
+ `NoMethodError`, `TypeError` or `KeyError`.
569
+ - Reworked the test suite so that it no longer needs the `deepl-mock` server. The offline specs
570
+ assert the exact outgoing requests with WebMock, and one real-API spec per resource calls each
571
+ endpoint once. `webmock` and `webrick` are test dependencies again.
572
+
573
+ ### Deprecated
574
+ - `DeepL::Resources::DocumentTranslationStatus#successful?`, use `#done?` instead. It prints a
575
+ deprecation warning once per process when Ruby's deprecation warnings are enabled
576
+ (`ruby -W:deprecated`) and keeps working unchanged.
577
+ - `DeepL::Resources::Usage#character_count`, `#character_limit` and `#quota_exceeded?`, use
578
+ `character.count`, `character.limit` and `character.limit_reached?` (or `any_limit_reached?`)
579
+ instead. Each prints a deprecation warning once per process when Ruby's deprecation warnings
580
+ are enabled (`ruby -W:deprecated`) and keeps working unchanged. `DeepL.usage` now names
581
+ `DeepL::Client#get_usage` as its replacement.
582
+ - The methods of `DeepL::TranslationMemoryApi` (`DeepL.translation_memories`), use the
583
+ translation memory methods of `DeepL::Client` instead (`list` is
584
+ `list_translation_memories`, `find` is `get_translation_memory`, `segments` is
585
+ `list_translation_memory_segments`, `find_job` is `get_translation_memory_job`, and so on).
586
+ They keep working unchanged.
587
+ - The methods of `DeepL::StyleRuleApi` (`DeepL.style_rules`), use the style rule methods of
588
+ `DeepL::Client` instead (`list` is `get_all_style_rules`, `find` is `get_style_rule`,
589
+ `update_name` is `update_style_rule_name`, `destroy` is `delete_style_rule`, and so on).
590
+ They keep working unchanged.
591
+ - `DeepL::Exceptions::NotSupported` is deprecated: only the module-level API raises it, from
592
+ `DeepL::Resources::Language#supports_formality?` for a source language of `DeepL.languages`;
593
+ for a source language from `DeepL::Client`, `supports_formality?` returns `nil`. Creating one
594
+ prints a deprecation warning once per process when Ruby's deprecation warnings are enabled
595
+ (`ruby -W:deprecated`).
596
+ - The module-level API is deprecated in favour of `DeepL::Client` and will be removed in the
597
+ next major version: `DeepL.configure`, `DeepL.configuration`, `DeepL.api`, `DeepL.translate`,
598
+ `DeepL.rephrase`, `DeepL.usage`, `DeepL.languages`, `DeepL.document`, `DeepL.glossaries`,
599
+ `DeepL.style_rules`,
600
+ `DeepL.translation_memories`, `DeepL.with_session` and `DeepL.http_client`. Each prints a
601
+ deprecation warning once per process when Ruby's deprecation warnings are enabled
602
+ (`ruby -W:deprecated`) and keeps working unchanged.
603
+ - `DeepL::Configuration#version=` (the API version is part of each endpoint).
604
+ - The `glossary_id` option of text and document translation, use `glossary` instead. It prints a
605
+ deprecation warning once per process when Ruby's deprecation warnings are enabled
606
+ (`ruby -W:deprecated`) and keeps working unchanged.
607
+ - `DeepL::Resources::DocumentHandle#wait_until_document_translation_finished`, use
608
+ `DeepL::Client#translate_document_wait_until_done` instead.
609
+ - `DeepL::Configuration#max_doc_status_queries=`, use the `timeout_s:` of
610
+ `DeepL::Client#translate_document` or `translate_document_wait_until_done` instead.
611
+
612
+ ### Fixed
613
+ - The README's module-level examples for turning off platform information and for setting app
614
+ information called `DeepL.configure` with arguments, which raises `ArgumentError`. They now
615
+ use the block form.
616
+ - `get_usage` (and `DeepL.usage`), the glossary and multilingual glossary get, list, entries
617
+ and delete requests, and the style rule and custom instruction get and delete requests sent a
618
+ JSON body `{}` with `Content-Type: application/json`. GET and DELETE requests are now sent
619
+ without a body.
620
+ - A response body shorter than its `Content-Length` (the connection closed mid-body) was
621
+ returned as complete: `translate_document_download` wrote a truncated document, and JSON
622
+ calls raised a generic "Unexpected response" error. It is now retried like a reset
623
+ connection and, after the last retry, raises `DeepL::Exceptions::ConnectionError` with
624
+ `should_retry?` true (`DeepL::Client`, `DeepL::AdminClient`) or the original `EOFError`
625
+ (module-level API).
626
+ - An HTTPS proxy that refuses the `CONNECT` request (for example with 407 Proxy Authentication
627
+ Required) raised a raw `Net::HTTPClientException` or `Net::HTTPFatalError`. It now raises
628
+ `DeepL::Exceptions::ConnectionError` with `should_retry?` false (`DeepL::Client`,
629
+ `DeepL::AdminClient`) or the original proxy error (module-level API), without retrying.
630
+ - Net::HTTP re-sent a failed GET, PUT or DELETE request once on its own, so with
631
+ `max_retries: 0` such a request could still be sent twice. The library's connections now
632
+ disable Net::HTTP's own retry; only `max_retries:` applies.
633
+ - TLS failures (including certificate verification failures) and malformed HTTP responses were
634
+ retried like transient network failures. They are now raised at once, as
635
+ `DeepL::Exceptions::ConnectionError` with `should_retry?` false (`DeepL::Client`,
636
+ `DeepL::AdminClient`) or as the original TLS or protocol error (module-level API).
637
+ - `DeepL.document.translate_document` raised `NoMethodError` when the output file already
638
+ exists. It now raises `DeepL::Exceptions::DocumentTranslationError` (without a document
639
+ handle); the file is kept and nothing is uploaded, as in `DeepL::Client#translate_document`.
640
+ The doc comment of `DeepL.document.translate_document` no longer claims that an
641
+ existing file is overwritten.
642
+ - `wait_until_translation_memory_job_done` (and the file helpers) could wait up to five seconds
643
+ past `timeout_s`; the last wait is now cut to the deadline.
644
+ - Uploads to and downloads from the pre-signed translation memory storage URLs ignored the
645
+ proxy, SSL verification, certificate file and timeouts set with `proxy:` or
646
+ `http_client_options:` (or `DeepL.with_session`). They now use the same options as the API
647
+ connection, still without the `Authorization` header.
648
+ - A malformed timestamp in a translation memory, segment, import or job response raised a raw
649
+ `ArgumentError`, and a timestamp without a zone offset was read as local time. A malformed
650
+ timestamp is now `nil`, and one without an offset is read as UTC.
651
+ - `DeepL.translation_memories.list` and `segments` sent an option set to `nil` as an empty
652
+ query parameter (`page=`). Such options are no longer sent.
653
+ - Translation memory and job IDs were inserted into the request path without URL encoding:
654
+ an ID containing `/` changed the path and a space raised `URI::InvalidURIError`. They are
655
+ now URL-encoded.
656
+ - Style rule list and custom instruction IDs were inserted into the request path without
657
+ URL encoding: an ID containing `/` changed the path and a space raised
658
+ `URI::InvalidURIError`. They are now URL-encoded.
659
+ - A malformed `creation_time` or `updated_time` of a style rule list raised a raw
660
+ `ArgumentError`. It now raises `DeepL::Exceptions::Error`.
661
+ - Creating a style rule list removed `configured_rules` and `custom_instructions` from the
662
+ options hash passed in, so reusing the hash for another create sent neither. The hash is no
663
+ longer changed.
664
+ - Downloaded documents were written in text mode, which converted newlines on Windows and
665
+ failed or transcoded the bytes when `Encoding.default_internal` was set. They are now
666
+ written in binary mode.
667
+ - Document IDs are now URL-encoded in the status and download paths.
668
+ - Text translation sent options set to `nil`, and a `nil` source language, as JSON `null`.
669
+ They are now treated as unset and not sent.
670
+ - `translation_memory: nil` sent an empty `translation_memory_id`, and
671
+ `translation_memory_threshold: nil` sent `null` (text) or an empty field (documents). Both
672
+ are now treated as unset and not sent.
673
+ - Document translation (`DeepL.document.upload` and `translate_document`) treated an option
674
+ set to `nil` as set: `glossary_ids` with `glossary_id: nil` raised `ArgumentError`. Options
675
+ set to `nil` are now treated as unset and not sent, as in text translation.
676
+ - A `custom_instructions` string was split at commas into several instructions. It is now
677
+ sent as one instruction.
678
+ - `DeepL.configure { |c| c.auth_key = '...:fx' }` kept `https://api.deepl.com`, because the
679
+ default server was chosen before the block set the key. Without a configured host, the
680
+ server is now chosen from the final key.
681
+ - A Free key with surrounding whitespace (`'abc:fx '`) selected `https://api.deepl.com`
682
+ although the trimmed key was sent. The Free check now trims the key too.
683
+ - The auth key was sent with surrounding whitespace, and a whitespace-only key passed
684
+ `DeepL.configure`. The key is now trimmed, and a blank key raises
685
+ `DeepL::Exceptions::Error`.
686
+ - Refused or reset connections and `EOFError` were not retried. They are now
687
+ retried like timeouts and DNS failures. `AdminClient#create_developer_key` also retries a
688
+ refused connection, which shows that the request was not sent.
689
+ - A 400 or 404 reply with a JSON array body raised `TypeError` when its message was read.
690
+ - `extra_body_parameters` were overridden by options of the same name, and a string key next
691
+ to the SDK's symbol key sent the field twice. They are now applied last and replace the
692
+ SDK's field.
693
+ - `DeepL.with_session` turned TLS off (instead of certificate verification) when
694
+ `enable_ssl_verification` was `false`, turned it on for `http://` hosts, and used a proxy
695
+ with only an address. It now builds its connection like `DeepL::AdminClient`.
696
+ - `DeepL.with_session` opened its connection with Net::HTTP's 60 second open timeout. It now
697
+ uses the configured `timeout` unless the HTTP client options set `open_timeout`.
698
+ - `DocumentHandle#wait_until_document_translation_finished` polled through the module
699
+ configuration instead of the connection that created the handle.
700
+ - `DeepL::Configuration#inspect` showed the auth key. It now shows `[REDACTED]`.
701
+ - Glossary entries given as `[source, target]` pairs (`DeepL.glossaries.create`) were sent
702
+ unchecked, so a term with a tab or newline
703
+ silently corrupted the entries. An invalid term now raises
704
+ `DeepL::Exceptions::ValidationError` before any request: after stripping, it must not be empty
705
+ or contain C0 or C1 control characters, U+2028 or U+2029. Entries given as a TSV or CSV string
706
+ are still sent as given.
707
+ - Debug logging no longer includes the auth key in the logged request headers.
708
+ - Network errors (timeouts, `SocketError`) were retried without limit. They are now retried at
709
+ most `max_network_retries` times, like 429 and 500 replies, and then raised.
710
+ - `DeepL.with_session` without client options raised `ArgumentError`, and without a block raised
711
+ `NoMethodError`. It now runs with default options and raises `ArgumentError` without a block.
712
+ `HTTPClientOptions.new` now defaults `proxy` to `{}` and `cert_path` to `nil`, so the README
713
+ example `HTTPClientOptions.new({ 'proxy_addr' => ..., 'proxy_port' => ... })` works.
714
+ - `DeepL.with_session` left its HTTP client, including the proxy, in place after the block, so
715
+ every later call went through a closed client and the proxy. It now restores the previous
716
+ client when the block ends or raises.
717
+ - A failed `translate_document` raised `NameError` instead of
718
+ `DeepL::Exceptions::DocumentTranslationError` when nothing else had loaded `fileutils`. The
719
+ library now requires it.
720
+ - An option set to `false` with a string key (for example `'split_sentences' => false`) was read as
721
+ unset, so its conversion was skipped and `false` was sent instead of the API value `'0'`.
722
+ - Document translation (`DeepL.document.upload` and `translate_document`) with source language
723
+ `nil` raised `TypeError` before sending the request. It now omits `source_lang`, so the API
724
+ detects the language of the document.
725
+ - `style_rule: nil` sent an empty `style_id` in text and document translation. A `nil` style rule
726
+ is now treated as unset and sends nothing.
727
+ - `DeepL.rephrase` returned fewer results than texts, or `nil` for a string, when the response
728
+ contained fewer improvements than texts. It now raises `DeepL::Exceptions::Error`.
729
+
9
730
  ## [3.9.0] - 2026-08-11
10
731
  ### Added
11
732
  - Added support for using multiple glossaries in text and document translation
@@ -103,7 +824,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
103
824
  ### Added
104
825
  - Added `extra_body_parameters` option to text and document translation methods to pass arbitrary parameters in the request body. This can be used to access beta features or override built-in parameters (such as `target_lang`, `source_lang`, etc.).
105
826
  - Added `rephrase` functionality to the top-level `DeepL` module for convenience.
106
- * Thanks to [341bms](https://github.com/341bms) in [#14](https://github.com/DeepLcom/deepl-rb/issues/14) for the report!
827
+ * Thanks to [341bms](https://github.com/341bms) in [#14](https://github.com/DeepL/deepl-rb/issues/14) for the report!
107
828
 
108
829
  ## [3.2.0] - 2025-01-15
109
830
  ### Added
@@ -155,20 +876,22 @@ The change in major version is only due to the change in maintainership, there i
155
876
  ### Fixed
156
877
  - Make RequestEntityTooLarge error message more clear
157
878
 
158
- [Unreleased]: https://github.com/DeepLcom/deepl-rb/compare/v3.9.0...HEAD
159
- [3.9.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.8.0...v3.9.0
160
- [3.8.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.7.0...v3.8.0
161
- [3.7.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.6.1...v3.7.0
162
- [3.6.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.6.0...v3.6.1
163
- [3.6.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.5.1...v3.6.0
164
- [3.5.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.5.0...v3.5.1
165
- [3.5.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.4.1...v3.5.0
166
- [3.4.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.4.0...v3.4.1
167
- [3.4.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.3.0...v3.4.0
168
- [3.3.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.2.0...v3.3.0
169
- [3.2.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.1.0...v3.2.0
170
- [3.1.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.2...v3.1.0
171
- [3.0.2]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.1...v3.0.2
172
- [3.0.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.0...v3.0.1
173
- [3.0.0]: https://github.com/DeepLcom/deepl-rb/compare/v2.5.3...v3.0.0
174
- [2.5.3]: https://github.com/DeepLcom/deepl-rb/releases/tag/v2.5.3
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
881
+ [3.10.0]: https://github.com/DeepL/deepl-rb/compare/v3.9.0...v3.10.0
882
+ [3.9.0]: https://github.com/DeepL/deepl-rb/compare/v3.8.0...v3.9.0
883
+ [3.8.0]: https://github.com/DeepL/deepl-rb/compare/v3.7.0...v3.8.0
884
+ [3.7.0]: https://github.com/DeepL/deepl-rb/compare/v3.6.1...v3.7.0
885
+ [3.6.1]: https://github.com/DeepL/deepl-rb/compare/v3.6.0...v3.6.1
886
+ [3.6.0]: https://github.com/DeepL/deepl-rb/compare/v3.5.1...v3.6.0
887
+ [3.5.1]: https://github.com/DeepL/deepl-rb/compare/v3.5.0...v3.5.1
888
+ [3.5.0]: https://github.com/DeepL/deepl-rb/compare/v3.4.1...v3.5.0
889
+ [3.4.1]: https://github.com/DeepL/deepl-rb/compare/v3.4.0...v3.4.1
890
+ [3.4.0]: https://github.com/DeepL/deepl-rb/compare/v3.3.0...v3.4.0
891
+ [3.3.0]: https://github.com/DeepL/deepl-rb/compare/v3.2.0...v3.3.0
892
+ [3.2.0]: https://github.com/DeepL/deepl-rb/compare/v3.1.0...v3.2.0
893
+ [3.1.0]: https://github.com/DeepL/deepl-rb/compare/v3.0.2...v3.1.0
894
+ [3.0.2]: https://github.com/DeepL/deepl-rb/compare/v3.0.1...v3.0.2
895
+ [3.0.1]: https://github.com/DeepL/deepl-rb/compare/v3.0.0...v3.0.1
896
+ [3.0.0]: https://github.com/DeepL/deepl-rb/compare/v2.5.3...v3.0.0
897
+ [2.5.3]: https://github.com/DeepL/deepl-rb/releases/tag/v2.5.3