deepl-rb 3.0.0 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Accept:
15
15
  - "*/*"
16
16
  User-Agent:
17
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
17
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
18
18
  Content-Type:
19
19
  - application/x-www-form-urlencoded
20
20
  response:
@@ -53,7 +53,7 @@ http_interactions:
53
53
  Accept:
54
54
  - "*/*"
55
55
  User-Agent:
56
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
56
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
57
57
  Content-Type:
58
58
  - application/x-www-form-urlencoded
59
59
  response:
@@ -91,7 +91,7 @@ http_interactions:
91
91
  Accept:
92
92
  - "*/*"
93
93
  User-Agent:
94
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
94
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
95
95
  Content-Type:
96
96
  - application/x-www-form-urlencoded
97
97
  response:
@@ -130,7 +130,7 @@ http_interactions:
130
130
  Accept:
131
131
  - "*/*"
132
132
  User-Agent:
133
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
133
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
134
134
  Content-Type:
135
135
  - application/x-www-form-urlencoded
136
136
  response:
@@ -166,7 +166,7 @@ http_interactions:
166
166
  Accept:
167
167
  - "*/*"
168
168
  User-Agent:
169
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
169
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
170
170
  Content-Type:
171
171
  - application/x-www-form-urlencoded
172
172
  response:
@@ -202,7 +202,7 @@ http_interactions:
202
202
  Accept:
203
203
  - "*/*"
204
204
  User-Agent:
205
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
205
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
206
206
  Content-Type:
207
207
  - application/x-www-form-urlencoded
208
208
  response:
@@ -236,7 +236,7 @@ http_interactions:
236
236
  Accept:
237
237
  - "*/*"
238
238
  User-Agent:
239
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
239
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
240
240
  Content-Type:
241
241
  - application/x-www-form-urlencoded
242
242
  response:
@@ -273,7 +273,7 @@ http_interactions:
273
273
  Accept:
274
274
  - "*/*"
275
275
  User-Agent:
276
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
276
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
277
277
  Content-Type:
278
278
  - application/x-www-form-urlencoded
279
279
  response:
@@ -311,7 +311,7 @@ http_interactions:
311
311
  Accept:
312
312
  - "*/*"
313
313
  User-Agent:
314
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
314
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
315
315
  Content-Type:
316
316
  - application/x-www-form-urlencoded
317
317
  response:
@@ -352,7 +352,7 @@ http_interactions:
352
352
  Accept:
353
353
  - "*/*"
354
354
  User-Agent:
355
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
355
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
356
356
  Content-Type:
357
357
  - application/x-www-form-urlencoded
358
358
  response:
@@ -393,7 +393,7 @@ http_interactions:
393
393
  Accept:
394
394
  - "*/*"
395
395
  User-Agent:
396
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
396
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
397
397
  Content-Type:
398
398
  - application/x-www-form-urlencoded
399
399
  response:
@@ -4866,7 +4866,7 @@ http_interactions:
4866
4866
  Authorization:
4867
4867
  - DeepL-Auth-Key VALID_TOKEN
4868
4868
  User-Agent:
4869
- - deepl-ruby/2.5.3(darwin23) ruby/3.3.3
4869
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
4870
4870
  Content-Type:
4871
4871
  - application/json
4872
4872
  Accept-Encoding:
@@ -4907,7 +4907,7 @@ http_interactions:
4907
4907
  Authorization:
4908
4908
  - DeepL-Auth-Key invalid
4909
4909
  User-Agent:
4910
- - deepl-ruby/2.5.3(darwin23) ruby/3.3.3
4910
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
4911
4911
  Content-Type:
4912
4912
  - application/json
4913
4913
  Accept-Encoding:
@@ -4947,7 +4947,7 @@ http_interactions:
4947
4947
  Authorization:
4948
4948
  - DeepL-Auth-Key VALID_TOKEN
4949
4949
  User-Agent:
4950
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
4950
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
4951
4951
  Content-Type:
4952
4952
  - application/json
