deepl-rb 3.2.0 → 3.4.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 (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -27
  3. data/README.md +71 -0
  4. metadata +3 -95
  5. data/.circleci/config.yml +0 -27
  6. data/.github/workflows/add_issues_to_kanban.yml +0 -16
  7. data/.gitlab-ci.yml +0 -135
  8. data/.rubocop.yml +0 -51
  9. data/CODE_OF_CONDUCT.md +0 -132
  10. data/CONTRIBUTING.md +0 -37
  11. data/Gemfile +0 -24
  12. data/Rakefile +0 -53
  13. data/SECURITY.md +0 -58
  14. data/VERSION +0 -1
  15. data/deepl-rb.gemspec +0 -132
  16. data/lib/deepl/api.rb +0 -22
  17. data/lib/deepl/configuration.rb +0 -59
  18. data/lib/deepl/constants/base_constant.rb +0 -18
  19. data/lib/deepl/constants/formality.rb +0 -16
  20. data/lib/deepl/constants/model_type.rb +0 -14
  21. data/lib/deepl/constants/split_sentences.rb +0 -14
  22. data/lib/deepl/constants/tag_handling.rb +0 -13
  23. data/lib/deepl/constants/tone.rb +0 -20
  24. data/lib/deepl/constants/writing_style.rb +0 -20
  25. data/lib/deepl/document_api.rb +0 -121
  26. data/lib/deepl/exceptions/authorization_failed.rb +0 -14
  27. data/lib/deepl/exceptions/bad_request.rb +0 -16
  28. data/lib/deepl/exceptions/document_translation_error.rb +0 -15
  29. data/lib/deepl/exceptions/error.rb +0 -14
  30. data/lib/deepl/exceptions/limit_exceeded.rb +0 -18
  31. data/lib/deepl/exceptions/not_found.rb +0 -16
  32. data/lib/deepl/exceptions/not_supported.rb +0 -14
  33. data/lib/deepl/exceptions/quota_exceeded.rb +0 -14
  34. data/lib/deepl/exceptions/request_entity_too_large.rb +0 -15
  35. data/lib/deepl/exceptions/request_error.rb +0 -21
  36. data/lib/deepl/exceptions/server_error.rb +0 -18
  37. data/lib/deepl/glossary_api.rb +0 -38
  38. data/lib/deepl/requests/base.rb +0 -163
  39. data/lib/deepl/requests/document/download.rb +0 -44
  40. data/lib/deepl/requests/document/get_status.rb +0 -44
  41. data/lib/deepl/requests/document/upload.rb +0 -64
  42. data/lib/deepl/requests/glossary/create.rb +0 -59
  43. data/lib/deepl/requests/glossary/destroy.rb +0 -37
  44. data/lib/deepl/requests/glossary/entries.rb +0 -37
  45. data/lib/deepl/requests/glossary/find.rb +0 -38
  46. data/lib/deepl/requests/glossary/language_pairs.rb +0 -38
  47. data/lib/deepl/requests/glossary/list.rb +0 -37
  48. data/lib/deepl/requests/languages.rb +0 -37
  49. data/lib/deepl/requests/rephrase.rb +0 -54
  50. data/lib/deepl/requests/translate.rb +0 -82
  51. data/lib/deepl/requests/usage.rb +0 -33
  52. data/lib/deepl/resources/base.rb +0 -17
  53. data/lib/deepl/resources/document_handle.rb +0 -57
  54. data/lib/deepl/resources/document_translation_status.rb +0 -54
  55. data/lib/deepl/resources/glossary.rb +0 -28
  56. data/lib/deepl/resources/language.rb +0 -30
  57. data/lib/deepl/resources/language_pair.rb +0 -23
  58. data/lib/deepl/resources/text.rb +0 -24
  59. data/lib/deepl/resources/usage.rb +0 -27
  60. data/lib/deepl/utils/backoff_timer.rb +0 -46
  61. data/lib/deepl/utils/exception_builder.rb +0 -34
  62. data/lib/deepl.rb +0 -142
  63. data/lib/http_client_options.rb +0 -22
  64. data/spec/api/api_spec.rb +0 -20
  65. data/spec/api/configuration_spec.rb +0 -122
  66. data/spec/api/deepl_spec.rb +0 -431
  67. data/spec/constants/constants_spec.rb +0 -158
  68. data/spec/fixtures/vcr_cassettes/deepl_document.yml +0 -95
  69. data/spec/fixtures/vcr_cassettes/deepl_document_download.yml +0 -1214
  70. data/spec/fixtures/vcr_cassettes/deepl_glossaries.yml +0 -1163
  71. data/spec/fixtures/vcr_cassettes/deepl_languages.yml +0 -54
  72. data/spec/fixtures/vcr_cassettes/deepl_translate.yml +0 -358
  73. data/spec/fixtures/vcr_cassettes/deepl_usage.yml +0 -129
  74. data/spec/fixtures/vcr_cassettes/glossaries.yml +0 -1702
  75. data/spec/fixtures/vcr_cassettes/languages.yml +0 -229
  76. data/spec/fixtures/vcr_cassettes/rephrase_texts.yml +0 -401
  77. data/spec/fixtures/vcr_cassettes/translate_texts.yml +0 -10372
  78. data/spec/fixtures/vcr_cassettes/usage.yml +0 -171
  79. data/spec/integration_tests/document_api_spec.rb +0 -155
  80. data/spec/integration_tests/integration_test_utils.rb +0 -170
  81. data/spec/requests/glossary/create_spec.rb +0 -65
  82. data/spec/requests/glossary/destroy_spec.rb +0 -66
  83. data/spec/requests/glossary/entries_spec.rb +0 -62
  84. data/spec/requests/glossary/find_spec.rb +0 -68
  85. data/spec/requests/glossary/language_pairs_spec.rb +0 -40
  86. data/spec/requests/glossary/list_spec.rb +0 -54
  87. data/spec/requests/languages_spec.rb +0 -68
  88. data/spec/requests/rephrase_spec.rb +0 -172
  89. data/spec/requests/translate_spec.rb +0 -410
  90. data/spec/requests/usage_spec.rb +0 -43
  91. data/spec/resources/glossary_spec.rb +0 -38
  92. data/spec/resources/language_pair_spec.rb +0 -23
  93. data/spec/resources/language_spec.rb +0 -45
  94. data/spec/resources/text_spec.rb +0 -23
  95. data/spec/resources/usage_spec.rb +0 -35
  96. data/spec/spec_helper.rb +0 -92
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47bf797967929a4b7775e21ce7021cdc1871283b3358cbb36d13a8f6f6b5ac6b
4
- data.tar.gz: df4399cc6c552fb5c03b79b0566d2370101b58246bfd5e0b05d27c83e994ae6c
3
+ metadata.gz: 00b711743a7d8a7e5851e6985f624376f669ecaff43a25437485f77b42970b1c
4
+ data.tar.gz: b75a87f8ba086f6d8d7f67f5c7f955a95488722032d4d0c19547a1aa16b19156
5
5
  SHA512:
6
- metadata.gz: 4639c87e107dfa0a13b1bace938e9a3580fb15bb1e2f280267527e3d5d0c9b8913752b841bd095039f1e4f7d15b13813075131c0767216855bf5e7d28a4b81a1
7
- data.tar.gz: 19743f57e84c550e5fe35b1d6c39f853df1d0d1d357eb8c0f061a0202831af8a557651f34f50dcad10928b45638a3a09b9ab64652fdadab6d6ad62ec3f2a1242
6
+ metadata.gz: 8bd6e8200cae9ab13b19a20a30743e292074311f437e3c58658a176a4489f39667ca4d2dd056c36d0e76fade63b2832e3a8fb478bce348d6e746acb82ad07511
7
+ data.tar.gz: aa9bfb1bc15e12dbe612e68796651b20d7aeeef021fac5d5feb391dc9a55f6c3b22e8257b9b228d6bd62d826833fdf7022c42fd1b97411bbf4695ea69f7acf08
data/CHANGELOG.md CHANGED
@@ -4,59 +4,78 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [3.2.0]
7
+ ## [3.4.0] - 2025-11-17
8
8
  ### Added
9
- * Added `rephrase` functionality to get a new version of submitted text with various possible styles or tones applied
10
- * Added `DeepL::Constants` namespace and associated constant values for options possibilities
9
+ - Added support for the `GET /v3/style_rules` endpoint in the client library, the
10
+ implementation can be found in the `StyleRuleApi` class. Please refer to the
11
+ README for usage instructions
12
+ - Added `style_id` option to `translate()` which allows text translation with
13
+ style rules.
11
14
 
12
- ## [3.1.0]
15
+ ### Fixed
16
+ - Send correct library version in user-agent. Expose library version in the module as a variable.
17
+
18
+ ## [3.3.0] - 2025-11-04
19
+ ### Added
20
+ - 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.).
21
+ - Added `rephrase` functionality to the top-level `DeepL` module for convenience.
22
+ * Thanks to [341bms](https://github.com/341bms) in [#14](https://github.com/DeepLcom/deepl-rb/issues/14) for the report!
23
+
24
+ ## [3.2.0] - 2025-01-15
25
+ ### Added
26
+ - Added `rephrase` functionality to get a new version of submitted text with various possible styles or tones applied
27
+ - Added `DeepL::Constants` namespace and associated constant values for options possibilities
28
+
29
+ ## [3.1.0] - 2024-11-15
13
30
  ### Added
14
- * Added `model_type` option to `translate()` to use models with higher
31
+ - Added `model_type` option to `translate()` to use models with higher
15
32
  translation quality (available for some language pairs), or better latency.
16
33
  Options are `'quality_optimized'`, `'latency_optimized'`, and `'prefer_quality_optimized'`
17
- * Added the `model_type_used` field to the `translate()` response, that
34
+ - Added the `model_type_used` field to the `translate()` response, that
18
35
  indicates the translation model used when the `model_type` option is
19
36
  specified.
20
37
 
21
-
22
38
  ## [3.0.2] - 2024-10-02
23
39
  ### Added
24
- * Added doc example and tests for context parameter
40
+ - Added doc example and tests for context parameter
41
+
25
42
  ### Fixed
26
- * Fix metadata displayed on RubyGems.org for this library.
27
- * Fixed library version sent in the `User-Agent` string.
43
+ - Fix metadata displayed on RubyGems.org for this library.
44
+ - Fixed library version sent in the `User-Agent` string.
28
45
 
29
46
  ## [3.0.1] - 2024-09-23
30
47
  ### Fixed
31
- * `document.translate_document` required a filename, this is now optional. The example in the README now works.
48
+ - `document.translate_document` required a filename, this is now optional. The example in the README now works.
32
49
 
33
50
  ## [3.0.0] - 2024-09-20
34
51
  Beginning with version 3, deepl-rb is officially supported by DeepL, and maintained together with [Daniel Herzog](mailto:info@danielherzog.es) the developer of earlier versions of this library.
35
52
  The change in major version is only due to the change in maintainership, there is no migration necessary from v2 to v3.
53
+
36
54
  ### Added
37
- * Added rubocop-rspec linting for rspec test files
38
- * Added document translation to the ruby CL
39
- * Added possibility to use one HTTP session for multiple calls
40
- * Added platform and ruby version information to the user-agent string that is sent with API calls, along with an opt-out
41
- * Added support for logging of HTTP requests
42
- * Added support for using a proxy and a custom certificate file
43
- * Added a gitlab CI pipeline
55
+ - Added rubocop-rspec linting for rspec test files
56
+ - Added document translation to the ruby CL
57
+ - Added possibility to use one HTTP session for multiple calls
58
+ - Added platform and ruby version information to the user-agent string that is sent with API calls, along with an opt-out
59
+ - Added support for logging of HTTP requests
60
+ - Added support for using a proxy and a custom certificate file
61
+ - Added a gitlab CI pipeline
62
+
44
63
  ### Changed
45
- * HTTP requests to the DeepL API now use `application/json`, rather than `application/www-form-unencoded`
46
- * HTTP requests now automatically retry on transient failures, using exponential backoff
47
- ### Deprecated
64
+ - HTTP requests to the DeepL API now use `application/json`, rather than `application/www-form-unencoded`
65
+ - HTTP requests now automatically retry on transient failures, using exponential backoff
66
+
48
67
  ### Removed
49
- * Removed CircleCI and CodeCov upload
50
- ### Fixed
51
- ### Security
68
+ - Removed CircleCI and CodeCov upload
52
69
 
53
70
  ## [2.5.3] - 2022-09-26
54
71
  ### Fixed
55
- * Make RequestEntityTooLarge error message more clear
72
+ - Make RequestEntityTooLarge error message more clear
56
73
 
57
- [3.2.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.1.0...3.2.0
74
+ [3.4.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.3.0...v3.4.0
75
+ [3.3.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.2.0...v3.3.0
76
+ [3.2.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.1.0...v3.2.0
58
77
  [3.1.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.2...v3.1.0
59
78
  [3.0.2]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.1...v3.0.2
60
79
  [3.0.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.0...v3.0.1
61
80
  [3.0.0]: https://github.com/DeepLcom/deepl-rb/compare/v2.5.3...v3.0.0
62
- [2.5.3]: https://github.com/DeepLcom/deepl-rb/compare/v2.5.2...v2.5.3
81
+ [2.5.3]: https://github.com/DeepLcom/deepl-rb/releases/tag/v2.5.3
data/README.md CHANGED
@@ -166,7 +166,10 @@ The following parameters will be automatically converted:
166
166
  | `ignore_tags` | Converts arrays to strings joining by commas
167
167
  | `formality` | No conversion applied
168
168
  | `glossary_id` | No conversion applied
169
+ | `style_id` | No conversion applied
170
+ | `style_rule` | No conversion applied (can be a string ID or a StyleRule object)
169
171
  | `context` | No conversion applied
172
+ | `extra_body_parameters` | Hash of extra parameters to pass in the body of the HTTP request. Can be used to access beta features, or to override built-in parameters for testing purposes. Extra parameters can override keys explicitly set by the client.
170
173
 
171
174
  ### Rephrase Text
172
175
 
@@ -293,6 +296,62 @@ puts language_pairs.first.target_lang
293
296
  # => de
294
297
  ```
295
298
 
299
+ ### Style Rules
300
+
301
+ Style rules allow you to customize your translations using a managed, shared list
302
+ of rules for style, formatting, and more. Multiple style rules can be stored with
303
+ your account, each with a user-specified name and a uniquely-assigned ID.
304
+
305
+ #### Creating and managing style rules
306
+
307
+ Currently style rules must be created and managed in the DeepL UI via
308
+ https://www.deepl.com/en/custom-rules. Full CRUD functionality via the APIs will
309
+ come shortly.
310
+
311
+ #### Listing all style rules
312
+
313
+ `style_rules.list` returns a list of `StyleRule` objects
314
+ corresponding to all of your stored style rules. The method accepts optional
315
+ parameters: `page` (page number for pagination, 0-indexed), `page_size` (number
316
+ of items per page), and `detailed` (whether to include detailed configuration
317
+ rules in the `configured_rules` property).
318
+
319
+ ```rb
320
+ # Get all style rules
321
+ style_rules = DeepL.style_rules.list
322
+ style_rules.each do |rule|
323
+ puts "#{rule.name} (#{rule.style_id})"
324
+ end
325
+
326
+ # Get style rules with detailed configuration
327
+ style_rules = DeepL.style_rules.list(detailed: true)
328
+ style_rules.each do |rule|
329
+ if rule.configured_rules
330
+ puts " Number formatting: #{rule.configured_rules.numbers.keys.join(', ')}"
331
+ end
332
+ end
333
+ ```
334
+
335
+ Created style rules can be used in the `translate` method by specifying the `style_id` option:
336
+
337
+ ```rb
338
+ translation = DeepL.translate 'Hello World', 'EN', 'ES', style_id: 'dca2e053-8ae5-45e6-a0d2-881156e7f4e4'
339
+
340
+ puts translation.class
341
+ # => DeepL::Resources::Text
342
+ puts translation.text
343
+ # => 'Hola Mundo'
344
+ ```
345
+
346
+ You can also pass a `StyleRule` object directly:
347
+
348
+ ```rb
349
+ style_rules = DeepL.style_rules.list
350
+ style_rule = style_rules.first
351
+
352
+ translation = DeepL.translate 'Hello World', 'EN', 'ES', style_rule: style_rule
353
+ ```
354
+
296
355
  ### Monitor usage
297
356
 
298
357
  To check current API usage, use:
@@ -322,6 +381,18 @@ doc_status = doc_handle.wait_until_document_translation_finished # alternatively
322
381
  DeepL.document.download(doc_handle, '/path/to/translated_document.pdf') unless doc_status.error?
323
382
  ```
324
383
 
384
+ You can also pass additional options to document translation methods, including `extra_body_parameters`:
385
+
386
+ ```rb
387
+ options = {
388
+ formality: 'more',
389
+ extra_body_parameters: { example_param: 'true' }
390
+ }
391
+ doc_handle = DeepL.document.upload('/path/to/spanish_document.pdf', 'ES', 'EN', nil, options)
392
+ ```
393
+
394
+ The `extra_body_parameters` option allows you to pass arbitrary parameters in the request body. This can be used to access beta features by adding new parameters, or to override built-in parameters (such as `target_lang`, `source_lang`, etc.) for testing purposes.
395
+
325
396
  ### Handle exceptions
326
397
 
327
398
  You can capture and process exceptions that may be raised during API calls. These are all the possible exceptions:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deepl-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DeepL SE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-15 00:00:00.000000000 Z
11
+ date: 2025-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: juwelier
@@ -49,102 +49,10 @@ extra_rdoc_files:
49
49
  - README.md
50
50
  - license_checker.sh
51
51
  files:
52
- - ".circleci/config.yml"
53
- - ".github/workflows/add_issues_to_kanban.yml"
54
- - ".gitlab-ci.yml"
55
- - ".rubocop.yml"
56
52
  - CHANGELOG.md
57
- - CODE_OF_CONDUCT.md
58
- - CONTRIBUTING.md
59
- - Gemfile
60
53
  - LICENSE.md
61
54
  - README.md
62
- - Rakefile
63
- - SECURITY.md
64
- - VERSION
65
- - deepl-rb.gemspec
66
- - lib/deepl.rb
67
- - lib/deepl/api.rb
68
- - lib/deepl/configuration.rb
69
- - lib/deepl/constants/base_constant.rb
70
- - lib/deepl/constants/formality.rb
71
- - lib/deepl/constants/model_type.rb
72
- - lib/deepl/constants/split_sentences.rb
73
- - lib/deepl/constants/tag_handling.rb
74
- - lib/deepl/constants/tone.rb
75
- - lib/deepl/constants/writing_style.rb
76
- - lib/deepl/document_api.rb
77
- - lib/deepl/exceptions/authorization_failed.rb
78
- - lib/deepl/exceptions/bad_request.rb
79
- - lib/deepl/exceptions/document_translation_error.rb
80
- - lib/deepl/exceptions/error.rb
81
- - lib/deepl/exceptions/limit_exceeded.rb
82
- - lib/deepl/exceptions/not_found.rb
83
- - lib/deepl/exceptions/not_supported.rb
84
- - lib/deepl/exceptions/quota_exceeded.rb
85
- - lib/deepl/exceptions/request_entity_too_large.rb
86
- - lib/deepl/exceptions/request_error.rb
87
- - lib/deepl/exceptions/server_error.rb
88
- - lib/deepl/glossary_api.rb
89
- - lib/deepl/requests/base.rb
90
- - lib/deepl/requests/document/download.rb
91
- - lib/deepl/requests/document/get_status.rb
92
- - lib/deepl/requests/document/upload.rb
93
- - lib/deepl/requests/glossary/create.rb
94
- - lib/deepl/requests/glossary/destroy.rb
95
- - lib/deepl/requests/glossary/entries.rb
96
- - lib/deepl/requests/glossary/find.rb
97
- - lib/deepl/requests/glossary/language_pairs.rb
98
- - lib/deepl/requests/glossary/list.rb
99
- - lib/deepl/requests/languages.rb
100
- - lib/deepl/requests/rephrase.rb
101
- - lib/deepl/requests/translate.rb
102
- - lib/deepl/requests/usage.rb
103
- - lib/deepl/resources/base.rb
104
- - lib/deepl/resources/document_handle.rb
105
- - lib/deepl/resources/document_translation_status.rb
106
- - lib/deepl/resources/glossary.rb
107
- - lib/deepl/resources/language.rb
108
- - lib/deepl/resources/language_pair.rb
109
- - lib/deepl/resources/text.rb
110
- - lib/deepl/resources/usage.rb
111
- - lib/deepl/utils/backoff_timer.rb
112
- - lib/deepl/utils/exception_builder.rb
113
- - lib/http_client_options.rb
114
55
  - license_checker.sh
115
- - spec/api/api_spec.rb
116
- - spec/api/configuration_spec.rb
117
- - spec/api/deepl_spec.rb
118
- - spec/constants/constants_spec.rb
119
- - spec/fixtures/vcr_cassettes/deepl_document.yml
120
- - spec/fixtures/vcr_cassettes/deepl_document_download.yml
121
- - spec/fixtures/vcr_cassettes/deepl_glossaries.yml
122
- - spec/fixtures/vcr_cassettes/deepl_languages.yml
123
- - spec/fixtures/vcr_cassettes/deepl_translate.yml
124
- - spec/fixtures/vcr_cassettes/deepl_usage.yml
125
- - spec/fixtures/vcr_cassettes/glossaries.yml
126
- - spec/fixtures/vcr_cassettes/languages.yml
127
- - spec/fixtures/vcr_cassettes/rephrase_texts.yml
128
- - spec/fixtures/vcr_cassettes/translate_texts.yml
129
- - spec/fixtures/vcr_cassettes/usage.yml
130
- - spec/integration_tests/document_api_spec.rb
131
- - spec/integration_tests/integration_test_utils.rb
132
- - spec/requests/glossary/create_spec.rb
133
- - spec/requests/glossary/destroy_spec.rb
134
- - spec/requests/glossary/entries_spec.rb
135
- - spec/requests/glossary/find_spec.rb
136
- - spec/requests/glossary/language_pairs_spec.rb
137
- - spec/requests/glossary/list_spec.rb
138
- - spec/requests/languages_spec.rb
139
- - spec/requests/rephrase_spec.rb
140
- - spec/requests/translate_spec.rb
141
- - spec/requests/usage_spec.rb
142
- - spec/resources/glossary_spec.rb
143
- - spec/resources/language_pair_spec.rb
144
- - spec/resources/language_spec.rb
145
- - spec/resources/text_spec.rb
146
- - spec/resources/usage_spec.rb
147
- - spec/spec_helper.rb
148
56
  homepage: https://github.com/DeepLcom/deepl-rb
149
57
  licenses:
150
58
  - MIT
@@ -168,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
76
  - !ruby/object:Gem::Version
169
77
  version: '0'
170
78
  requirements: []
171
- rubygems_version: 3.5.3
79
+ rubygems_version: 3.4.6
172
80
  signing_key:
173
81
  specification_version: 4
174
82
  summary: Official Ruby library for the DeepL language translation API.
data/.circleci/config.yml DELETED
@@ -1,27 +0,0 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/deepl-rb
5
- docker:
6
- - image: circleci/ruby:2.7
7
- steps:
8
- - checkout
9
-
10
- - run:
11
- name: Bundle Install
12
- command: bundle install --path vendor/bundle
13
-
14
- # Run rspec
15
- - type: shell
16
- command: |
17
- bundle exec rspec $(circleci tests glob "spec/**/*_spec.rb" |
18
- circleci tests split --split-by=timings)
19
-
20
- # Run rubocop
21
- - type: shell
22
- command: |
23
- bundle exec rubocop
24
-
25
- # Save test results for timing analysis
26
- - store_test_results:
27
- path: test_results
@@ -1,16 +0,0 @@
1
- name: Add bugs to bugs project
2
-
3
- on:
4
- issues:
5
- types:
6
- - opened
7
-
8
- jobs:
9
- add-to-project:
10
- name: Add issue to project
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/add-to-project@v0.5.0
14
- with:
15
- project-url: https://github.com/orgs/DeepLcom/projects/1
16
- github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
data/.gitlab-ci.yml DELETED
@@ -1,135 +0,0 @@
1
- # Note: This GitLab CI configuration is used for internal testing, users can ignore it.
2
- include:
3
- - project: '${CI_PROJECT_NAMESPACE}/ci-libs-for-client-libraries'
4
- file:
5
- - '/${CI_PROJECT_NAME}/.gitlab-ci.yml'
6
- - project: 'deepl/ops/ci-cd-infrastructure/gitlab-ci-lib'
7
- file:
8
- - '/templates/.buildkit.yml'
9
- - '/templates/.secret-detection.yml'
10
-
11
- # Global --------------------------
12
-
13
- workflow:
14
- rules:
15
- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
16
- - if: $CI_COMMIT_TAG
17
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
18
-
19
- stages:
20
- - install
21
- - check
22
- - test
23
- # - publish
24
-
25
-
26
- before_script:
27
- - ruby --version
28
- - bundle install
29
-
30
- # stage: install ----------------------
31
-
32
- package:
33
- stage: install
34
- parallel:
35
- matrix:
36
- - DOCKER_IMAGE: 'ruby:2.7'
37
- - DOCKER_IMAGE: 'ruby:3.2'
38
- - DOCKER_IMAGE: 'ruby:3.3'
39
- image:
40
- name: ${DOCKER_IMAGE}
41
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
42
- script:
43
- - bundle exec rake build
44
- artifacts:
45
- paths:
46
- - pkg/
47
-
48
- # stage: check ----------------------
49
-
50
- .rubocop_base:
51
- stage: check
52
- image:
53
- name: ruby:2.7
54
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
55
- script: bundle exec rubocop
56
-
57
- rubocop_scheduled:
58
- extends: .rubocop_base
59
- rules:
60
- - if: $CI_PIPELINE_SOURCE == "schedule"
61
- retry: 2
62
-
63
- rubocop_manual:
64
- extends: .rubocop_base
65
- rules:
66
- - if: $CI_PIPELINE_SOURCE != "schedule"
67
-
68
- secret_detection:
69
- extends: .secret-detection
70
- stage: check
71
- image: !reference [.secret-detection, image]
72
- before_script:
73
- - echo "overriding default before_script..."
74
- rules:
75
- - if: $CI_MERGE_REQUEST_ID
76
-
77
- license_check:
78
- stage: check
79
- before_script:
80
- - echo "overriding default before_script..."
81
- script:
82
- - ./license_checker.sh '*.rb' | tee license_check_output.txt
83
- - '[ ! -s license_check_output.txt ]'
84
-
85
-
86
- # stage: test ----------------------
87
-
88
- .test_base:
89
- stage: test
90
- extends: .test
91
- parallel:
92
- matrix:
93
- - DOCKER_IMAGE: 'ruby:2.7'
94
- - DOCKER_IMAGE: 'ruby:3.2'
95
- - DOCKER_IMAGE: 'ruby:3.3'
96
- - DOCKER_IMAGE: 'ruby:2.7'
97
- USE_MOCK_SERVER: "use mock server"
98
- - DOCKER_IMAGE: 'ruby:3.2'
99
- USE_MOCK_SERVER: "use mock server"
100
- - DOCKER_IMAGE: 'ruby:3.3'
101
- USE_MOCK_SERVER: "use mock server"
102
- image:
103
- name: ${DOCKER_IMAGE}
104
- entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
105
- script:
106
- - >
107
- if [[ ! -z "${USE_MOCK_SERVER}" ]]; then
108
- echo "Using mock server"
109
- export DEEPL_SERVER_URL=http://deepl-mock:3000
110
- export DEEPL_MOCK_SERVER_PORT=3000
111
- export DEEPL_PROXY_URL=http://deepl-mock:3001
112
- export DEEPL_MOCK_PROXY_SERVER_PORT=3001
113
- fi
114
- - bundle exec rake test
115
- - bundle exec rspec --format RspecJunitFormatter --out rspec.xml
116
- artifacts:
117
- reports:
118
- coverage_report:
119
- coverage_format: cobertura
120
- path: coverage/coverage.xml
121
- junit:
122
- - rspec.xml
123
- when: always
124
-
125
- test_scheduled:
126
- extends: .test_base
127
- rules:
128
- - if: $CI_PIPELINE_SOURCE == "schedule"
129
- retry: 2
130
-
131
- test_manual:
132
- stage: test
133
- extends: .test_base
134
- rules:
135
- - if: $CI_PIPELINE_SOURCE != "schedule"
data/.rubocop.yml DELETED
@@ -1,51 +0,0 @@
1
- # Custom rubocop configuration
2
-
3
- require:
4
- - rubocop-rspec
5
-
6
- AllCops:
7
- DisplayCopNames: true
8
- NewCops: enable
9
- Exclude:
10
- - deepl-rb.gemspec
11
- - vendor/**/*
12
- TargetRubyVersion: 2.7.5
13
-
14
- Metrics/BlockLength:
15
- Exclude:
16
- - "**/*_spec.rb"
17
-
18
- Metrics/ParameterLists:
19
- Max: 6
20
-
21
- Layout/LineLength:
22
- Max: 100
23
-
24
- RSpec/ExampleLength:
25
- Max: 10
26
- CountAsOne: ['heredoc']
27
-
28
- RSpec/MessageSpies:
29
- EnforcedStyle: 'receive'
30
-
31
- RSpec/MultipleExpectations:
32
- Max: 8
33
-
34
- RSpec/MultipleMemoizedHelpers:
35
- Max: 7
36
-
37
- RSpec/NestedGroups:
38
- Max: 4
39
-
40
- RSpec/SpecFilePathSuffix:
41
- Enabled: false
42
-
43
- RSpec/SpecFilePathFormat:
44
- CustomTransform:
45
- DeepL: ''
46
-
47
- Style/Documentation:
48
- Enabled: false
49
-
50
- Style/ModuleFunction:
51
- EnforcedStyle: extend_self