deepl-rb 3.0.0 → 3.0.1
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 +7 -2
- data/README.md +1 -1
- data/VERSION +1 -1
- data/deepl-rb.gemspec +3 -3
- data/lib/deepl/document_api.rb +4 -3
- data/spec/integration_tests/document_api_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a37d2acfd0320ea201f38b15aed87511a57d9764db6a6ab3c9a3d8e6ad09013a
|
4
|
+
data.tar.gz: 153ef18eab1a014d2733073be19ae5bad6c58a9b72ec9f04ea1e61d1a427f1d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7cd860107137d7354714382a87b53934aa045e48ff2886b9c8a13f7957b4e4f3c651c3621289a82f2aa23011a8be09fc903bc4022dfcf68e8a76eacc50d2c30
|
7
|
+
data.tar.gz: a27ced11ed3823a7c8bed7fbfa2efa25131ff6a5eb084606109e4ed4ef5a43aa622f305217b6284699bf7492b5a116d43f1b8bb578f878ab70e10c4e62b7cba2
|
data/CHANGELOG.md
CHANGED
@@ -5,7 +5,11 @@ 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
|
|
8
|
-
## [
|
8
|
+
## [3.0.1] - 2024-09-23
|
9
|
+
### Fixed
|
10
|
+
* `document.translate_document` required a filename, this is now optional. The example in the README now works.
|
11
|
+
|
12
|
+
## [3.0.0] - 2024-09-20
|
9
13
|
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.
|
10
14
|
The change in major version is only due to the change in maintainership, there is no migration necessary from v2 to v3.
|
11
15
|
### Added
|
@@ -30,5 +34,6 @@ The change in major version is only due to the change in maintainership, there i
|
|
30
34
|
* Make RequestEntityTooLarge error message more clear
|
31
35
|
|
32
36
|
|
33
|
-
[
|
37
|
+
[3.0.1]: https://github.com/DeepLcom/deepl-rb/compare/v3.0.0...v3.0.1
|
38
|
+
[3.0.0]: https://github.com/DeepLcom/deepl-rb/compare/v2.5.3...v3.0.0
|
34
39
|
[2.5.3]: https://github.com/DeepLcom/deepl-rb/compare/v2.5.2...v2.5.3
|
data/README.md
CHANGED
@@ -252,7 +252,7 @@ puts usage.character_limit
|
|
252
252
|
To translate a document, use the `document.translate_document` method. Example:
|
253
253
|
|
254
254
|
```rb
|
255
|
-
DeepL.document.translate_document('/path/to/spanish_document.pdf', '
|
255
|
+
DeepL.document.translate_document('/path/to/spanish_document.pdf', '/path/to/translated_document.pdf', 'ES', 'EN')
|
256
256
|
```
|
257
257
|
|
258
258
|
The lower level `upload`, `get_status` and `download` methods are also exposed, as well as the convenience method `wait_until_document_translation_finished` on the `DocumentHandle` object, which would replace `get_status`:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.1
|
data/deepl-rb.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: deepl-rb 3.0.
|
5
|
+
# stub: deepl-rb 3.0.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "deepl-rb".freeze
|
9
|
-
s.version = "3.0.
|
9
|
+
s.version = "3.0.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["DeepL SE".freeze]
|
14
|
-
s.date = "2024-09-
|
14
|
+
s.date = "2024-09-23"
|
15
15
|
s.description = "Official Ruby library for the DeepL language translation API (v2). For more information, check this: https://www.deepl.com/docs/api-reference.html".freeze
|
16
16
|
s.email = "open-source@deepl.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/deepl/document_api.rb
CHANGED
@@ -83,13 +83,14 @@ module DeepL
|
|
83
83
|
# ISO 639-1, 2-letter language codes, plus a hyphen "-" with the
|
84
84
|
# variant identifier for languages with variants/dialects/... .
|
85
85
|
# @param [String, nil] filename The filename of the file, including its extension. Used to open
|
86
|
-
# the different kinds of documents (PDFs, etc).
|
86
|
+
# the different kinds of documents (PDFs, etc). If nil, will use
|
87
|
+
# the filename of +input_file_path+.
|
87
88
|
# @param [Hash] options Additional options for the upload.
|
88
89
|
# @param [Hash] additional_headers Additional headers for the upload.
|
89
90
|
# @return [DeepL::Resources::DocumentTranslationStatus] Status of the document translation.
|
90
91
|
|
91
|
-
def translate_document(input_file, output_file, source_lang, target_lang,
|
92
|
-
options = {}, additional_headers = {})
|
92
|
+
def translate_document(input_file, output_file, source_lang, target_lang, # rubocop:disable Metrics/MethodLength,Metrics/ParameterLists
|
93
|
+
filename = nil, options = {}, additional_headers = {})
|
93
94
|
raise IOError 'File already exists at output path' if File.exist?(output_file)
|
94
95
|
|
95
96
|
begin
|
@@ -33,6 +33,18 @@ describe DeepL::DocumentApi do
|
|
33
33
|
expect(example_document_translation(target_lang)).to eq(output_file_contents)
|
34
34
|
end
|
35
35
|
|
36
|
+
it 'Translates a document from a filepath without a filename' do
|
37
|
+
File.unlink(output_document_path)
|
38
|
+
source_lang = default_lang_args[:source_lang]
|
39
|
+
target_lang = default_lang_args[:target_lang]
|
40
|
+
example_doc_path = example_document_path(source_lang)
|
41
|
+
DeepL.document.translate_document(example_doc_path, output_document_path,
|
42
|
+
source_lang, target_lang)
|
43
|
+
output_file_contents = File.read(output_document_path)
|
44
|
+
|
45
|
+
expect(example_document_translation(target_lang)).to eq(output_file_contents)
|
46
|
+
end
|
47
|
+
|
36
48
|
it 'Translates a document using the lower-level methods and returns the correct status' do # rubocop:disable RSpec/ExampleLength
|
37
49
|
File.unlink(output_document_path)
|
38
50
|
source_lang = default_lang_args[:source_lang]
|
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.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DeepL SE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: juwelier
|