4953
4953
  Accept-Encoding:
@@ -4991,7 +4991,7 @@ http_interactions:
4991
4991
  Authorization:
4992
4992
  - DeepL-Auth-Key invalid
4993
4993
  User-Agent:
4994
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
4994
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
4995
4995
  Content-Type:
4996
4996
  - application/json
4997
4997
  Accept-Encoding:
@@ -5031,7 +5031,7 @@ http_interactions:
5031
5031
  Authorization:
5032
5032
  - DeepL-Auth-Key VALID_TOKEN
5033
5033
  User-Agent:
5034
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
5034
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
5035
5035
  Content-Type:
5036
5036
  - application/json
5037
5037
  Accept-Encoding:
@@ -9513,7 +9513,7 @@ http_interactions:
9513
9513
  Authorization:
9514
9514
  - DeepL-Auth-Key VALID_TOKEN
9515
9515
  User-Agent:
9516
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9516
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9517
9517
  Content-Type:
9518
9518
  - application/json
9519
9519
  Accept-Encoding:
@@ -9597,7 +9597,7 @@ http_interactions:
9597
9597
  Authorization:
9598
9598
  - DeepL-Auth-Key VALID_TOKEN
9599
9599
  User-Agent:
9600
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9600
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9601
9601
  Content-Type:
9602
9602
  - application/json
9603
9603
  Accept-Encoding:
@@ -9642,7 +9642,7 @@ http_interactions:
9642
9642
  Authorization:
9643
9643
  - DeepL-Auth-Key VALID_TOKEN
9644
9644
  User-Agent:
9645
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9645
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9646
9646
  Content-Type:
9647
9647
  - application/json
9648
9648
  Accept-Encoding:
@@ -9687,7 +9687,7 @@ http_interactions:
9687
9687
  Authorization:
9688
9688
  - DeepL-Auth-Key VALID_TOKEN
9689
9689
  User-Agent:
9690
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9690
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9691
9691
  Content-Type:
9692
9692
  - application/json
9693
9693
  Accept-Encoding:
@@ -9768,7 +9768,7 @@ http_interactions:
9768
9768
  Authorization:
9769
9769
  - DeepL-Auth-Key VALID_TOKEN
9770
9770
  User-Agent:
9771
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9771
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9772
9772
  Content-Type:
9773
9773
  - application/json
9774
9774
  Accept-Encoding:
@@ -9811,7 +9811,7 @@ http_interactions:
9811
9811
  Authorization:
9812
9812
  - DeepL-Auth-Key VALID_TOKEN
9813
9813
  User-Agent:
9814
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9814
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9815
9815
  Content-Type:
9816
9816
  - application/json
9817
9817
  Accept-Encoding:
@@ -9853,7 +9853,7 @@ http_interactions:
9853
9853
  Authorization:
9854
9854
  - DeepL-Auth-Key VALID_TOKEN
9855
9855
  User-Agent:
9856
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9856
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9857
9857
  Content-Type:
9858
9858
  - application/json
9859
9859
  Accept-Encoding:
@@ -9900,7 +9900,7 @@ http_interactions:
9900
9900
  Authorization:
9901
9901
  - DeepL-Auth-Key VALID_TOKEN
9902
9902
  User-Agent:
9903
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9903
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9904
9904
  Content-Type:
9905
9905
  - application/json
9906
9906
  Accept-Encoding:
@@ -9945,7 +9945,7 @@ http_interactions:
9945
9945
  Authorization:
9946
9946
  - DeepL-Auth-Key VALID_TOKEN
9947
9947
  User-Agent:
9948
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
9948
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
9949
9949
  Content-Type:
9950
9950
  - application/json
9951
9951
  Accept-Encoding:
@@ -10071,7 +10071,7 @@ http_interactions:
10071
10071
  Authorization:
10072
10072
  - DeepL-Auth-Key VALID_TOKEN
10073
10073
  User-Agent:
10074
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
10074
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
10075
10075
  Content-Type:
