deepl-rb 3.9.0 → 3.10.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/.gitlab-ci.yml +70 -52
- data/.rubocop.yml +26 -0
- data/CHANGELOG.md +429 -18
- data/Gemfile +4 -0
- data/README.md +981 -223
- data/Rakefile +18 -5
- data/VERSION +1 -1
- data/deepl-rb.gemspec +6 -6
- data/lib/deepl/admin_client.rb +183 -0
- data/lib/deepl/api.rb +30 -6
- data/lib/deepl/app_info.rb +20 -0
- data/lib/deepl/client.rb +969 -0
- data/lib/deepl/configuration.rb +56 -10
- data/lib/deepl/constants/admin_usage_group_by.rb +13 -0
- data/lib/deepl/constants/custom_tag_usage_aggregate_by.rb +13 -0
- data/lib/deepl/constants/document_status_code.rb +17 -0
- data/lib/deepl/constants/language_include.rb +17 -0
- data/lib/deepl/constants/language_resource_name.rb +21 -0
- data/lib/deepl/constants/tag_handling_version.rb +14 -0
- data/lib/deepl/deprecation.rb +42 -0
- data/lib/deepl/document_api.rb +41 -22
- data/lib/deepl/exceptions/bad_request.rb +1 -3
- data/lib/deepl/exceptions/connection_error.rb +37 -0
- data/lib/deepl/exceptions/document_not_ready_error.rb +17 -0
- data/lib/deepl/exceptions/document_translation_error.rb +17 -1
- data/lib/deepl/exceptions/error.rb +13 -1
- data/lib/deepl/exceptions/not_found.rb +8 -3
- data/lib/deepl/exceptions/not_supported.rb +6 -0
- data/lib/deepl/exceptions/request_error.rb +19 -2
- data/lib/deepl/exceptions/server_error.rb +7 -1
- data/lib/deepl/exceptions/validation_error.rb +14 -0
- data/lib/deepl/requests/admin/base.rb +94 -0
- data/lib/deepl/requests/admin/create_developer_key.rb +38 -0
- data/lib/deepl/requests/admin/custom_tag_usage_analytics.rb +38 -0
- data/lib/deepl/requests/admin/list_developer_keys.rb +28 -0
- data/lib/deepl/requests/admin/update_developer_key.rb +35 -0
- data/lib/deepl/requests/admin/usage_analytics.rb +36 -0
- data/lib/deepl/requests/base.rb +229 -59
- data/lib/deepl/requests/correct.rb +57 -0
- data/lib/deepl/requests/document/download.rb +11 -3
- data/lib/deepl/requests/document/get_status.rb +2 -2
- data/lib/deepl/requests/document/upload.rb +43 -10
- data/lib/deepl/requests/glossary/create.rb +6 -2
- data/lib/deepl/requests/glossary/language_pairs.rb +20 -4
- data/lib/deepl/requests/language_resources.rb +41 -0
- data/lib/deepl/requests/languages.rb +28 -4
- data/lib/deepl/requests/languages_for_resource.rb +54 -0
- data/lib/deepl/requests/multilingual_glossary/create.rb +37 -0
- data/lib/deepl/requests/multilingual_glossary/destroy.rb +36 -0
- data/lib/deepl/requests/multilingual_glossary/destroy_dictionary.rb +51 -0
- data/lib/deepl/requests/multilingual_glossary/entries.rb +66 -0
- data/lib/deepl/requests/multilingual_glossary/find.rb +35 -0
- data/lib/deepl/requests/multilingual_glossary/helpers.rb +63 -0
- data/lib/deepl/requests/multilingual_glossary/list.rb +39 -0
- data/lib/deepl/requests/multilingual_glossary/replace_dictionary.rb +41 -0
- data/lib/deepl/requests/multilingual_glossary/update.rb +40 -0
- data/lib/deepl/requests/rephrase.rb +5 -9
- data/lib/deepl/requests/spoken_terms/create.rb +37 -0
- data/lib/deepl/requests/spoken_terms/destroy.rb +36 -0
- data/lib/deepl/requests/spoken_terms/destroy_term_list.rb +41 -0
- data/lib/deepl/requests/spoken_terms/entries.rb +46 -0
- data/lib/deepl/requests/spoken_terms/find.rb +35 -0
- data/lib/deepl/requests/spoken_terms/helpers.rb +67 -0
- data/lib/deepl/requests/spoken_terms/list.rb +35 -0
- data/lib/deepl/requests/spoken_terms/replace_term_list.rb +41 -0
- data/lib/deepl/requests/spoken_terms/update.rb +40 -0
- data/lib/deepl/requests/style_profile/base.rb +83 -0
- data/lib/deepl/requests/style_profile/create.rb +35 -0
- data/lib/deepl/requests/style_profile/destroy.rb +34 -0
- data/lib/deepl/requests/style_profile/find.rb +33 -0
- data/lib/deepl/requests/style_profile/list.rb +43 -0
- data/lib/deepl/requests/style_profile/update.rb +35 -0
- data/lib/deepl/requests/style_rule/create.rb +1 -1
- data/lib/deepl/requests/style_rule/create_custom_instruction.rb +4 -2
- data/lib/deepl/requests/style_rule/destroy.rb +4 -2
- data/lib/deepl/requests/style_rule/destroy_custom_instruction.rb +5 -3
- data/lib/deepl/requests/style_rule/find.rb +4 -2
- data/lib/deepl/requests/style_rule/find_custom_instruction.rb +5 -3
- data/lib/deepl/requests/style_rule/helpers.rb +35 -0
- data/lib/deepl/requests/style_rule/list.rb +1 -1
- data/lib/deepl/requests/style_rule/update.rb +4 -2
- data/lib/deepl/requests/style_rule/update_configured_rules.rb +4 -2
- data/lib/deepl/requests/style_rule/update_custom_instruction.rb +5 -3
- data/lib/deepl/requests/translate.rb +52 -20
- data/lib/deepl/requests/translation_memory/base.rb +1 -4
- data/lib/deepl/requests/translation_memory/create_export.rb +1 -1
- data/lib/deepl/requests/translation_memory/create_import.rb +1 -1
- data/lib/deepl/requests/translation_memory/destroy.rb +1 -1
- data/lib/deepl/requests/translation_memory/download_export.rb +4 -0
- data/lib/deepl/requests/translation_memory/find.rb +1 -1
- data/lib/deepl/requests/translation_memory/find_job.rb +1 -1
- data/lib/deepl/requests/translation_memory/list.rb +2 -1
- data/lib/deepl/requests/translation_memory/segments.rb +3 -2
- data/lib/deepl/requests/translation_memory/storage_base.rb +40 -8
- data/lib/deepl/requests/translation_memory/upload_file.rb +1 -1
- data/lib/deepl/requests/usage.rb +28 -1
- data/lib/deepl/requests/write_improvements.rb +35 -0
- data/lib/deepl/resources/admin_usage_report.rb +73 -0
- data/lib/deepl/resources/custom_tag_usage_report.rb +59 -0
- data/lib/deepl/resources/developer_key.rb +57 -0
- data/lib/deepl/resources/document_handle.rb +24 -25
- data/lib/deepl/resources/document_translation_status.rb +23 -4
- data/lib/deepl/resources/language.rb +10 -2
- data/lib/deepl/resources/language_resource.rb +57 -0
- data/lib/deepl/resources/language_support.rb +56 -0
- data/lib/deepl/resources/multilingual_glossary.rb +112 -0
- data/lib/deepl/resources/spoken_terms.rb +61 -0
- data/lib/deepl/resources/style_profile.rb +44 -0
- data/lib/deepl/resources/style_rule.rb +3 -0
- data/lib/deepl/resources/text.rb +18 -2
- data/lib/deepl/resources/translation_memory.rb +8 -2
- data/lib/deepl/resources/translation_memory_import.rb +1 -1
- data/lib/deepl/resources/translation_memory_job.rb +23 -3
- data/lib/deepl/resources/translation_memory_segments.rb +8 -6
- data/lib/deepl/resources/usage.rb +93 -4
- data/lib/deepl/style_rule_api.rb +11 -0
- data/lib/deepl/translation_memory_api.rb +104 -24
- data/lib/deepl/utils/client_builder.rb +54 -0
- data/lib/deepl/utils/document_poller.rb +70 -0
- data/lib/deepl/utils/exception_builder.rb +3 -2
- data/lib/deepl/utils/http_client_builder.rb +79 -0
- data/lib/deepl/utils/number_parser.rb +34 -0
- data/lib/deepl/utils/term_validator.rb +33 -0
- data/lib/deepl/utils/time_parser.rb +14 -0
- data/lib/deepl.rb +166 -41
- data/lib/http_client_options.rb +21 -1
- data/lib/version.rb +1 -1
- data/spec/fixtures.rb +33 -0
- data/spec/offline/admin_client_spec.rb +551 -0
- data/spec/offline/client_spec.rb +273 -0
- data/spec/{api → offline}/configuration_spec.rb +45 -3
- data/spec/{constants → offline}/constants_spec.rb +23 -1
- data/spec/offline/correct_text_spec.rb +50 -0
- data/spec/offline/deprecation_spec.rb +32 -0
- data/spec/offline/errors_spec.rb +92 -0
- data/spec/offline/glossaries_spec.rb +98 -0
- data/spec/offline/http_client_spec.rb +319 -0
- data/spec/offline/languages_spec.rb +155 -0
- data/spec/offline/module_methods_spec.rb +13 -0
- data/spec/offline/multilingual_glossaries_spec.rb +358 -0
- data/spec/offline/offline_helper.rb +71 -0
- data/spec/offline/rephrase_text_spec.rb +73 -0
- data/spec/offline/spoken_terms_spec.rb +215 -0
- data/spec/offline/style_profiles_spec.rb +266 -0
- data/spec/offline/style_rules_spec.rb +318 -0
- data/spec/offline/translate_document_spec.rb +606 -0
- data/spec/offline/translate_text_spec.rb +286 -0
- data/spec/offline/translation_memories_client_spec.rb +256 -0
- data/spec/offline/translation_memories_spec.rb +463 -0
- data/spec/offline/usage_spec.rb +151 -0
- data/spec/real_api/admin_client_spec.rb +77 -0
- data/spec/real_api/correct_text_spec.rb +20 -0
- data/spec/real_api/glossaries_spec.rb +28 -0
- data/spec/real_api/languages_spec.rb +27 -0
- data/spec/real_api/multilingual_glossaries_spec.rb +53 -0
- data/spec/real_api/proxy_spec.rb +41 -0
- data/spec/real_api/real_api_helper.rb +65 -0
- data/spec/real_api/rephrase_text_spec.rb +16 -0
- data/spec/real_api/spoken_terms_spec.rb +56 -0
- data/spec/real_api/style_profiles_spec.rb +46 -0
- data/spec/real_api/style_rules_spec.rb +46 -0
- data/spec/real_api/translate_document_spec.rb +18 -0
- data/spec/real_api/translate_text_spec.rb +16 -0
- data/spec/real_api/translation_memories_spec.rb +56 -0
- data/spec/real_api/usage_spec.rb +20 -0
- data/spec/spec_helper.rb +1 -50
- metadata +116 -76
- data/.circleci/config.yml +0 -27
- data/.github/workflows/add_issues_to_kanban.yml +0 -16
- data/spec/api/api_spec.rb +0 -20
- data/spec/api/deepl_spec.rb +0 -262
- data/spec/integration_tests/document_api_spec.rb +0 -211
- data/spec/integration_tests/document_error_paths_spec.rb +0 -33
- data/spec/integration_tests/glossary_api_spec.rb +0 -114
- data/spec/integration_tests/glossary_error_paths_spec.rb +0 -107
- data/spec/integration_tests/integration_test_utils.rb +0 -178
- data/spec/integration_tests/languages_api_spec.rb +0 -54
- data/spec/integration_tests/languages_error_paths_spec.rb +0 -25
- data/spec/integration_tests/rephrase_api_spec.rb +0 -90
- data/spec/integration_tests/rephrase_error_paths_spec.rb +0 -53
- data/spec/integration_tests/smoke_test_spec.rb +0 -24
- data/spec/integration_tests/style_rule_api_spec.rb +0 -117
- data/spec/integration_tests/style_rule_error_paths_spec.rb +0 -45
- data/spec/integration_tests/translate_api_spec.rb +0 -117
- data/spec/integration_tests/translate_error_paths_spec.rb +0 -48
- data/spec/integration_tests/translation_memory_api_spec.rb +0 -244
- data/spec/integration_tests/translation_memory_error_paths_spec.rb +0 -87
- data/spec/integration_tests/usage_api_spec.rb +0 -29
- data/spec/integration_tests/usage_error_paths_spec.rb +0 -18
- data/spec/requests/document/upload_spec.rb +0 -130
- data/spec/requests/extra_body_parameters_types_spec.rb +0 -82
- data/spec/requests/glossary/create_spec.rb +0 -44
- data/spec/requests/glossary/destroy_spec.rb +0 -27
- data/spec/requests/glossary/entries_spec.rb +0 -27
- data/spec/requests/glossary/find_spec.rb +0 -28
- data/spec/requests/glossary/language_pairs_spec.rb +0 -27
- data/spec/requests/glossary/list_spec.rb +0 -27
- data/spec/requests/languages_spec.rb +0 -27
- data/spec/requests/rephrase_spec.rb +0 -46
- data/spec/requests/style_rule/create_custom_instruction_spec.rb +0 -30
- data/spec/requests/style_rule/create_spec.rb +0 -29
- data/spec/requests/style_rule/destroy_custom_instruction_spec.rb +0 -28
- data/spec/requests/style_rule/destroy_spec.rb +0 -27
- data/spec/requests/style_rule/find_custom_instruction_spec.rb +0 -29
- data/spec/requests/style_rule/find_spec.rb +0 -28
- data/spec/requests/style_rule/list_spec.rb +0 -27
- data/spec/requests/style_rule/update_configured_rules_spec.rb +0 -31
- data/spec/requests/style_rule/update_custom_instruction_spec.rb +0 -32
- data/spec/requests/style_rule/update_spec.rb +0 -29
- data/spec/requests/translate_spec.rb +0 -338
- data/spec/requests/translation_memory/create_export_spec.rb +0 -37
- data/spec/requests/translation_memory/create_import_spec.rb +0 -61
- data/spec/requests/translation_memory/destroy_spec.rb +0 -36
- data/spec/requests/translation_memory/download_export_spec.rb +0 -54
- data/spec/requests/translation_memory/find_job_spec.rb +0 -37
- data/spec/requests/translation_memory/find_spec.rb +0 -36
- data/spec/requests/translation_memory/list_spec.rb +0 -27
- data/spec/requests/translation_memory/segments_spec.rb +0 -58
- data/spec/requests/translation_memory/upload_file_spec.rb +0 -55
- data/spec/requests/usage_spec.rb +0 -27
- data/spec/resources/custom_instruction_spec.rb +0 -32
- 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/style_rule_spec.rb +0 -68
- data/spec/resources/text_spec.rb +0 -23
- data/spec/resources/translation_memory_export_spec.rb +0 -38
- data/spec/resources/translation_memory_import_spec.rb +0 -30
- data/spec/resources/translation_memory_job_spec.rb +0 -109
- data/spec/resources/translation_memory_segments_spec.rb +0 -78
- data/spec/resources/translation_memory_spec.rb +0 -52
- data/spec/resources/usage_spec.rb +0 -35
- data/spec/support/live_mock_server.rb +0 -12
- data/spec/support/managed_glossary.rb +0 -65
- data/spec/support/managed_style_rule.rb +0 -17
- data/spec/support/managed_translation_memory.rb +0 -55
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.10.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: 2026-
|
|
11
|
+
date: 2026-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: juwelier
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: git
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "<"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '6'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "<"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '6'
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: byebug
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,13 +58,9 @@ email: open-source@deepl.com
|
|
|
44
58
|
executables: []
|
|
45
59
|
extensions: []
|
|
46
60
|
extra_rdoc_files:
|
|
47
|
-
- CHANGELOG.md
|
|
48
61
|
- LICENSE.md
|
|
49
62
|
- README.md
|
|
50
|
-
- license_checker.sh
|
|
51
63
|
files:
|
|
52
|
-
- ".circleci/config.yml"
|
|
53
|
-
- ".github/workflows/add_issues_to_kanban.yml"
|
|
54
64
|
- ".gitlab-ci.yml"
|
|
55
65
|
- ".rubocop.yml"
|
|
56
66
|
- CHANGELOG.md
|
|
@@ -64,18 +74,30 @@ files:
|
|
|
64
74
|
- VERSION
|
|
65
75
|
- deepl-rb.gemspec
|
|
66
76
|
- lib/deepl.rb
|
|
77
|
+
- lib/deepl/admin_client.rb
|
|
67
78
|
- lib/deepl/api.rb
|
|
79
|
+
- lib/deepl/app_info.rb
|
|
80
|
+
- lib/deepl/client.rb
|
|
68
81
|
- lib/deepl/configuration.rb
|
|
82
|
+
- lib/deepl/constants/admin_usage_group_by.rb
|
|
69
83
|
- lib/deepl/constants/base_constant.rb
|
|
84
|
+
- lib/deepl/constants/custom_tag_usage_aggregate_by.rb
|
|
85
|
+
- lib/deepl/constants/document_status_code.rb
|
|
70
86
|
- lib/deepl/constants/formality.rb
|
|
87
|
+
- lib/deepl/constants/language_include.rb
|
|
88
|
+
- lib/deepl/constants/language_resource_name.rb
|
|
71
89
|
- lib/deepl/constants/model_type.rb
|
|
72
90
|
- lib/deepl/constants/split_sentences.rb
|
|
73
91
|
- lib/deepl/constants/tag_handling.rb
|
|
92
|
+
- lib/deepl/constants/tag_handling_version.rb
|
|
74
93
|
- lib/deepl/constants/tone.rb
|
|
75
94
|
- lib/deepl/constants/writing_style.rb
|
|
95
|
+
- lib/deepl/deprecation.rb
|
|
76
96
|
- lib/deepl/document_api.rb
|
|
77
97
|
- lib/deepl/exceptions/authorization_failed.rb
|
|
78
98
|
- lib/deepl/exceptions/bad_request.rb
|
|
99
|
+
- lib/deepl/exceptions/connection_error.rb
|
|
100
|
+
- lib/deepl/exceptions/document_not_ready_error.rb
|
|
79
101
|
- lib/deepl/exceptions/document_translation_error.rb
|
|
80
102
|
- lib/deepl/exceptions/error.rb
|
|
81
103
|
- lib/deepl/exceptions/limit_exceeded.rb
|
|
@@ -85,8 +107,16 @@ files:
|
|
|
85
107
|
- lib/deepl/exceptions/request_entity_too_large.rb
|
|
86
108
|
- lib/deepl/exceptions/request_error.rb
|
|
87
109
|
- lib/deepl/exceptions/server_error.rb
|
|
110
|
+
- lib/deepl/exceptions/validation_error.rb
|
|
88
111
|
- lib/deepl/glossary_api.rb
|
|
112
|
+
- lib/deepl/requests/admin/base.rb
|
|
113
|
+
- lib/deepl/requests/admin/create_developer_key.rb
|
|
114
|
+
- lib/deepl/requests/admin/custom_tag_usage_analytics.rb
|
|
115
|
+
- lib/deepl/requests/admin/list_developer_keys.rb
|
|
116
|
+
- lib/deepl/requests/admin/update_developer_key.rb
|
|
117
|
+
- lib/deepl/requests/admin/usage_analytics.rb
|
|
89
118
|
- lib/deepl/requests/base.rb
|
|
119
|
+
- lib/deepl/requests/correct.rb
|
|
90
120
|
- lib/deepl/requests/document/download.rb
|
|
91
121
|
- lib/deepl/requests/document/get_status.rb
|
|
92
122
|
- lib/deepl/requests/document/upload.rb
|
|
@@ -96,14 +126,41 @@ files:
|
|
|
96
126
|
- lib/deepl/requests/glossary/find.rb
|
|
97
127
|
- lib/deepl/requests/glossary/language_pairs.rb
|
|
98
128
|
- lib/deepl/requests/glossary/list.rb
|
|
129
|
+
- lib/deepl/requests/language_resources.rb
|
|
99
130
|
- lib/deepl/requests/languages.rb
|
|
131
|
+
- lib/deepl/requests/languages_for_resource.rb
|
|
132
|
+
- lib/deepl/requests/multilingual_glossary/create.rb
|
|
133
|
+
- lib/deepl/requests/multilingual_glossary/destroy.rb
|
|
134
|
+
- lib/deepl/requests/multilingual_glossary/destroy_dictionary.rb
|
|
135
|
+
- lib/deepl/requests/multilingual_glossary/entries.rb
|
|
136
|
+
- lib/deepl/requests/multilingual_glossary/find.rb
|
|
137
|
+
- lib/deepl/requests/multilingual_glossary/helpers.rb
|
|
138
|
+
- lib/deepl/requests/multilingual_glossary/list.rb
|
|
139
|
+
- lib/deepl/requests/multilingual_glossary/replace_dictionary.rb
|
|
140
|
+
- lib/deepl/requests/multilingual_glossary/update.rb
|
|
100
141
|
- lib/deepl/requests/rephrase.rb
|
|
142
|
+
- lib/deepl/requests/spoken_terms/create.rb
|
|
143
|
+
- lib/deepl/requests/spoken_terms/destroy.rb
|
|
144
|
+
- lib/deepl/requests/spoken_terms/destroy_term_list.rb
|
|
145
|
+
- lib/deepl/requests/spoken_terms/entries.rb
|
|
146
|
+
- lib/deepl/requests/spoken_terms/find.rb
|
|
147
|
+
- lib/deepl/requests/spoken_terms/helpers.rb
|
|
148
|
+
- lib/deepl/requests/spoken_terms/list.rb
|
|
149
|
+
- lib/deepl/requests/spoken_terms/replace_term_list.rb
|
|
150
|
+
- lib/deepl/requests/spoken_terms/update.rb
|
|
151
|
+
- lib/deepl/requests/style_profile/base.rb
|
|
152
|
+
- lib/deepl/requests/style_profile/create.rb
|
|
153
|
+
- lib/deepl/requests/style_profile/destroy.rb
|
|
154
|
+
- lib/deepl/requests/style_profile/find.rb
|
|
155
|
+
- lib/deepl/requests/style_profile/list.rb
|
|
156
|
+
- lib/deepl/requests/style_profile/update.rb
|
|
101
157
|
- lib/deepl/requests/style_rule/create.rb
|
|
102
158
|
- lib/deepl/requests/style_rule/create_custom_instruction.rb
|
|
103
159
|
- lib/deepl/requests/style_rule/destroy.rb
|
|
104
160
|
- lib/deepl/requests/style_rule/destroy_custom_instruction.rb
|
|
105
161
|
- lib/deepl/requests/style_rule/find.rb
|
|
106
162
|
- lib/deepl/requests/style_rule/find_custom_instruction.rb
|
|
163
|
+
- lib/deepl/requests/style_rule/helpers.rb
|
|
107
164
|
- lib/deepl/requests/style_rule/list.rb
|
|
108
165
|
- lib/deepl/requests/style_rule/update.rb
|
|
109
166
|
- lib/deepl/requests/style_rule/update_configured_rules.rb
|
|
@@ -121,12 +178,21 @@ files:
|
|
|
121
178
|
- lib/deepl/requests/translation_memory/storage_base.rb
|
|
122
179
|
- lib/deepl/requests/translation_memory/upload_file.rb
|
|
123
180
|
- lib/deepl/requests/usage.rb
|
|
181
|
+
- lib/deepl/requests/write_improvements.rb
|
|
182
|
+
- lib/deepl/resources/admin_usage_report.rb
|
|
124
183
|
- lib/deepl/resources/base.rb
|
|
184
|
+
- lib/deepl/resources/custom_tag_usage_report.rb
|
|
185
|
+
- lib/deepl/resources/developer_key.rb
|
|
125
186
|
- lib/deepl/resources/document_handle.rb
|
|
126
187
|
- lib/deepl/resources/document_translation_status.rb
|
|
127
188
|
- lib/deepl/resources/glossary.rb
|
|
128
189
|
- lib/deepl/resources/language.rb
|
|
129
190
|
- lib/deepl/resources/language_pair.rb
|
|
191
|
+
- lib/deepl/resources/language_resource.rb
|
|
192
|
+
- lib/deepl/resources/language_support.rb
|
|
193
|
+
- lib/deepl/resources/multilingual_glossary.rb
|
|
194
|
+
- lib/deepl/resources/spoken_terms.rb
|
|
195
|
+
- lib/deepl/resources/style_profile.rb
|
|
130
196
|
- lib/deepl/resources/style_rule.rb
|
|
131
197
|
- lib/deepl/resources/text.rb
|
|
132
198
|
- lib/deepl/resources/translation_memory.rb
|
|
@@ -138,81 +204,55 @@ files:
|
|
|
138
204
|
- lib/deepl/style_rule_api.rb
|
|
139
205
|
- lib/deepl/translation_memory_api.rb
|
|
140
206
|
- lib/deepl/utils/backoff_timer.rb
|
|
207
|
+
- lib/deepl/utils/client_builder.rb
|
|
208
|
+
- lib/deepl/utils/document_poller.rb
|
|
141
209
|
- lib/deepl/utils/exception_builder.rb
|
|
210
|
+
- lib/deepl/utils/http_client_builder.rb
|
|
211
|
+
- lib/deepl/utils/number_parser.rb
|
|
212
|
+
- lib/deepl/utils/term_validator.rb
|
|
142
213
|
- lib/deepl/utils/time_parser.rb
|
|
143
214
|
- lib/http_client_options.rb
|
|
144
215
|
- lib/version.rb
|
|
145
216
|
- license_checker.sh
|
|
146
|
-
- spec/
|
|
147
|
-
- spec/
|
|
148
|
-
- spec/
|
|
149
|
-
- spec/
|
|
150
|
-
- spec/
|
|
151
|
-
- spec/
|
|
152
|
-
- spec/
|
|
153
|
-
- spec/
|
|
154
|
-
- spec/
|
|
155
|
-
- spec/
|
|
156
|
-
- spec/
|
|
157
|
-
- spec/
|
|
158
|
-
- spec/
|
|
159
|
-
- spec/
|
|
160
|
-
- spec/
|
|
161
|
-
- spec/
|
|
162
|
-
- spec/
|
|
163
|
-
- spec/
|
|
164
|
-
- spec/
|
|
165
|
-
- spec/
|
|
166
|
-
- spec/
|
|
167
|
-
- spec/
|
|
168
|
-
- spec/
|
|
169
|
-
- spec/
|
|
170
|
-
- spec/
|
|
171
|
-
- spec/
|
|
172
|
-
- spec/
|
|
173
|
-
- spec/
|
|
174
|
-
- spec/
|
|
175
|
-
- spec/
|
|
176
|
-
- spec/
|
|
177
|
-
- spec/
|
|
178
|
-
- spec/
|
|
179
|
-
- spec/
|
|
180
|
-
- spec/
|
|
181
|
-
- spec/
|
|
182
|
-
- spec/
|
|
183
|
-
- spec/
|
|
184
|
-
- spec/requests/style_rule/list_spec.rb
|
|
185
|
-
- spec/requests/style_rule/update_configured_rules_spec.rb
|
|
186
|
-
- spec/requests/style_rule/update_custom_instruction_spec.rb
|
|
187
|
-
- spec/requests/style_rule/update_spec.rb
|
|
188
|
-
- spec/requests/translate_spec.rb
|
|
189
|
-
- spec/requests/translation_memory/create_export_spec.rb
|
|
190
|
-
- spec/requests/translation_memory/create_import_spec.rb
|
|
191
|
-
- spec/requests/translation_memory/destroy_spec.rb
|
|
192
|
-
- spec/requests/translation_memory/download_export_spec.rb
|
|
193
|
-
- spec/requests/translation_memory/find_job_spec.rb
|
|
194
|
-
- spec/requests/translation_memory/find_spec.rb
|
|
195
|
-
- spec/requests/translation_memory/list_spec.rb
|
|
196
|
-
- spec/requests/translation_memory/segments_spec.rb
|
|
197
|
-
- spec/requests/translation_memory/upload_file_spec.rb
|
|
198
|
-
- spec/requests/usage_spec.rb
|
|
199
|
-
- spec/resources/custom_instruction_spec.rb
|
|
200
|
-
- spec/resources/glossary_spec.rb
|
|
201
|
-
- spec/resources/language_pair_spec.rb
|
|
202
|
-
- spec/resources/language_spec.rb
|
|
203
|
-
- spec/resources/style_rule_spec.rb
|
|
204
|
-
- spec/resources/text_spec.rb
|
|
205
|
-
- spec/resources/translation_memory_export_spec.rb
|
|
206
|
-
- spec/resources/translation_memory_import_spec.rb
|
|
207
|
-
- spec/resources/translation_memory_job_spec.rb
|
|
208
|
-
- spec/resources/translation_memory_segments_spec.rb
|
|
209
|
-
- spec/resources/translation_memory_spec.rb
|
|
210
|
-
- spec/resources/usage_spec.rb
|
|
217
|
+
- spec/fixtures.rb
|
|
218
|
+
- spec/offline/admin_client_spec.rb
|
|
219
|
+
- spec/offline/client_spec.rb
|
|
220
|
+
- spec/offline/configuration_spec.rb
|
|
221
|
+
- spec/offline/constants_spec.rb
|
|
222
|
+
- spec/offline/correct_text_spec.rb
|
|
223
|
+
- spec/offline/deprecation_spec.rb
|
|
224
|
+
- spec/offline/errors_spec.rb
|
|
225
|
+
- spec/offline/glossaries_spec.rb
|
|
226
|
+
- spec/offline/http_client_spec.rb
|
|
227
|
+
- spec/offline/languages_spec.rb
|
|
228
|
+
- spec/offline/module_methods_spec.rb
|
|
229
|
+
- spec/offline/multilingual_glossaries_spec.rb
|
|
230
|
+
- spec/offline/offline_helper.rb
|
|
231
|
+
- spec/offline/rephrase_text_spec.rb
|
|
232
|
+
- spec/offline/spoken_terms_spec.rb
|
|
233
|
+
- spec/offline/style_profiles_spec.rb
|
|
234
|
+
- spec/offline/style_rules_spec.rb
|
|
235
|
+
- spec/offline/translate_document_spec.rb
|
|
236
|
+
- spec/offline/translate_text_spec.rb
|
|
237
|
+
- spec/offline/translation_memories_client_spec.rb
|
|
238
|
+
- spec/offline/translation_memories_spec.rb
|
|
239
|
+
- spec/offline/usage_spec.rb
|
|
240
|
+
- spec/real_api/admin_client_spec.rb
|
|
241
|
+
- spec/real_api/correct_text_spec.rb
|
|
242
|
+
- spec/real_api/glossaries_spec.rb
|
|
243
|
+
- spec/real_api/languages_spec.rb
|
|
244
|
+
- spec/real_api/multilingual_glossaries_spec.rb
|
|
245
|
+
- spec/real_api/proxy_spec.rb
|
|
246
|
+
- spec/real_api/real_api_helper.rb
|
|
247
|
+
- spec/real_api/rephrase_text_spec.rb
|
|
248
|
+
- spec/real_api/spoken_terms_spec.rb
|
|
249
|
+
- spec/real_api/style_profiles_spec.rb
|
|
250
|
+
- spec/real_api/style_rules_spec.rb
|
|
251
|
+
- spec/real_api/translate_document_spec.rb
|
|
252
|
+
- spec/real_api/translate_text_spec.rb
|
|
253
|
+
- spec/real_api/translation_memories_spec.rb
|
|
254
|
+
- spec/real_api/usage_spec.rb
|
|
211
255
|
- spec/spec_helper.rb
|
|
212
|
-
- spec/support/live_mock_server.rb
|
|
213
|
-
- spec/support/managed_glossary.rb
|
|
214
|
-
- spec/support/managed_style_rule.rb
|
|
215
|
-
- spec/support/managed_translation_memory.rb
|
|
216
256
|
homepage: https://github.com/DeepLcom/deepl-rb
|
|
217
257
|
licenses:
|
|
218
258
|
- MIT
|
|
@@ -236,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
236
276
|
- !ruby/object:Gem::Version
|
|
237
277
|
version: '0'
|
|
238
278
|
requirements: []
|
|
239
|
-
rubygems_version: 3.
|
|
279
|
+
rubygems_version: 3.5.22
|
|
240
280
|
signing_key:
|
|
241
281
|
specification_version: 4
|
|
242
282
|
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/spec/api/api_spec.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# Copyright 2018 Daniel Herzog
|
|
2
|
-
# Use of this source code is governed by an MIT
|
|
3
|
-
# license that can be found in the LICENSE.md file.
|
|
4
|
-
# frozen_string_literal: true
|
|
5
|
-
|
|
6
|
-
require 'spec_helper'
|
|
7
|
-
|
|
8
|
-
describe DeepL::API do
|
|
9
|
-
subject(:api) { described_class.new(configuration) }
|
|
10
|
-
|
|
11
|
-
let(:configuration) { DeepL::Configuration.new }
|
|
12
|
-
|
|
13
|
-
describe '#initialize' do
|
|
14
|
-
context 'when building an API object' do
|
|
15
|
-
it 'saves the configuration' do
|
|
16
|
-
expect(api.configuration).to be(configuration)
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
data/spec/api/deepl_spec.rb
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
# Copyright 2018 Daniel Herzog
|
|
2
|
-
# Use of this source code is governed by an MIT
|
|
3
|
-
# license that can be found in the LICENSE.md file.
|
|
4
|
-
# frozen_string_literal: true
|
|
5
|
-
|
|
6
|
-
require 'spec_helper'
|
|
7
|
-
|
|
8
|
-
# rubocop:disable RSpec/StubbedMock
|
|
9
|
-
describe DeepL do # rubocop:disable RSpec/SpecFilePathFormat
|
|
10
|
-
subject(:deepl) { described_class.dup }
|
|
11
|
-
|
|
12
|
-
around do |tests|
|
|
13
|
-
tmp_env = replace_env_preserving_deepl_vars_except_mock_server
|
|
14
|
-
tests.call
|
|
15
|
-
ENV.replace(tmp_env)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
describe '#configure' do
|
|
19
|
-
context 'when providing no block' do
|
|
20
|
-
let(:configuration) { DeepL::Configuration.new }
|
|
21
|
-
|
|
22
|
-
before do
|
|
23
|
-
deepl.configure
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'uses default configuration' do
|
|
27
|
-
expect(deepl.configuration).to eq(configuration)
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
context 'when providing a valid configuration' do
|
|
32
|
-
let(:configuration) do
|
|
33
|
-
DeepL::Configuration.new({ auth_key: 'VALID', host: 'http://www.example.org',
|
|
34
|
-
version: 'v1' })
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
before do
|
|
38
|
-
deepl.configure do |config|
|
|
39
|
-
config.auth_key = configuration.auth_key
|
|
40
|
-
config.host = configuration.host
|
|
41
|
-
config.version = configuration.version
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
it 'uses the provided configuration' do
|
|
46
|
-
expect(deepl.configuration).to eq(configuration)
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
context 'when providing an invalid configuration' do
|
|
51
|
-
it 'raises an error' do
|
|
52
|
-
expect { deepl.configure { |c| c.auth_key = '' } }
|
|
53
|
-
.to raise_error(DeepL::Exceptions::Error)
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
describe '#translate' do
|
|
59
|
-
let(:request) { instance_double(DeepL::Requests::Translate, request: 'result') }
|
|
60
|
-
|
|
61
|
-
before { deepl.configure }
|
|
62
|
-
|
|
63
|
-
it 'delegates to DeepL::Requests::Translate with the given arguments' do
|
|
64
|
-
options = { formality: 'more' }
|
|
65
|
-
additional_headers = { 'X-DeepL-Reporting-Tag' => 'tag' }
|
|
66
|
-
expect(DeepL::Requests::Translate).to receive(:new)
|
|
67
|
-
.with(deepl.api, 'Sample', 'EN', 'ES', options, additional_headers)
|
|
68
|
-
.and_return(request)
|
|
69
|
-
|
|
70
|
-
expect(deepl.translate('Sample', 'EN', 'ES', options, additional_headers)).to eq('result')
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'defaults options and additional_headers to empty hashes' do
|
|
74
|
-
expect(DeepL::Requests::Translate).to receive(:new)
|
|
75
|
-
.with(deepl.api, 'Sample', 'EN', 'ES', {}, {})
|
|
76
|
-
.and_return(request)
|
|
77
|
-
|
|
78
|
-
deepl.translate('Sample', 'EN', 'ES')
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
describe '#rephrase' do
|
|
83
|
-
let(:request) { instance_double(DeepL::Requests::Rephrase, request: 'result') }
|
|
84
|
-
|
|
85
|
-
before { deepl.configure }
|
|
86
|
-
|
|
87
|
-
it 'delegates to DeepL::Requests::Rephrase with the given arguments' do
|
|
88
|
-
options = { foo: 'bar' }
|
|
89
|
-
additional_headers = { 'X-DeepL-Reporting-Tag' => 'tag' }
|
|
90
|
-
expect(DeepL::Requests::Rephrase).to receive(:new)
|
|
91
|
-
.with(deepl.api, 'Sample', 'DE', 'business', 'friendly', options, additional_headers)
|
|
92
|
-
.and_return(request)
|
|
93
|
-
|
|
94
|
-
result = deepl.rephrase('Sample', 'DE', 'business', 'friendly', options, additional_headers)
|
|
95
|
-
expect(result).to eq('result')
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
it 'defaults the optional arguments' do
|
|
99
|
-
expect(DeepL::Requests::Rephrase).to receive(:new)
|
|
100
|
-
.with(deepl.api, 'Sample', nil, nil, nil, {}, {})
|
|
101
|
-
.and_return(request)
|
|
102
|
-
|
|
103
|
-
deepl.rephrase('Sample')
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
describe '#usage' do
|
|
108
|
-
let(:request) { instance_double(DeepL::Requests::Usage, request: 'result') }
|
|
109
|
-
|
|
110
|
-
before { deepl.configure }
|
|
111
|
-
|
|
112
|
-
it 'delegates to DeepL::Requests::Usage with the given options' do
|
|
113
|
-
options = { foo: 'bar' }
|
|
114
|
-
expect(DeepL::Requests::Usage).to receive(:new).with(deepl.api, options).and_return(request)
|
|
115
|
-
|
|
116
|
-
expect(deepl.usage(options)).to eq('result')
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it 'defaults options to an empty hash' do
|
|
120
|
-
expect(DeepL::Requests::Usage).to receive(:new).with(deepl.api, {}).and_return(request)
|
|
121
|
-
|
|
122
|
-
deepl.usage
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
describe '#languages' do
|
|
127
|
-
let(:request) { instance_double(DeepL::Requests::Languages, request: 'result') }
|
|
128
|
-
|
|
129
|
-
before { deepl.configure }
|
|
130
|
-
|
|
131
|
-
it 'delegates to DeepL::Requests::Languages with the given options' do
|
|
132
|
-
options = { type: :target }
|
|
133
|
-
expect(DeepL::Requests::Languages).to receive(:new).with(deepl.api, options)
|
|
134
|
-
.and_return(request)
|
|
135
|
-
|
|
136
|
-
expect(deepl.languages(options)).to eq('result')
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
it 'defaults options to an empty hash' do
|
|
140
|
-
expect(DeepL::Requests::Languages).to receive(:new).with(deepl.api, {}).and_return(request)
|
|
141
|
-
|
|
142
|
-
deepl.languages
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
describe '#glossaries' do
|
|
147
|
-
before { deepl.configure }
|
|
148
|
-
|
|
149
|
-
it 'returns a GlossaryApi instance built with the configured api' do
|
|
150
|
-
expect(deepl.glossaries).to be_a(DeepL::GlossaryApi)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
describe 'GlossaryApi#create' do
|
|
154
|
-
it 'delegates to DeepL::Requests::Glossary::Create' do
|
|
155
|
-
request = instance_double(DeepL::Requests::Glossary::Create, request: 'result')
|
|
156
|
-
entries = [%w[Hello Hola]]
|
|
157
|
-
expect(DeepL::Requests::Glossary::Create).to receive(:new)
|
|
158
|
-
.with(deepl.api, 'Mi Glosario', 'EN', 'ES', entries, {})
|
|
159
|
-
.and_return(request)
|
|
160
|
-
|
|
161
|
-
deepl.glossaries.create('Mi Glosario', 'EN', 'ES', entries)
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
describe 'GlossaryApi#find' do
|
|
166
|
-
it 'delegates to DeepL::Requests::Glossary::Find' do
|
|
167
|
-
request = instance_double(DeepL::Requests::Glossary::Find, request: 'result')
|
|
168
|
-
expect(DeepL::Requests::Glossary::Find).to receive(:new)
|
|
169
|
-
.with(deepl.api, 'glossary-id', {})
|
|
170
|
-
.and_return(request)
|
|
171
|
-
|
|
172
|
-
deepl.glossaries.find('glossary-id')
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
describe 'GlossaryApi#list' do
|
|
177
|
-
it 'delegates to DeepL::Requests::Glossary::List' do
|
|
178
|
-
request = instance_double(DeepL::Requests::Glossary::List, request: 'result')
|
|
179
|
-
expect(DeepL::Requests::Glossary::List).to receive(:new).with(deepl.api, {})
|
|
180
|
-
.and_return(request)
|
|
181
|
-
|
|
182
|
-
deepl.glossaries.list
|
|
183
|
-
end
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
describe 'GlossaryApi#destroy' do
|
|
187
|
-
it 'delegates to DeepL::Requests::Glossary::Destroy' do
|
|
188
|
-
request = instance_double(DeepL::Requests::Glossary::Destroy, request: 'result')
|
|
189
|
-
expect(DeepL::Requests::Glossary::Destroy).to receive(:new)
|
|
190
|
-
.with(deepl.api, 'glossary-id', {})
|
|
191
|
-
.and_return(request)
|
|
192
|
-
|
|
193
|
-
deepl.glossaries.destroy('glossary-id')
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
describe 'GlossaryApi#entries' do
|
|
198
|
-
it 'delegates to DeepL::Requests::Glossary::Entries' do
|
|
199
|
-
request = instance_double(DeepL::Requests::Glossary::Entries, request: 'result')
|
|
200
|
-
expect(DeepL::Requests::Glossary::Entries).to receive(:new)
|
|
201
|
-
.with(deepl.api, 'glossary-id', {})
|
|
202
|
-
.and_return(request)
|
|
203
|
-
|
|
204
|
-
deepl.glossaries.entries('glossary-id')
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
describe 'GlossaryApi#language_pairs' do
|
|
209
|
-
it 'delegates to DeepL::Requests::Glossary::LanguagePairs' do
|
|
210
|
-
request = instance_double(DeepL::Requests::Glossary::LanguagePairs, request: 'result')
|
|
211
|
-
expect(DeepL::Requests::Glossary::LanguagePairs).to receive(:new).with(deepl.api, {})
|
|
212
|
-
.and_return(request)
|
|
213
|
-
|
|
214
|
-
deepl.glossaries.language_pairs
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
end
|
|
218
|
-
|
|
219
|
-
describe '#document' do
|
|
220
|
-
before { deepl.configure }
|
|
221
|
-
|
|
222
|
-
it 'returns a DocumentApi instance built with the configured api' do
|
|
223
|
-
expect(deepl.document).to be_a(DeepL::DocumentApi)
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
describe 'DocumentApi#upload' do
|
|
227
|
-
it 'delegates to DeepL::Requests::Document::Upload' do
|
|
228
|
-
request = instance_double(DeepL::Requests::Document::Upload, request: 'result')
|
|
229
|
-
expect(DeepL::Requests::Document::Upload).to receive(:new)
|
|
230
|
-
.with(deepl.api, 'path', 'EN', 'ES', 'file.txt', {}, {})
|
|
231
|
-
.and_return(request)
|
|
232
|
-
|
|
233
|
-
deepl.document.upload('path', 'EN', 'ES', 'file.txt')
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
describe 'DocumentApi#get_status' do
|
|
238
|
-
it 'delegates to DeepL::Requests::Document::GetStatus' do
|
|
239
|
-
request = instance_double(DeepL::Requests::Document::GetStatus, request: 'result')
|
|
240
|
-
handle = DeepL::Resources::DocumentHandle.new('doc-id', 'doc-key', nil, nil)
|
|
241
|
-
expect(DeepL::Requests::Document::GetStatus).to receive(:new)
|
|
242
|
-
.with(deepl.api, 'doc-id', 'doc-key', {}, {})
|
|
243
|
-
.and_return(request)
|
|
244
|
-
|
|
245
|
-
deepl.document.get_status(handle)
|
|
246
|
-
end
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
describe 'DocumentApi#download' do
|
|
250
|
-
it 'delegates to DeepL::Requests::Document::Download' do
|
|
251
|
-
request = instance_double(DeepL::Requests::Document::Download, request: 'result')
|
|
252
|
-
handle = DeepL::Resources::DocumentHandle.new('doc-id', 'doc-key', nil, nil)
|
|
253
|
-
expect(DeepL::Requests::Document::Download).to receive(:new)
|
|
254
|
-
.with(deepl.api, 'doc-id', 'doc-key', 'output-path')
|
|
255
|
-
.and_return(request)
|
|
256
|
-
|
|
257
|
-
deepl.document.download(handle, 'output-path')
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
end
|
|
261
|
-
end
|
|
262
|
-
# rubocop:enable RSpec/StubbedMock
|