deepl-rb 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +7 -4
- data/README.md +94 -0
- data/VERSION +1 -1
- data/deepl-rb.gemspec +24 -4
- data/lib/deepl/exceptions/not_found.rb +13 -0
- data/lib/deepl/glossary_api.rb +35 -0
- data/lib/deepl/requests/base.rb +21 -4
- data/lib/deepl/requests/glossary/create.rb +45 -0
- data/lib/deepl/requests/glossary/destroy.rb +30 -0
- data/lib/deepl/requests/glossary/entries.rb +30 -0
- data/lib/deepl/requests/glossary/find.rb +31 -0
- data/lib/deepl/requests/glossary/language_pairs.rb +31 -0
- data/lib/deepl/requests/glossary/list.rb +30 -0
- data/lib/deepl/resources/glossary.rb +25 -0
- data/lib/deepl/resources/language_pair.rb +20 -0
- data/lib/deepl.rb +15 -0
- data/spec/api/deepl_spec.rb +189 -0
- data/spec/fixtures/vcr_cassettes/deepl_glossaries.yml +374 -0
- data/spec/fixtures/vcr_cassettes/deepl_languages.yml +3 -1
- data/spec/fixtures/vcr_cassettes/deepl_translate.yml +212 -1
- data/spec/fixtures/vcr_cassettes/deepl_usage.yml +3 -1
- data/spec/fixtures/vcr_cassettes/glossaries.yml +480 -0
- data/spec/fixtures/vcr_cassettes/languages.yml +9 -3
- data/spec/fixtures/vcr_cassettes/translate_texts.yml +340 -322
- data/spec/fixtures/vcr_cassettes/usage.yml +3 -1
- data/spec/requests/glossary/create_spec.rb +55 -0
- data/spec/requests/glossary/destroy_spec.rb +50 -0
- data/spec/requests/glossary/entries_spec.rb +48 -0
- data/spec/requests/glossary/find_spec.rb +54 -0
- data/spec/requests/glossary/language_pairs_spec.rb +30 -0
- data/spec/requests/glossary/list_spec.rb +44 -0
- data/spec/resources/glossary_spec.rb +35 -0
- data/spec/resources/language_pair_spec.rb +20 -0
- data/spec/spec_helper.rb +2 -2
- metadata +23 -3
@@ -1,325 +1,343 @@
|
|
1
1
|
---
|
2
2
|
http_interactions:
|
3
|
-
- request:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-free.deepl.com/v2/translate
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: text=Sample+text&source_lang=EN&target_lang=ES
|
9
|
+
headers:
|
10
|
+
Authorization:
|
11
|
+
- DeepL-Auth-Key VALID_TOKEN
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Content-Type:
|
19
|
+
- application/x-www-form-urlencoded
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Mon, 17 May 2021 14:20:14 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json
|
31
|
+
Content-Length:
|
32
|
+
- "78"
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Access-Control-Allow-Origin:
|
36
|
+
- "*"
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string:
|
40
|
+
'{"translations":[{"detected_source_language":"EN","text":"Texto de
|
41
|
+
muestra"}]}'
|
42
|
+
recorded_at: Mon, 17 May 2021 14:20:14 GMT
|
43
|
+
- request:
|
44
|
+
method: post
|
45
|
+
uri: https://api-free.deepl.com/v2/translate
|
46
|
+
body:
|
47
|
+
encoding: US-ASCII
|
48
|
+
string: text=Sample&text=Word&source_lang=EN&target_lang=ES
|
49
|
+
headers:
|
50
|
+
Authorization:
|
51
|
+
- DeepL-Auth-Key VALID_TOKEN
|
52
|
+
Accept-Encoding:
|
53
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
54
|
+
Accept:
|
55
|
+
- "*/*"
|
56
|
+
User-Agent:
|
57
|
+
- Ruby
|
58
|
+
Content-Type:
|
59
|
+
- application/x-www-form-urlencoded
|
60
|
+
response:
|
61
|
+
status:
|
62
|
+
code: 200
|
63
|
+
message: OK
|
64
|
+
headers:
|
65
|
+
Server:
|
66
|
+
- nginx
|
67
|
+
Date:
|
68
|
+
- Mon, 17 May 2021 14:20:14 GMT
|
69
|
+
Content-Type:
|
70
|
+
- application/json
|
71
|
+
Content-Length:
|
72
|
+
- "120"
|
73
|
+
Connection:
|
74
|
+
- keep-alive
|
75
|
+
Access-Control-Allow-Origin:
|
76
|
+
- "*"
|
77
|
+
body:
|
78
|
+
encoding: UTF-8
|
79
|
+
string: '{"translations":[{"detected_source_language":"EN","text":"Muestra"},{"detected_source_language":"EN","text":"Palabra"}]}'
|
80
|
+
recorded_at: Mon, 17 May 2021 14:20:14 GMT
|
81
|
+
- request:
|
82
|
+
method: post
|
83
|
+
uri: https://api-free.deepl.com/v2/translate?tag_handling=xml
|
84
|
+
body:
|
85
|
+
encoding: US-ASCII
|
86
|
+
string: text=%3Cp%3ESample+text%3C%2Fp%3E&source_lang=EN&target_lang=ES
|
87
|
+
headers:
|
88
|
+
Authorization:
|
89
|
+
- DeepL-Auth-Key VALID_TOKEN
|
90
|
+
Accept-Encoding:
|
91
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
92
|
+
Accept:
|
93
|
+
- "*/*"
|
94
|
+
User-Agent:
|
95
|
+
- Ruby
|
96
|
+
Content-Type:
|
97
|
+
- application/x-www-form-urlencoded
|
98
|
+
response:
|
99
|
+
status:
|
100
|
+
code: 200
|
101
|
+
message: OK
|
102
|
+
headers:
|
103
|
+
Server:
|
104
|
+
- nginx
|
105
|
+
Date:
|
106
|
+
- Mon, 17 May 2021 14:20:15 GMT
|
107
|
+
Content-Type:
|
108
|
+
- application/json
|
109
|
+
Content-Length:
|
110
|
+
- "85"
|
111
|
+
Connection:
|
112
|
+
- keep-alive
|
113
|
+
Access-Control-Allow-Origin:
|
114
|
+
- "*"
|
115
|
+
body:
|
116
|
+
encoding: UTF-8
|
117
|
+
string:
|
118
|
+
'{"translations":[{"detected_source_language":"EN","text":"<p>Texto
|
119
|
+
de muestra</p>"}]}'
|
120
|
+
recorded_at: Mon, 17 May 2021 14:20:15 GMT
|
121
|
+
- request:
|
122
|
+
method: post
|
123
|
+
uri: https://api-free.deepl.com/v2/translate
|
124
|
+
body:
|
125
|
+
encoding: US-ASCII
|
126
|
+
string: text=Sample+text&source_lang=EN&target_lang=ES
|
127
|
+
headers:
|
128
|
+
Authorization:
|
129
|
+
- DeepL-Auth-Key invalid
|
130
|
+
Accept-Encoding:
|
131
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
132
|
+
Accept:
|
133
|
+
- "*/*"
|
134
|
+
User-Agent:
|
135
|
+
- Ruby
|
136
|
+
Content-Type:
|
137
|
+
- application/x-www-form-urlencoded
|
138
|
+
response:
|
139
|
+
status:
|
140
|
+
code: 403
|
141
|
+
message: Forbidden
|
142
|
+
headers:
|
143
|
+
Server:
|
144
|
+
- nginx
|
145
|
+
Date:
|
146
|
+
- Mon, 17 May 2021 14:20:16 GMT
|
147
|
+
Content-Length:
|
148
|
+
- "0"
|
149
|
+
Connection:
|
150
|
+
- keep-alive
|
151
|
+
Access-Control-Allow-Origin:
|
152
|
+
- "*"
|
153
|
+
body:
|
154
|
+
encoding: UTF-8
|
155
|
+
string: ""
|
156
|
+
recorded_at: Mon, 17 May 2021 14:20:16 GMT
|
157
|
+
- request:
|
158
|
+
method: post
|
159
|
+
uri: https://api-free.deepl.com/v2/translate
|
160
|
+
body:
|
161
|
+
encoding: US-ASCII
|
162
|
+
string: source_lang=EN&target_lang=ES
|
163
|
+
headers:
|
164
|
+
Authorization:
|
165
|
+
- DeepL-Auth-Key VALID_TOKEN
|
166
|
+
Accept-Encoding:
|
167
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
168
|
+
Accept:
|
169
|
+
- "*/*"
|
170
|
+
User-Agent:
|
171
|
+
- Ruby
|
172
|
+
Content-Type:
|
173
|
+
- application/x-www-form-urlencoded
|
174
|
+
response:
|
175
|
+
status:
|
176
|
+
code: 400
|
177
|
+
message: Bad Request
|
178
|
+
headers:
|
179
|
+
Server:
|
180
|
+
- nginx
|
181
|
+
Date:
|
182
|
+
- Mon, 17 May 2021 14:20:16 GMT
|
183
|
+
Content-Length:
|
184
|
+
- "45"
|
185
|
+
Connection:
|
186
|
+
- keep-alive
|
187
|
+
Access-Control-Allow-Origin:
|
188
|
+
- "*"
|
189
|
+
body:
|
190
|
+
encoding: UTF-8
|
191
|
+
string: '{"message":"Parameter ''text'' not specified."}'
|
192
|
+
recorded_at: Mon, 17 May 2021 14:20:16 GMT
|
193
|
+
- request:
|
194
|
+
method: post
|
195
|
+
uri: https://api-free.deepl.com/v2/translate
|
196
|
+
body:
|
197
|
+
encoding: US-ASCII
|
198
|
+
string: text=Sample+text&source_lang=EN
|
199
|
+
headers:
|
200
|
+
Authorization:
|
201
|
+
- DeepL-Auth-Key VALID_TOKEN
|
202
|
+
Accept-Encoding:
|
203
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
204
|
+
Accept:
|
205
|
+
- "*/*"
|
206
|
+
User-Agent:
|
207
|
+
- Ruby
|
208
|
+
Content-Type:
|
209
|
+
- application/x-www-form-urlencoded
|
210
|
+
response:
|
211
|
+
status:
|
212
|
+
code: 400
|
213
|
+
message: Bad Request
|
214
|
+
headers:
|
215
|
+
Server:
|
216
|
+
- nginx
|
217
|
+
Date:
|
218
|
+
- Mon, 17 May 2021 14:20:17 GMT
|
219
|
+
Content-Length:
|
220
|
+
- "52"
|
221
|
+
Connection:
|
222
|
+
- keep-alive
|
223
|
+
Access-Control-Allow-Origin:
|
224
|
+
- "*"
|
225
|
+
body:
|
226
|
+
encoding: UTF-8
|
227
|
+
string: '{"message":"Value for ''target_lang'' not supported."}'
|
228
|
+
recorded_at: Mon, 17 May 2021 14:20:17 GMT
|
229
|
+
- request:
|
230
|
+
method: post
|
231
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&ignore_tags=code,span&tag_handling=xml
|
232
|
+
body:
|
233
|
+
encoding: US-ASCII
|
234
|
+
string: text=Welcome+and+%3Ccode%3EHello+great+World%3C%2Fcode%3E+Good+Morning%21&source_lang=EN&target_lang=ES
|
235
|
+
headers:
|
236
|
+
Accept-Encoding:
|
237
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
238
|
+
Accept:
|
239
|
+
- "*/*"
|
240
|
+
User-Agent:
|
241
|
+
- Ruby
|
242
|
+
Content-Type:
|
243
|
+
- application/x-www-form-urlencoded
|
244
|
+
response:
|
245
|
+
status:
|
246
|
+
code: 200
|
247
|
+
message: OK
|
248
|
+
headers:
|
249
|
+
Server:
|
250
|
+
- nginx
|
251
|
+
Date:
|
252
|
+
- Mon, 17 May 2021 14:20:56 GMT
|
253
|
+
Content-Type:
|
254
|
+
- application/json
|
255
|
+
Content-Length:
|
256
|
+
- "121"
|
257
|
+
Connection:
|
258
|
+
- keep-alive
|
259
|
+
Access-Control-Allow-Origin:
|
260
|
+
- "*"
|
261
|
+
body:
|
262
|
+
encoding: ASCII-8BIT
|
263
|
+
string: !binary |-
|
264
|
+
eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IkJpZW52ZW5pZG8geSA8Y29kZT5IZWxsbyBncmVhdCBXb3JsZDwvY29kZT4gwqFCdWVub3MgZMOtYXMhIn1dfQ==
|
265
|
+
recorded_at: Mon, 17 May 2021 14:20:56 GMT
|
266
|
+
- request:
|
267
|
+
method: post
|
268
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&glossary_id=123
|
269
|
+
body:
|
270
|
+
encoding: US-ASCII
|
271
|
+
string: text=%3Cp%3ESample+text%3C%2Fp%3E&source_lang=EN&target_lang=ES
|
272
|
+
headers:
|
273
|
+
Accept-Encoding:
|
274
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
275
|
+
Accept:
|
276
|
+
- "*/*"
|
277
|
+
User-Agent:
|
278
|
+
- Ruby
|
279
|
+
Content-Type:
|
280
|
+
- application/x-www-form-urlencoded
|
281
|
+
response:
|
282
|
+
status:
|
283
|
+
code: 400
|
284
|
+
message: Bad Request
|
285
|
+
headers:
|
286
|
+
Server:
|
287
|
+
- nginx
|
288
|
+
Date:
|
289
|
+
- Tue, 28 Sep 2021 17:20:52 GMT
|
290
|
+
Content-Type:
|
291
|
+
- application/json
|
292
|
+
Content-Length:
|
293
|
+
- "51"
|
294
|
+
Connection:
|
295
|
+
- keep-alive
|
296
|
+
Access-Control-Allow-Origin:
|
297
|
+
- "*"
|
298
|
+
body:
|
299
|
+
encoding: UTF-8
|
300
|
+
string: '{"message":"Value for ''termbaseId'' not supported."}'
|
301
|
+
recorded_at: Tue, 28 Sep 2021 17:20:52 GMT
|
302
|
+
- request:
|
303
|
+
method: post
|
304
|
+
uri: https://api-free.deepl.com/v2/translate?ignore_tags=code,span&tag_handling=xml
|
305
|
+
body:
|
306
|
+
encoding: US-ASCII
|
307
|
+
string: text=Welcome+and+%3Ccode%3EHello+great+World%3C%2Fcode%3E+Good+Morning%21&source_lang=EN&target_lang=ES
|
308
|
+
headers:
|
309
|
+
Authorization:
|
310
|
+
- DeepL-Auth-Key VALID_TOKEN
|
311
|
+
Accept-Encoding:
|
312
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
313
|
+
Accept:
|
314
|
+
- "*/*"
|
315
|
+
User-Agent:
|
316
|
+
- Ruby
|
317
|
+
Content-Type:
|
318
|
+
- application/x-www-form-urlencoded
|
319
|
+
response:
|
320
|
+
status:
|
321
|
+
code: 200
|
322
|
+
message: OK
|
323
|
+
headers:
|
324
|
+
Server:
|
325
|
+
- nginx
|
326
|
+
Date:
|
327
|
+
- Thu, 17 Mar 2022 09:55:34 GMT
|
328
|
+
Content-Type:
|
329
|
+
- application/json
|
330
|
+
Transfer-Encoding:
|
331
|
+
- chunked
|
332
|
+
Connection:
|
333
|
+
- keep-alive
|
334
|
+
Vary:
|
335
|
+
- Accept-Encoding
|
336
|
+
Access-Control-Allow-Origin:
|
337
|
+
- "*"
|
338
|
+
body:
|
339
|
+
encoding: ASCII-8BIT
|
340
|
+
string: !binary |-
|
341
|
+
eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IkJpZW52ZW5pZG8geSA8Y29kZT5IZWxsbyBncmVhdCBXb3JsZDwvY29kZT4gwqFCdWVub3MgZMOtYXMhIn1dfQ==
|
342
|
+
recorded_at: Thu, 17 Mar 2022 09:55:32 GMT
|
325
343
|
recorded_with: VCR 6.0.0
|