10076
10076
  - application/json
10077
10077
  Accept-Encoding:
@@ -10116,7 +10116,7 @@ http_interactions:
10116
10116
  Authorization:
10117
10117
  - DeepL-Auth-Key invalid
10118
10118
  User-Agent:
10119
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
10119
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
10120
10120
  Content-Type:
10121
10121
  - application/json
10122
10122
  Accept-Encoding:
@@ -10146,4 +10146,95 @@ http_interactions:
10146
10146
  encoding: UTF-8
10147
10147
  string: ''
10148
10148
  recorded_at: Tue, 09 Jul 2024 10:04:32 GMT
10149
+ - request:
10150
+ method: post
10151
+ uri: https://api.deepl.com/v2/translate
10152
+ body:
10153
+ encoding: UTF-8
10154
+ string: '{"text":["That is hot!"],"source_lang":"EN","target_lang":"ES","context":""}'
10155
+ headers:
10156
+ Authorization:
10157
+ - DeepL-Auth-Key VALID_TOKEN
10158
+ User-Agent:
10159
+ - deepl-ruby/3.0.2 (darwin22) ruby/3.2.1
10160
+ Content-Type:
10161
+ - application/json
10162
+ Accept-Encoding:
10163
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10164
+ Accept:
10165
+ - "*/*"
10166
+ response:
10167
+ status:
10168
+ code: 200
10169
+ message: OK
10170
+ headers:
10171
+ Date:
10172
+ - Wed, 25 Sep 2024 16:07:59 GMT
10173
+ Content-Type:
10174
+ - application/json
10175
+ Transfer-Encoding:
10176
+ - chunked
10177
+ Vary:
10178
+ - Accept-Encoding
10179
+ Access-Control-Allow-Origin:
10180
+ - "*"
10181
+ Strict-Transport-Security:
10182
+ - max-age=63072000; includeSubDomains; preload
10183
+ Server-Timing:
10184
+ - l7_lb_tls;dur=88, l7_lb_idle;dur=0, l7_lb_receive;dur=0, l7_lb_total;dur=126
10185
+ Access-Control-Expose-Headers:
10186
+ - Server-Timing, X-Trace-ID
10187
+ X-Trace-Id:
10188
+ - 53712edb2fc24c7f9d59e341bd80977a
10189
+ body:
10190
+ encoding: ASCII-8BIT
10191
+ string: !binary |-
10192
+ eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IsKhRXNvIGVzdMOhIGNhbGllbnRlISJ9XX0=
10193
+ recorded_at: Wed, 25 Sep 2024 16:07:59 GMT
10194
+ - request:
10195
+ method: post
10196
+ uri: https://api.deepl.com/v2/translate
10197
+ body:
10198
+ encoding: UTF-8
10199
+ string: '{"text":["That is hot!"],"source_lang":"EN","target_lang":"ES","context":"He
10200
+ did not like the jalapenos in his meal."}'
10201
+ headers:
10202
+ Authorization:
10203
+ - DeepL-Auth-Key VALID_TOKEN
10204
+ User-Agent:
10205
+ - deepl-ruby/3.0.2 (darwin22) ruby/3.2.1
10206
+ Content-Type:
10207
+ - application/json
10208
+ Accept-Encoding:
10209
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
10210
+ Accept:
10211
+ - "*/*"
10212
+ response:
10213
+ status:
10214
+ code: 200
10215
+ message: OK
10216
+ headers:
10217
+ Date:
10218
+ - Wed, 25 Sep 2024 16:08:00 GMT
10219
+ Content-Type:
10220
+ - application/json
10221
+ Transfer-Encoding:
10222
+ - chunked
10223
+ Vary:
10224
+ - Accept-Encoding
10225
+ Access-Control-Allow-Origin:
10226
+ - "*"
10227
+ Strict-Transport-Security:
10228
+ - max-age=63072000; includeSubDomains; preload
10229
+ Server-Timing:
10230
+ - l7_lb_tls;dur=67, l7_lb_idle;dur=0, l7_lb_receive;dur=0, l7_lb_total;dur=124
10231
+ Access-Control-Expose-Headers:
10232
+ - Server-Timing, X-Trace-ID
10233
+ X-Trace-Id:
10234
+ - 1704af9968bf4570b155c12cc0ae0665
10235
+ body:
10236
+ encoding: ASCII-8BIT
10237
+ string: !binary |-
10238
+ eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IsKhRXNvIGVzIHBpY2FudGUhIn1dfQ==
10239
+ recorded_at: Wed, 25 Sep 2024 16:08:00 GMT
10149
10240
  recorded_with: VCR 6.2.0
