deepl-rb 3.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/README.md +58 -0
- metadata +2 -95
- data/.circleci/config.yml +0 -27
- data/.github/workflows/add_issues_to_kanban.yml +0 -16
- data/.gitlab-ci.yml +0 -172
- data/.rubocop.yml +0 -51
- data/CODE_OF_CONDUCT.md +0 -132
- data/CONTRIBUTING.md +0 -37
- data/Gemfile +0 -24
- data/Rakefile +0 -54
- data/SECURITY.md +0 -58
- data/VERSION +0 -1
- data/deepl-rb.gemspec +0 -133
- data/lib/deepl/api.rb +0 -22
- data/lib/deepl/configuration.rb +0 -59
- data/lib/deepl/constants/base_constant.rb +0 -18
- data/lib/deepl/constants/formality.rb +0 -16
- data/lib/deepl/constants/model_type.rb +0 -14
- data/lib/deepl/constants/split_sentences.rb +0 -14
- data/lib/deepl/constants/tag_handling.rb +0 -13
- data/lib/deepl/constants/tone.rb +0 -20
- data/lib/deepl/constants/writing_style.rb +0 -20
- data/lib/deepl/document_api.rb +0 -121
- data/lib/deepl/exceptions/authorization_failed.rb +0 -14
- data/lib/deepl/exceptions/bad_request.rb +0 -16
- data/lib/deepl/exceptions/document_translation_error.rb +0 -15
- data/lib/deepl/exceptions/error.rb +0 -14
- data/lib/deepl/exceptions/limit_exceeded.rb +0 -18
- data/lib/deepl/exceptions/not_found.rb +0 -16
- data/lib/deepl/exceptions/not_supported.rb +0 -14
- data/lib/deepl/exceptions/quota_exceeded.rb +0 -14
- data/lib/deepl/exceptions/request_entity_too_large.rb +0 -15
- data/lib/deepl/exceptions/request_error.rb +0 -21
- data/lib/deepl/exceptions/server_error.rb +0 -18
- data/lib/deepl/glossary_api.rb +0 -38
- data/lib/deepl/requests/base.rb +0 -196
- data/lib/deepl/requests/document/download.rb +0 -44
- data/lib/deepl/requests/document/get_status.rb +0 -44
- data/lib/deepl/requests/document/upload.rb +0 -74
- data/lib/deepl/requests/glossary/create.rb +0 -59
- data/lib/deepl/requests/glossary/destroy.rb +0 -37
- data/lib/deepl/requests/glossary/entries.rb +0 -37
- data/lib/deepl/requests/glossary/find.rb +0 -38
- data/lib/deepl/requests/glossary/language_pairs.rb +0 -38
- data/lib/deepl/requests/glossary/list.rb +0 -37
- data/lib/deepl/requests/languages.rb +0 -37
- data/lib/deepl/requests/rephrase.rb +0 -55
- data/lib/deepl/requests/translate.rb +0 -82
- data/lib/deepl/requests/usage.rb +0 -33
- data/lib/deepl/resources/base.rb +0 -17
- data/lib/deepl/resources/document_handle.rb +0 -57
- data/lib/deepl/resources/document_translation_status.rb +0 -54
- data/lib/deepl/resources/glossary.rb +0 -28
- data/lib/deepl/resources/language.rb +0 -30
- data/lib/deepl/resources/language_pair.rb +0 -23
- data/lib/deepl/resources/text.rb +0 -24
- data/lib/deepl/resources/usage.rb +0 -27
- data/lib/deepl/utils/backoff_timer.rb +0 -46
- data/lib/deepl/utils/exception_builder.rb +0 -34
- data/lib/deepl.rb +0 -147
- data/lib/http_client_options.rb +0 -22
- data/spec/api/api_spec.rb +0 -20
- data/spec/api/configuration_spec.rb +0 -122
- data/spec/api/deepl_spec.rb +0 -460
- data/spec/constants/constants_spec.rb +0 -158
- data/spec/fixtures/vcr_cassettes/deepl_document.yml +0 -95
- data/spec/fixtures/vcr_cassettes/deepl_document_download.yml +0 -1214
- data/spec/fixtures/vcr_cassettes/deepl_glossaries.yml +0 -1163
- data/spec/fixtures/vcr_cassettes/deepl_languages.yml +0 -54
- data/spec/fixtures/vcr_cassettes/deepl_rephrase.yml +0 -87
- data/spec/fixtures/vcr_cassettes/deepl_translate.yml +0 -358
- data/spec/fixtures/vcr_cassettes/deepl_usage.yml +0 -129
- data/spec/fixtures/vcr_cassettes/glossaries.yml +0 -1702
- data/spec/fixtures/vcr_cassettes/languages.yml +0 -229
- data/spec/fixtures/vcr_cassettes/rephrase_texts.yml +0 -401
- data/spec/fixtures/vcr_cassettes/translate_texts.yml +0 -10415
- data/spec/fixtures/vcr_cassettes/usage.yml +0 -171
- data/spec/integration_tests/document_api_spec.rb +0 -177
- data/spec/integration_tests/integration_test_utils.rb +0 -170
- data/spec/requests/glossary/create_spec.rb +0 -65
- data/spec/requests/glossary/destroy_spec.rb +0 -66
- data/spec/requests/glossary/entries_spec.rb +0 -62
- data/spec/requests/glossary/find_spec.rb +0 -68
- data/spec/requests/glossary/language_pairs_spec.rb +0 -40
- data/spec/requests/glossary/list_spec.rb +0 -54
- data/spec/requests/languages_spec.rb +0 -68
- data/spec/requests/rephrase_spec.rb +0 -172
- data/spec/requests/translate_spec.rb +0 -422
- data/spec/requests/usage_spec.rb +0 -43
- data/spec/resources/glossary_spec.rb +0 -38
- data/spec/resources/language_pair_spec.rb +0 -23
- data/spec/resources/language_spec.rb +0 -45
- data/spec/resources/text_spec.rb +0 -23
- data/spec/resources/usage_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -92
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00b711743a7d8a7e5851e6985f624376f669ecaff43a25437485f77b42970b1c
|
|
4
|
+
data.tar.gz: b75a87f8ba086f6d8d7f67f5c7f955a95488722032d4d0c19547a1aa16b19156
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8bd6e8200cae9ab13b19a20a30743e292074311f437e3c58658a176a4489f39667ca4d2dd056c36d0e76fade63b2832e3a8fb478bce348d6e746acb82ad07511
|
|
7
|
+
data.tar.gz: aa9bfb1bc15e12dbe612e68796651b20d7aeeef021fac5d5feb391dc9a55f6c3b22e8257b9b228d6bd62d826833fdf7022c42fd1b97411bbf4695ea69f7acf08
|
data/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,16 @@ 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
|
-
## [
|
|
7
|
+
## [3.4.0] - 2025-11-17
|
|
8
|
+
### Added
|
|
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.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- Send correct library version in user-agent. Expose library version in the module as a variable.
|
|
8
17
|
|
|
9
18
|
## [3.3.0] - 2025-11-04
|
|
10
19
|
### Added
|
|
@@ -62,7 +71,7 @@ The change in major version is only due to the change in maintainership, there i
|
|
|
62
71
|
### Fixed
|
|
63
72
|
- Make RequestEntityTooLarge error message more clear
|
|
64
73
|
|
|
65
|
-
[
|
|
74
|
+
[3.4.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.3.0...v3.4.0
|
|
66
75
|
[3.3.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.2.0...v3.3.0
|
|
67
76
|
[3.2.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.1.0...v3.2.0
|
|
68
77
|
[3.1.0]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.2...v3.1.0
|
data/README.md
CHANGED
|
@@ -166,6 +166,8 @@ 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
|
|
170
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.
|
|
171
173
|
|
|
@@ -294,6 +296,62 @@ puts language_pairs.first.target_lang
|
|
|
294
296
|
# => de
|
|
295
297
|
```
|
|
296
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
|
+
|
|
297
355
|
### Monitor usage
|
|
298
356
|
|
|
299
357
|
To check current API usage, use:
|
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.
|
|
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-
|
|
11
|
+
date: 2025-12-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: juwelier
|
|
@@ -49,103 +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_rephrase.yml
|
|
124
|
-
- spec/fixtures/vcr_cassettes/deepl_translate.yml
|
|
125
|
-
- spec/fixtures/vcr_cassettes/deepl_usage.yml
|
|
126
|
-
- spec/fixtures/vcr_cassettes/glossaries.yml
|
|
127
|
-
- spec/fixtures/vcr_cassettes/languages.yml
|
|
128
|
-
- spec/fixtures/vcr_cassettes/rephrase_texts.yml
|
|
129
|
-
- spec/fixtures/vcr_cassettes/translate_texts.yml
|
|
130
|
-
- spec/fixtures/vcr_cassettes/usage.yml
|
|
131
|
-
- spec/integration_tests/document_api_spec.rb
|
|
132
|
-
- spec/integration_tests/integration_test_utils.rb
|
|
133
|
-
- spec/requests/glossary/create_spec.rb
|
|
134
|
-
- spec/requests/glossary/destroy_spec.rb
|
|
135
|
-
- spec/requests/glossary/entries_spec.rb
|
|
136
|
-
- spec/requests/glossary/find_spec.rb
|
|
137
|
-
- spec/requests/glossary/language_pairs_spec.rb
|
|
138
|
-
- spec/requests/glossary/list_spec.rb
|
|
139
|
-
- spec/requests/languages_spec.rb
|
|
140
|
-
- spec/requests/rephrase_spec.rb
|
|
141
|
-
- spec/requests/translate_spec.rb
|
|
142
|
-
- spec/requests/usage_spec.rb
|
|
143
|
-
- spec/resources/glossary_spec.rb
|
|
144
|
-
- spec/resources/language_pair_spec.rb
|
|
145
|
-
- spec/resources/language_spec.rb
|
|
146
|
-
- spec/resources/text_spec.rb
|
|
147
|
-
- spec/resources/usage_spec.rb
|
|
148
|
-
- spec/spec_helper.rb
|
|
149
56
|
homepage: https://github.com/DeepLcom/deepl-rb
|
|
150
57
|
licenses:
|
|
151
58
|
- MIT
|
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,172 +0,0 @@
|
|
|
1
|
-
# Note: This GitLab CI configuration is used for internal testing, users can ignore it.
|
|
2
|
-
include:
|
|
3
|
-
- template: Security/SAST.gitlab-ci.yml
|
|
4
|
-
- project: '${CI_PROJECT_NAMESPACE}/ci-libs-for-client-libraries'
|
|
5
|
-
file:
|
|
6
|
-
- '/${CI_PROJECT_NAME}/.gitlab-ci.yml'
|
|
7
|
-
- project: 'deepl/ops/ci-cd-infrastructure/gitlab-ci-lib'
|
|
8
|
-
file:
|
|
9
|
-
- '/templates/.buildkit.yml'
|
|
10
|
-
- '/templates/.secret-detection.yml'
|
|
11
|
-
- '/templates/.gitlab-release.yml'
|
|
12
|
-
|
|
13
|
-
# Global --------------------------
|
|
14
|
-
|
|
15
|
-
workflow:
|
|
16
|
-
rules:
|
|
17
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
18
|
-
- if: $CI_COMMIT_TAG
|
|
19
|
-
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
|
20
|
-
|
|
21
|
-
variables:
|
|
22
|
-
GITLAB_ADVANCED_SAST_ENABLED: 'true'
|
|
23
|
-
|
|
24
|
-
stages:
|
|
25
|
-
- install
|
|
26
|
-
- check
|
|
27
|
-
- test
|
|
28
|
-
- publish # Only for internal tracking
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
before_script:
|
|
32
|
-
- ruby --version
|
|
33
|
-
- bundle install
|
|
34
|
-
|
|
35
|
-
# stage: install ----------------------
|
|
36
|
-
|
|
37
|
-
package:
|
|
38
|
-
stage: install
|
|
39
|
-
parallel:
|
|
40
|
-
matrix:
|
|
41
|
-
- DOCKER_IMAGE: 'ruby:2.7'
|
|
42
|
-
- DOCKER_IMAGE: 'ruby:3.2'
|
|
43
|
-
- DOCKER_IMAGE: 'ruby:3.3'
|
|
44
|
-
image:
|
|
45
|
-
name: ${DOCKER_IMAGE}
|
|
46
|
-
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
|
|
47
|
-
script:
|
|
48
|
-
- bundle exec rake build
|
|
49
|
-
artifacts:
|
|
50
|
-
paths:
|
|
51
|
-
- pkg/
|
|
52
|
-
|
|
53
|
-
# stage: check ----------------------
|
|
54
|
-
|
|
55
|
-
.rubocop_base:
|
|
56
|
-
stage: check
|
|
57
|
-
image:
|
|
58
|
-
name: ruby:2.7
|
|
59
|
-
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
|
|
60
|
-
script: bundle exec rubocop
|
|
61
|
-
|
|
62
|
-
rubocop_scheduled:
|
|
63
|
-
extends: .rubocop_base
|
|
64
|
-
rules:
|
|
65
|
-
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
66
|
-
retry: 2
|
|
67
|
-
|
|
68
|
-
rubocop_manual:
|
|
69
|
-
extends: .rubocop_base
|
|
70
|
-
rules:
|
|
71
|
-
- if: $CI_PIPELINE_SOURCE != "schedule"
|
|
72
|
-
|
|
73
|
-
secret_detection:
|
|
74
|
-
extends: .secret-detection
|
|
75
|
-
stage: check
|
|
76
|
-
image: !reference [.secret-detection, image]
|
|
77
|
-
before_script:
|
|
78
|
-
- echo "overriding default before_script..."
|
|
79
|
-
rules:
|
|
80
|
-
- if: $CI_MERGE_REQUEST_ID
|
|
81
|
-
|
|
82
|
-
license_check:
|
|
83
|
-
stage: check
|
|
84
|
-
before_script:
|
|
85
|
-
- echo "overriding default before_script..."
|
|
86
|
-
script:
|
|
87
|
-
- ./license_checker.sh '*.rb' | tee license_check_output.txt
|
|
88
|
-
- '[ ! -s license_check_output.txt ]'
|
|
89
|
-
|
|
90
|
-
gitlab-advanced-sast:
|
|
91
|
-
stage: check
|
|
92
|
-
before_script:
|
|
93
|
-
- ''
|
|
94
|
-
rules:
|
|
95
|
-
- when: always
|
|
96
|
-
variables:
|
|
97
|
-
SAST_EXCLUDED_PATHS: '$DEFAULT_SAST_EXCLUDED_PATHS,/spec'
|
|
98
|
-
GIT_STRATEGY: clone
|
|
99
|
-
KUBERNETES_HELPER_MEMORY_LIMIT: 8Gi
|
|
100
|
-
SAST_SCANNER_ALLOWED_CLI_OPTS: --multi-core 8
|
|
101
|
-
|
|
102
|
-
semgrep-sast:
|
|
103
|
-
stage: check
|
|
104
|
-
before_script:
|
|
105
|
-
- ''
|
|
106
|
-
rules:
|
|
107
|
-
- when: always
|
|
108
|
-
variables:
|
|
109
|
-
SAST_EXCLUDED_PATHS: '$DEFAULT_SAST_EXCLUDED_PATHS,/spec'
|
|
110
|
-
GIT_STRATEGY: clone
|
|
111
|
-
KUBERNETES_MEMORY_LIMIT: 8Gi
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# stage: test ----------------------
|
|
115
|
-
|
|
116
|
-
.test_base:
|
|
117
|
-
stage: test
|
|
118
|
-
extends: .test
|
|
119
|
-
parallel:
|
|
120
|
-
matrix:
|
|
121
|
-
- DOCKER_IMAGE: 'ruby:2.7'
|
|
122
|
-
- DOCKER_IMAGE: 'ruby:3.2'
|
|
123
|
-
- DOCKER_IMAGE: 'ruby:3.3'
|
|
124
|
-
- DOCKER_IMAGE: 'ruby:2.7'
|
|
125
|
-
USE_MOCK_SERVER: "use mock server"
|
|
126
|
-
- DOCKER_IMAGE: 'ruby:3.2'
|
|
127
|
-
USE_MOCK_SERVER: "use mock server"
|
|
128
|
-
- DOCKER_IMAGE: 'ruby:3.3'
|
|
129
|
-
USE_MOCK_SERVER: "use mock server"
|
|
130
|
-
image:
|
|
131
|
-
name: ${DOCKER_IMAGE}
|
|
132
|
-
entrypoint: ['/builds/deepl/backend/oss-client-libs/deepl-ruby']
|
|
133
|
-
script:
|
|
134
|
-
- >
|
|
135
|
-
if [[ ! -z "${USE_MOCK_SERVER}" ]]; then
|
|
136
|
-
echo "Using mock server"
|
|
137
|
-
export DEEPL_SERVER_URL=http://deepl-mock:3000
|
|
138
|
-
export DEEPL_MOCK_SERVER_PORT=3000
|
|
139
|
-
export DEEPL_PROXY_URL=http://deepl-mock:3001
|
|
140
|
-
export DEEPL_MOCK_PROXY_SERVER_PORT=3001
|
|
141
|
-
fi
|
|
142
|
-
- bundle exec rake test
|
|
143
|
-
- bundle exec rspec --format RspecJunitFormatter --out rspec.xml
|
|
144
|
-
artifacts:
|
|
145
|
-
reports:
|
|
146
|
-
coverage_report:
|
|
147
|
-
coverage_format: cobertura
|
|
148
|
-
path: coverage/coverage.xml
|
|
149
|
-
junit:
|
|
150
|
-
- rspec.xml
|
|
151
|
-
when: always
|
|
152
|
-
|
|
153
|
-
test_scheduled:
|
|
154
|
-
extends: .test_base
|
|
155
|
-
rules:
|
|
156
|
-
- if: $CI_PIPELINE_SOURCE == "schedule"
|
|
157
|
-
retry: 2
|
|
158
|
-
|
|
159
|
-
test_manual:
|
|
160
|
-
stage: test
|
|
161
|
-
extends: .test_base
|
|
162
|
-
rules:
|
|
163
|
-
- if: $CI_PIPELINE_SOURCE != "schedule"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
# stage: publish ----------------------
|
|
167
|
-
|
|
168
|
-
gitlab release:
|
|
169
|
-
stage: publish
|
|
170
|
-
extends: .create_gitlab_release
|
|
171
|
-
rules:
|
|
172
|
-
- if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/'
|
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
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
-
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
-
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
-
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
-
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
-
identity and orientation.
|
|
11
|
-
|
|
12
|
-
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
-
diverse, inclusive, and healthy community.
|
|
14
|
-
|
|
15
|
-
## Our Standards
|
|
16
|
-
|
|
17
|
-
Examples of behavior that contributes to a positive environment for our
|
|
18
|
-
community include:
|
|
19
|
-
|
|
20
|
-
* Demonstrating empathy and kindness toward other people
|
|
21
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
-
* Giving and gracefully accepting constructive feedback
|
|
23
|
-
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
-
and learning from the experience
|
|
25
|
-
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
-
community
|
|
27
|
-
|
|
28
|
-
Examples of unacceptable behavior include:
|
|
29
|
-
|
|
30
|
-
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
-
any kind
|
|
32
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
-
* Public or private harassment
|
|
34
|
-
* Publishing others' private information, such as a physical or email address,
|
|
35
|
-
without their explicit permission
|
|
36
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
-
professional setting
|
|
38
|
-
|
|
39
|
-
## Enforcement Responsibilities
|
|
40
|
-
|
|
41
|
-
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
-
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
-
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
-
or harmful.
|
|
45
|
-
|
|
46
|
-
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
-
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
-
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
-
decisions when appropriate.
|
|
50
|
-
|
|
51
|
-
## Scope
|
|
52
|
-
|
|
53
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
-
an individual is officially representing the community in public spaces.
|
|
55
|
-
Examples of representing our community include using an official e-mail address,
|
|
56
|
-
posting via an official social media account, or acting as an appointed
|
|
57
|
-
representative at an online or offline event.
|
|
58
|
-
|
|
59
|
-
## Enforcement
|
|
60
|
-
|
|
61
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
-
reported to the community leaders responsible for enforcement at
|
|
63
|
-
[open-source@deepl.com](mailto:open-source@deepl.com).
|
|
64
|
-
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
-
|
|
66
|
-
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
-
reporter of any incident.
|
|
68
|
-
|
|
69
|
-
## Enforcement Guidelines
|
|
70
|
-
|
|
71
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
-
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
-
|
|
74
|
-
### 1. Correction
|
|
75
|
-
|
|
76
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
-
unprofessional or unwelcome in the community.
|
|
78
|
-
|
|
79
|
-
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
-
clarity around the nature of the violation and an explanation of why the
|
|
81
|
-
behavior was inappropriate. A public apology may be requested.
|
|
82
|
-
|
|
83
|
-
### 2. Warning
|
|
84
|
-
|
|
85
|
-
**Community Impact**: A violation through a single incident or series of
|
|
86
|
-
actions.
|
|
87
|
-
|
|
88
|
-
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
-
interaction with the people involved, including unsolicited interaction with
|
|
90
|
-
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
-
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
-
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
-
ban.
|
|
94
|
-
|
|
95
|
-
### 3. Temporary Ban
|
|
96
|
-
|
|
97
|
-
**Community Impact**: A serious violation of community standards, including
|
|
98
|
-
sustained inappropriate behavior.
|
|
99
|
-
|
|
100
|
-
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
-
communication with the community for a specified period of time. No public or
|
|
102
|
-
private interaction with the people involved, including unsolicited interaction
|
|
103
|
-
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
-
Violating these terms may lead to a permanent ban.
|
|
105
|
-
|
|
106
|
-
### 4. Permanent Ban
|
|
107
|
-
|
|
108
|
-
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
-
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
-
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
-
|
|
112
|
-
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
-
community.
|
|
114
|
-
|
|
115
|
-
## Attribution
|
|
116
|
-
|
|
117
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
-
version 2.1, available at
|
|
119
|
-
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
-
|
|
121
|
-
Community Impact Guidelines were inspired by
|
|
122
|
-
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
-
|
|
124
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
-
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
-
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
-
|
|
128
|
-
[homepage]: https://www.contributor-covenant.org
|
|
129
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
-
[translations]: https://www.contributor-covenant.org/translations
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# Contributing guidelines
|
|
2
|
-
|
|
3
|
-
* [Code of Conduct](#code-of-conduct)
|
|
4
|
-
* [Issues](#issues)
|
|
5
|
-
* [Pull Requests](#pull-requests)
|
|
6
|
-
|
|
7
|
-
## Code of Conduct
|
|
8
|
-
|
|
9
|
-
This project has a [Code of Conduct](CODE_OF_CONDUCT.md) to which all
|
|
10
|
-
contributors must adhere when participating in the project. Instances of
|
|
11
|
-
abusive, harassing, or otherwise unacceptable behavior may be reported by
|
|
12
|
-
contacting [open-source@deepl.com](mailto:open-source@deepl.com) and/or a
|
|
13
|
-
project maintainer.
|
|
14
|
-
|
|
15
|
-
## Issues
|
|
16
|
-
|
|
17
|
-
If you experience problems using the library, or would like to request a new
|
|
18
|
-
feature, please open an [issue][issues].
|
|
19
|
-
|
|
20
|
-
Please provide as much context as possible when you open an issue. The
|
|
21
|
-
information you provide must be comprehensive enough for us to reproduce the
|
|
22
|
-
issue.
|
|
23
|
-
|
|
24
|
-
## Pull Requests
|
|
25
|
-
|
|
26
|
-
You are welcome to contribute code and/or documentation in order to fix a bug or
|
|
27
|
-
to implement a new feature. Before beginning work, you should create an issue
|
|
28
|
-
describing the changes you plan to contribute, to avoid wasting or duplicating
|
|
29
|
-
effort. We will then let you know whether we would accept the changes.
|
|
30
|
-
|
|
31
|
-
Contributions must be licensed under the same license as the project:
|
|
32
|
-
[MIT License](LICENSE.md).
|
|
33
|
-
|
|
34
|
-
Currently automated testing is implemented internally at DeepL, however we plan
|
|
35
|
-
to implement publicly visible testing soon.
|
|
36
|
-
|
|
37
|
-
[issues]: https://www.github.com/DeepLcom/deepl-rb/issues
|
data/Gemfile
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source 'https://rubygems.org'
|
|
4
|
-
|
|
5
|
-
group :development do
|
|
6
|
-
# Gem management
|
|
7
|
-
gem 'juwelier'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
group :test, :development do
|
|
11
|
-
gem 'byebug', require: 'byebug'
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
group :test do
|
|
15
|
-
# Test
|
|
16
|
-
gem 'rspec'
|
|
17
|
-
gem 'rspec_junit_formatter'
|
|
18
|
-
gem 'rubocop'
|
|
19
|
-
gem 'rubocop-rspec'
|
|
20
|
-
gem 'simplecov'
|
|
21
|
-
gem 'simplecov-cobertura'
|
|
22
|
-
gem 'vcr'
|
|
23
|
-
gem 'webmock'
|
|
24
|
-
end
|