deepl-rb 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f531ff13d2ba139bab65f6027f2e673f6480b097847d898531ecc7a9b247faea
4
- data.tar.gz: e12727852eff8153dbb3a95d853d0fbd5ef5c703f02eaf7dedd089320e6873a2
3
+ metadata.gz: 12e4767413ff5fc13b5b91e23cdc80c99b7252045753f7c2ef197bc4b0c0a0d2
4
+ data.tar.gz: 05ac02229186bc7cf8f234767f8a258b2c472e4045fa4f5c006f77bbc14314b3
5
5
  SHA512:
6
- metadata.gz: 1d783cba5c207fb772589bc3f328a942919eff214778ea739a6924022bb7589a1898ab62a1cad2b9f6b177f857beb1bd0c5fbe290eba1467c31b26ab9cad461e
7
- data.tar.gz: f14387ba9bc6e7ca3b97176fe1d51f4fa001ca9caba1dc6377d13e4c573896f953575f6efa682bbf55d6704657a53eb73686f9ec51711298549b49a2e5a07701
6
+ metadata.gz: 218d0486a3ae68ab23849762976810940d8e2efb6fadc094e0b63d62e59a5c2ef06129a8a6681d8a985875a0bcf92ba4767d769826ab1a545c0a26391529808c
7
+ data.tar.gz: d991c7bb24a02f5c0f415bcd27c728f936a8365c20a1b91847f1cef4ba1b8031a01e23b17fe4ba7ad13aec58f6df5c2df112af2457f08a6e61cda54879cc12c9
data/README.md CHANGED
@@ -124,8 +124,11 @@ The following parameters will be automatically converted:
124
124
  | --------------------- | ---------------
125
125
  | `preserve_formatting` | Converts `false` to `'0'` and `true` to `'1'`
126
126
  | `split_sentences` | Converts `false` to `'0'` and `true` to `'1'`
127
+ | `outline_detection` | Converts `false` to `'0'` and `true` to `'1'`
127
128
  | `non_splitting_tags` | Converts arrays to strings joining by commas
128
129
  | `ignore_tags` | Converts arrays to strings joining by commas
130
+ | `formality` | No conversion applied
131
+ | `glossary_id` | No conversion applied
129
132
 
130
133
  ### Monitor usage
131
134
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.3.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 2.3.0 ruby lib
5
+ # stub: deepl-rb 2.3.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "deepl-rb".freeze
9
- s.version = "2.3.0"
9
+ s.version = "2.3.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 = ["Daniel Herzog".freeze]
14
- s.date = "2021-05-17"
14
+ s.date = "2021-09-28"
15
15
  s.description = "A simple ruby wrapper for the DeepL translation API (v1). For more information, check this: https://www.deepl.com/docs/api-reference.html".freeze
16
16
  s.email = "info@danielherzog.es".freeze
17
17
  s.extra_rdoc_files = [
@@ -8,6 +8,7 @@ module DeepL
8
8
  OPTIONS_CONVERSIONS = {
9
9
  split_sentences: BOOLEAN_CONVERSION,
10
10
  preserve_formatting: BOOLEAN_CONVERSION,
11
+ outline_detection: BOOLEAN_CONVERSION,
11
12
  non_splitting_tags: ARRAY_CONVERSION,
12
13
  ignore_tags: ARRAY_CONVERSION
13
14
  }.freeze
@@ -286,4 +286,40 @@ http_interactions:
286
286
  string: !binary |-
287
287
  eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IkJpZW52ZW5pZG8geSA8Y29kZT5IZWxsbyBncmVhdCBXb3JsZDwvY29kZT4gwqFCdWVub3MgZMOtYXMhIn1dfQ==
288
288
  recorded_at: Mon, 17 May 2021 14:20:56 GMT
289
+ - request:
290
+ method: post
291
+ uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&glossary_id=123
292
+ body:
293
+ encoding: US-ASCII
294
+ string: text=%3Cp%3ESample+text%3C%2Fp%3E&source_lang=EN&target_lang=ES
295
+ headers:
296
+ Accept-Encoding:
297
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
298
+ Accept:
299
+ - "*/*"
300
+ User-Agent:
301
+ - Ruby
302
+ Content-Type:
303
+ - application/x-www-form-urlencoded
304
+ response:
305
+ status:
306
+ code: 400
307
+ message: Bad Request
308
+ headers:
309
+ Server:
310
+ - nginx
311
+ Date:
312
+ - Tue, 28 Sep 2021 17:20:52 GMT
313
+ Content-Type:
314
+ - application/json
315
+ Content-Length:
316
+ - '51'
317
+ Connection:
318
+ - keep-alive
319
+ Access-Control-Allow-Origin:
320
+ - "*"
321
+ body:
322
+ encoding: UTF-8
323
+ string: '{"message":"Value for ''termbaseId'' not supported."}'
324
+ recorded_at: Tue, 28 Sep 2021 17:20:52 GMT
289
325
  recorded_with: VCR 6.0.0
@@ -90,6 +90,11 @@ describe DeepL::Requests::Translate do
90
90
  expect(request.options[:split_sentences]).to eq('0')
91
91
  end
92
92
 
93
+ it 'should leave `nonewlines` as is' do
94
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, split_sentences: 'nonewlines')
95
+ expect(request.options[:split_sentences]).to eq('nonewlines')
96
+ end
97
+
93
98
  it 'should leave `1` as is' do
94
99
  request = DeepL::Requests::Translate.new(api, nil, nil, nil, split_sentences: '1')
95
100
  expect(request.options[:split_sentences]).to eq('1')
@@ -117,6 +122,52 @@ describe DeepL::Requests::Translate do
117
122
  expect(request.options[:preserve_formatting]).to eq('1')
118
123
  end
119
124
  end
125
+
126
+ context 'when using `outline_detection` options' do
127
+ it 'should convert `true` to `1`' do
128
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, outline_detection: true)
129
+ expect(request.options[:outline_detection]).to eq('1')
130
+ end
131
+
132
+ it 'should convert `false` to `0`' do
133
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, outline_detection: false)
134
+ expect(request.options[:outline_detection]).to eq('0')
135
+ end
136
+
137
+ it 'should leave `0` as is' do
138
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, outline_detection: '0')
139
+ expect(request.options[:outline_detection]).to eq('0')
140
+ end
141
+
142
+ it 'should leave `1` as is' do
143
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, outline_detection: '1')
144
+ expect(request.options[:outline_detection]).to eq('1')
145
+ end
146
+ end
147
+
148
+ context 'when using `glossary_id` options' do
149
+ it 'should work with a nil values' do
150
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, glossary_id: nil)
151
+ expect(request.options[:glossary_id]).to eq(nil)
152
+ end
153
+
154
+ it 'should work with a string' do
155
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, glossary_id: 'sample_id')
156
+ expect(request.options[:glossary_id]).to eq('sample_id')
157
+ end
158
+ end
159
+
160
+ context 'when using `formality` options' do
161
+ it 'should work with a nil values' do
162
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, formality: nil)
163
+ expect(request.options[:formality]).to eq(nil)
164
+ end
165
+
166
+ it 'should work with a string' do
167
+ request = DeepL::Requests::Translate.new(api, nil, nil, nil, formality: 'more')
168
+ expect(request.options[:formality]).to eq('more')
169
+ end
170
+ end
120
171
  end
121
172
 
122
173
  describe '#request' do
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: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Herzog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-17 00:00:00.000000000 Z
11
+ date: 2021-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: juwelier