@@ -14,7 +14,7 @@ http_interactions:
14
14
  Accept:
15
15
  - "*/*"
16
16
  User-Agent:
17
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
17
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
18
18
  response:
19
19
  status:
20
20
  code: 200
@@ -46,7 +46,7 @@ http_interactions:
46
46
  Authorization:
47
47
  - DeepL-Auth-Key VALID_TOKEN
48
48
  User-Agent:
49
- - deepl-ruby/2.5.3(darwin23) ruby/3.3.3
49
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
50
50
  Accept-Encoding:
51
51
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
52
52
  Accept:
@@ -88,7 +88,7 @@ http_interactions:
88
88
  Authorization:
89
89
  - DeepL-Auth-Key VALID_TOKEN
90
90
  User-Agent:
91
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
91
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
92
92
  Accept-Encoding:
93
93
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
94
94
  Accept:
@@ -132,7 +132,7 @@ http_interactions:
132
132
  Authorization:
133
133
  - DeepL-Auth-Key VALID_TOKEN
134
134
  User-Agent:
135
- - deepl-ruby/2.5.3 (darwin23) ruby/3.3.3
135
+ - deepl-ruby/3.0.2 (darwin23) ruby/3.3.3
136
136
  Content-Type:
137
137
  - application/json
138
138
  Accept-Encoding:
@@ -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]
@@ -292,6 +292,30 @@ describe DeepL::Requests::Translate do
292
292
  end
293
293
  end
294
294
 
295
+ context 'when performing a valid request with context' do
296
+ let(:text) { 'That is hot!' }
297
+
298
+ context 'when context is empty' do
299
+ let(:options) { { context: '' } }
300
+
301
+ it 'translates correctly with empty context' do
302
+ res = translate.request
303
+ expect(res).to be_a(DeepL::Resources::Text)
304
+ expect(res.text).to eq('¡Eso está caliente!')
305
+ end
306
+ end
307
+
308
+ context 'when context is set' do
309
+ let(:options) { { context: 'He did not like the jalapenos in his meal.' } }
310
+
311
+ it 'translates correctly with context taken into account' do
312
+ res = translate.request
313
+ expect(res).to be_a(DeepL::Resources::Text)
314
+ expect(res.text).to eq('¡Eso es picante!')
315
+ end
316
+ end
317
+ end
318
+
295
319
  context 'when performing a bad request' do
296
320
  context 'when using an invalid token' do
297
321
  let(:api) 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: 3.0.0
4
+ version: 3.0.2
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-20 00:00:00.000000000 Z
11
+ date: 2024-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: juwelier
@@ -137,7 +137,11 @@ files:
137
137
  homepage: https://github.com/DeepLcom/deepl-rb
138
138
  licenses:
139
139
  - MIT
140
- metadata: {}
140
+ metadata:
141
+ bug_tracker_uri: https://github.com/DeepLcom/deepl-rb/issues
142
+ changelog_uri: https://github.com/DeepLcom/deepl-rb/blob/main/CHANGELOG.md
143
+ documentation_uri: https://github.com/DeepLcom/deepl-rb/blob/main/README.md
144
+ homepage_uri: https://github.com/DeepLcom/deepl-rb
141
145
  post_install_message:
142
146
  rdoc_options: []
143
147
  require_paths: