deepl-rb 2.3.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 +102 -1
- data/VERSION +1 -1
- data/deepl-rb.gemspec +25 -4
- data/lib/deepl/configuration.rb +1 -1
- data/lib/deepl/exceptions/not_found.rb +13 -0
- data/lib/deepl/exceptions/not_supported.rb +11 -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/requests/languages.rb +3 -1
- data/lib/deepl/requests/translate.rb +1 -0
- data/lib/deepl/resources/glossary.rb +25 -0
- data/lib/deepl/resources/language.rb +8 -1
- data/lib/deepl/resources/language_pair.rb +20 -0
- data/lib/deepl.rb +16 -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 -286
- 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/requests/translate_spec.rb +51 -0
- data/spec/resources/glossary_spec.rb +35 -0
- data/spec/resources/language_pair_spec.rb +20 -0
- data/spec/resources/language_spec.rb +23 -1
- data/spec/spec_helper.rb +2 -2
- metadata +24 -3
data/lib/deepl.rb
CHANGED
@@ -11,22 +11,33 @@ require 'deepl/exceptions/authorization_failed'
|
|
11
11
|
require 'deepl/exceptions/bad_request'
|
12
12
|
require 'deepl/exceptions/limit_exceeded'
|
13
13
|
require 'deepl/exceptions/quota_exceeded'
|
14
|
+
require 'deepl/exceptions/not_found'
|
15
|
+
require 'deepl/exceptions/not_supported'
|
14
16
|
|
15
17
|
# -- Requests
|
16
18
|
require 'deepl/requests/base'
|
19
|
+
require 'deepl/requests/glossary/create'
|
20
|
+
require 'deepl/requests/glossary/destroy'
|
21
|
+
require 'deepl/requests/glossary/entries'
|
22
|
+
require 'deepl/requests/glossary/find'
|
23
|
+
require 'deepl/requests/glossary/language_pairs'
|
24
|
+
require 'deepl/requests/glossary/list'
|
17
25
|
require 'deepl/requests/languages'
|
18
26
|
require 'deepl/requests/translate'
|
19
27
|
require 'deepl/requests/usage'
|
20
28
|
|
21
29
|
# -- Responses and resources
|
22
30
|
require 'deepl/resources/base'
|
31
|
+
require 'deepl/resources/glossary'
|
23
32
|
require 'deepl/resources/language'
|
33
|
+
require 'deepl/resources/language_pair'
|
24
34
|
require 'deepl/resources/text'
|
25
35
|
require 'deepl/resources/usage'
|
26
36
|
|
27
37
|
# -- Other wrappers
|
28
38
|
require 'deepl/api'
|
29
39
|
require 'deepl/configuration'
|
40
|
+
require 'deepl/glossary_api'
|
30
41
|
|
31
42
|
# -- Gem interface
|
32
43
|
module DeepL
|
@@ -47,6 +58,11 @@ module DeepL
|
|
47
58
|
Requests::Translate.new(api, text, source_lang, target_lang, options).request
|
48
59
|
end
|
49
60
|
|
61
|
+
def glossaries(options = {})
|
62
|
+
configure if @configuration.nil?
|
63
|
+
GlossaryApi.new(api, options)
|
64
|
+
end
|
65
|
+
|
50
66
|
def usage(options = {})
|
51
67
|
configure if @configuration.nil?
|
52
68
|
Requests::Usage.new(api, options).request
|
data/spec/api/deepl_spec.rb
CHANGED
@@ -60,6 +60,26 @@ describe DeepL do
|
|
60
60
|
expect(text).to be_a(DeepL::Resources::Text)
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
context 'When translating a text using a glossary' do
|
65
|
+
before(:each) do
|
66
|
+
@glossary = subject.glossaries.create('fixture', 'EN', 'ES', [%w[car auto]])
|
67
|
+
end
|
68
|
+
let(:input) { 'I wish we had a car.' }
|
69
|
+
let(:options) { { glossary_id: @glossary.id } }
|
70
|
+
|
71
|
+
it 'should create and call a request object' do
|
72
|
+
expect(DeepL::Requests::Translate).to receive(:new)
|
73
|
+
.with(subject.api, input, source_lang, target_lang, options).and_call_original
|
74
|
+
text = subject.translate(input, source_lang, target_lang, options)
|
75
|
+
expect(text).to be_a(DeepL::Resources::Text)
|
76
|
+
expect(text.text).to eq('Ojalá tuviéramos un auto.')
|
77
|
+
end
|
78
|
+
|
79
|
+
after(:each) do
|
80
|
+
subject.glossaries.destroy(@glossary.id)
|
81
|
+
end
|
82
|
+
end
|
63
83
|
end
|
64
84
|
|
65
85
|
describe '#usage' do
|
@@ -100,4 +120,173 @@ describe DeepL do
|
|
100
120
|
end
|
101
121
|
end
|
102
122
|
end
|
123
|
+
|
124
|
+
describe '#glossaries' do
|
125
|
+
describe '#glossaries.create' do
|
126
|
+
let(:name) { 'Mi Glosario' }
|
127
|
+
let(:source_lang) { 'EN' }
|
128
|
+
let(:target_lang) { 'ES' }
|
129
|
+
let(:entries) do
|
130
|
+
[
|
131
|
+
%w[Hello Hola],
|
132
|
+
%w[World Mundo]
|
133
|
+
]
|
134
|
+
end
|
135
|
+
let(:options) { { param: 'fake', entries_format: 'tsv' } }
|
136
|
+
|
137
|
+
around do |example|
|
138
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
139
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'When creating a glossary' do
|
143
|
+
it 'should create and call a request object' do
|
144
|
+
expect(DeepL::Requests::Glossary::Create).to receive(:new)
|
145
|
+
.with(subject.api, name, source_lang, target_lang, entries, options).and_call_original
|
146
|
+
|
147
|
+
glossary = subject.glossaries.create(name, source_lang, target_lang, entries, options)
|
148
|
+
expect(glossary).to be_a(DeepL::Resources::Glossary)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe '#glossaries.find' do
|
154
|
+
let(:id) { 'd9ad833f-c818-430c-a3c9-47071384fa3e' }
|
155
|
+
let(:options) { {} }
|
156
|
+
|
157
|
+
around do |example|
|
158
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
159
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
160
|
+
end
|
161
|
+
|
162
|
+
context 'When fetching a glossary' do
|
163
|
+
it 'should create and call a request object' do
|
164
|
+
expect(DeepL::Requests::Glossary::Find).to receive(:new)
|
165
|
+
.with(subject.api, id, options).and_call_original
|
166
|
+
|
167
|
+
glossary = subject.glossaries.find(id, options)
|
168
|
+
expect(glossary).to be_a(DeepL::Resources::Glossary)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
context 'When fetching a non existing glossary' do
|
173
|
+
let(:id) { '00000000-0000-0000-0000-000000000000' }
|
174
|
+
|
175
|
+
it 'should raise an exception when the glossary does not exist' do
|
176
|
+
expect(DeepL::Requests::Glossary::Find).to receive(:new)
|
177
|
+
.with(subject.api, id, options).and_call_original
|
178
|
+
expect { subject.glossaries.find(id, options) }
|
179
|
+
.to raise_error(DeepL::Exceptions::NotFound)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
describe '#glossaries.list' do
|
185
|
+
let(:options) { {} }
|
186
|
+
|
187
|
+
around do |example|
|
188
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
189
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'When fetching glossaries' do
|
193
|
+
it 'should create and call a request object' do
|
194
|
+
expect(DeepL::Requests::Glossary::List).to receive(:new)
|
195
|
+
.with(subject.api, options).and_call_original
|
196
|
+
|
197
|
+
glossaries = subject.glossaries.list(options)
|
198
|
+
expect(glossaries).to all(be_a(DeepL::Resources::Glossary))
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
describe '#glossaries.destroy' do
|
204
|
+
let(:id) { 'd9ad833f-c818-430c-a3c9-47071384fa3e' }
|
205
|
+
let(:options) { {} }
|
206
|
+
|
207
|
+
around do |example|
|
208
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
209
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
210
|
+
end
|
211
|
+
|
212
|
+
context 'When destroy a glossary' do
|
213
|
+
let(:new_glossary) do
|
214
|
+
subject.glossaries.create('fixture', 'EN', 'ES', [%w[Hello Hola]])
|
215
|
+
end
|
216
|
+
it 'should create and call a request object' do
|
217
|
+
expect(DeepL::Requests::Glossary::Destroy).to receive(:new)
|
218
|
+
.with(subject.api, new_glossary.id, options).and_call_original
|
219
|
+
|
220
|
+
glossary_id = subject.glossaries.destroy(new_glossary.id, options)
|
221
|
+
expect(glossary_id).to eq(new_glossary.id)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'When destroying a non existing glossary' do
|
226
|
+
let(:id) { '00000000-0000-0000-0000-000000000000' }
|
227
|
+
|
228
|
+
it 'should raise an exception when the glossary does not exist' do
|
229
|
+
expect(DeepL::Requests::Glossary::Destroy).to receive(:new)
|
230
|
+
.with(subject.api, id, options).and_call_original
|
231
|
+
expect { subject.glossaries.destroy(id, options) }
|
232
|
+
.to raise_error(DeepL::Exceptions::NotFound)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
describe '#glossaries.entries' do
|
238
|
+
let(:id) { '012a5576-b551-4d4c-b917-ce01bc8debb6' }
|
239
|
+
let(:options) { {} }
|
240
|
+
|
241
|
+
around do |example|
|
242
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
243
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
244
|
+
end
|
245
|
+
|
246
|
+
context 'When listing glossary entries' do
|
247
|
+
it 'should create and call a request object' do
|
248
|
+
expect(DeepL::Requests::Glossary::Entries).to receive(:new)
|
249
|
+
.with(subject.api, id, options).and_call_original
|
250
|
+
|
251
|
+
entries = subject.glossaries.entries(id, options)
|
252
|
+
expect(entries).to all(be_a(Array))
|
253
|
+
entries.each do |entry|
|
254
|
+
expect(entry.size).to eq(2)
|
255
|
+
expect(entry.first).to be_a(String)
|
256
|
+
expect(entry.last).to be_a(String)
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
context 'When listing entries of a non existing glossary' do
|
262
|
+
let(:id) { '00000000-0000-0000-0000-000000000000' }
|
263
|
+
|
264
|
+
it 'should raise an exception when the glossary does not exist' do
|
265
|
+
expect(DeepL::Requests::Glossary::Entries).to receive(:new)
|
266
|
+
.with(subject.api, id, options).and_call_original
|
267
|
+
expect { subject.glossaries.entries(id, options) }
|
268
|
+
.to raise_error(DeepL::Exceptions::NotFound)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
describe '#glossaries.language_pairs' do
|
274
|
+
let(:options) { {} }
|
275
|
+
|
276
|
+
around do |example|
|
277
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
278
|
+
VCR.use_cassette('deepl_glossaries') { example.call }
|
279
|
+
end
|
280
|
+
|
281
|
+
context 'When fetching language pairs supported by glossaries' do
|
282
|
+
it 'should create and call a request object' do
|
283
|
+
expect(DeepL::Requests::Glossary::LanguagePairs).to receive(:new)
|
284
|
+
.with(subject.api, options).and_call_original
|
285
|
+
|
286
|
+
language_pairs = subject.glossaries.language_pairs(options)
|
287
|
+
expect(language_pairs).to all(be_a(DeepL::Resources::LanguagePair))
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
103
292
|
end
|
@@ -0,0 +1,374 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-free.deepl.com/v2/glossaries?param=fake
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: name=Mi+Glosario&source_lang=EN&target_lang=ES&entries=Hello%09Hola%0AWorld%09Mundo%0A&entries_format=tsv
|
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: 201
|
23
|
+
message: Created
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Mon, 24 Jan 2022 00:37:04 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"glossary_id":"579859d0-0036-489f-8ad5-70c27ffcd3a9","name":"Mi Glosario","ready":true,"source_lang":"en","target_lang":"es","creation_time":"2022-01-24T00:37:04.932382+00:00","entry_count":2}'
|
38
|
+
recorded_at: Mon, 24 Jan 2022 00:37:05 GMT
|
39
|
+
- request:
|
40
|
+
method: get
|
41
|
+
uri: https://api-free.deepl.com/v2/glossaries/d9ad833f-c818-430c-a3c9-47071384fa3e
|
42
|
+
body:
|
43
|
+
encoding: US-ASCII
|
44
|
+
string: ''
|
45
|
+
headers:
|
46
|
+
Authorization:
|
47
|
+
- DeepL-Auth-Key VALID_TOKEN
|
48
|
+
Accept-Encoding:
|
49
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
50
|
+
Accept:
|
51
|
+
- "*/*"
|
52
|
+
User-Agent:
|
53
|
+
- Ruby
|
54
|
+
response:
|
55
|
+
status:
|
56
|
+
code: 200
|
57
|
+
message: OK
|
58
|
+
headers:
|
59
|
+
Server:
|
60
|
+
- nginx
|
61
|
+
Date:
|
62
|
+
- Mon, 24 Jan 2022 01:51:30 GMT
|
63
|
+
Content-Type:
|
64
|
+
- application/json; charset=utf-8
|
65
|
+
Transfer-Encoding:
|
66
|
+
- chunked
|
67
|
+
Connection:
|
68
|
+
- keep-alive
|
69
|
+
body:
|
70
|
+
encoding: UTF-8
|
71
|
+
string: '{"glossary_id":"d9ad833f-c818-430c-a3c9-47071384fa3e","name":"Mi Glosario","ready":true,"source_lang":"en","target_lang":"es","creation_time":"2022-01-23T23:01:10.073429+00:00","entry_count":2}'
|
72
|
+
recorded_at: Mon, 24 Jan 2022 01:51:30 GMT
|
73
|
+
- request:
|
74
|
+
method: get
|
75
|
+
uri: https://api-free.deepl.com/v2/glossaries/00000000-0000-0000-0000-000000000000
|
76
|
+
body:
|
77
|
+
encoding: US-ASCII
|
78
|
+
string: ''
|
79
|
+
headers:
|
80
|
+
Authorization:
|
81
|
+
- DeepL-Auth-Key VALID_TOKEN
|
82
|
+
Accept-Encoding:
|
83
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
84
|
+
Accept:
|
85
|
+
- "*/*"
|
86
|
+
User-Agent:
|
87
|
+
- Ruby
|
88
|
+
response:
|
89
|
+
status:
|
90
|
+
code: 404
|
91
|
+
message: Not Found
|
92
|
+
headers:
|
93
|
+
Server:
|
94
|
+
- nginx
|
95
|
+
Date:
|
96
|
+
- Mon, 24 Jan 2022 01:51:30 GMT
|
97
|
+
Content-Type:
|
98
|
+
- application/json; charset=utf-8
|
99
|
+
Transfer-Encoding:
|
100
|
+
- chunked
|
101
|
+
Connection:
|
102
|
+
- keep-alive
|
103
|
+
body:
|
104
|
+
encoding: UTF-8
|
105
|
+
string: '{"message":"Not found"}'
|
106
|
+
recorded_at: Mon, 24 Jan 2022 01:51:30 GMT
|
107
|
+
- request:
|
108
|
+
method: get
|
109
|
+
uri: https://api-free.deepl.com/v2/glossaries
|
110
|
+
body:
|
111
|
+
encoding: US-ASCII
|
112
|
+
string: ''
|
113
|
+
headers:
|
114
|
+
Authorization:
|
115
|
+
- DeepL-Auth-Key VALID_TOKEN
|
116
|
+
Accept-Encoding:
|
117
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
118
|
+
Accept:
|
119
|
+
- "*/*"
|
120
|
+
User-Agent:
|
121
|
+
- Ruby
|
122
|
+
response:
|
123
|
+
status:
|
124
|
+
code: 200
|
125
|
+
message: OK
|
126
|
+
headers:
|
127
|
+
Server:
|
128
|
+
- nginx
|
129
|
+
Date:
|
130
|
+
- Mon, 24 Jan 2022 02:24:30 GMT
|
131
|
+
Content-Type:
|
132
|
+
- application/json; charset=utf-8
|
133
|
+
Transfer-Encoding:
|
134
|
+
- chunked
|
135
|
+
Connection:
|
136
|
+
- keep-alive
|
137
|
+
body:
|
138
|
+
encoding: UTF-8
|
139
|
+
string: '{"glossaries":[{"glossary_id":"012a5576-b551-4d4c-b917-ce01bc8debb6","name":"Mi
|
140
|
+
Glosario","ready":true,"source_lang":"en","target_lang":"es","creation_time":"2022-01-24T02:21:43.300323+00:00","entry_count":2}]}'
|
141
|
+
recorded_at: Mon, 24 Jan 2022 02:24:30 GMT
|
142
|
+
- request:
|
143
|
+
method: delete
|
144
|
+
uri: https://api-free.deepl.com/v2/glossaries/c03fd58d-1a51-48c1-ad75-5a89d14e3e23
|
145
|
+
body:
|
146
|
+
encoding: US-ASCII
|
147
|
+
string: ''
|
148
|
+
headers:
|
149
|
+
Authorization:
|
150
|
+
- DeepL-Auth-Key VALID_TOKEN
|
151
|
+
Accept-Encoding:
|
152
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
153
|
+
Accept:
|
154
|
+
- "*/*"
|
155
|
+
User-Agent:
|
156
|
+
- Ruby
|
157
|
+
response:
|
158
|
+
status:
|
159
|
+
code: 204
|
160
|
+
message: No Content
|
161
|
+
headers:
|
162
|
+
Server:
|
163
|
+
- nginx
|
164
|
+
Date:
|
165
|
+
- Mon, 24 Jan 2022 02:39:36 GMT
|
166
|
+
Connection:
|
167
|
+
- keep-alive
|
168
|
+
body:
|
169
|
+
encoding: UTF-8
|
170
|
+
string: ''
|
171
|
+
recorded_at: Mon, 24 Jan 2022 02:39:35 GMT
|
172
|
+
- request:
|
173
|
+
method: delete
|
174
|
+
uri: https://api-free.deepl.com/v2/glossaries/00000000-0000-0000-0000-000000000000
|
175
|
+
body:
|
176
|
+
encoding: US-ASCII
|
177
|
+
string: ''
|
178
|
+
headers:
|
179
|
+
Authorization:
|
180
|
+
- DeepL-Auth-Key VALID_TOKEN
|
181
|
+
Accept-Encoding:
|
182
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
183
|
+
Accept:
|
184
|
+
- "*/*"
|
185
|
+
User-Agent:
|
186
|
+
- Ruby
|
187
|
+
response:
|
188
|
+
status:
|
189
|
+
code: 404
|
190
|
+
message: Not Found
|
191
|
+
headers:
|
192
|
+
Server:
|
193
|
+
- nginx
|
194
|
+
Date:
|
195
|
+
- Mon, 24 Jan 2022 02:39:36 GMT
|
196
|
+
Content-Type:
|
197
|
+
- application/json; charset=utf-8
|
198
|
+
Transfer-Encoding:
|
199
|
+
- chunked
|
200
|
+
Connection:
|
201
|
+
- keep-alive
|
202
|
+
body:
|
203
|
+
encoding: UTF-8
|
204
|
+
string: '{"message":"Not found"}'
|
205
|
+
recorded_at: Mon, 24 Jan 2022 02:39:36 GMT
|
206
|
+
- request:
|
207
|
+
method: get
|
208
|
+
uri: https://api-free.deepl.com/v2/glossaries/012a5576-b551-4d4c-b917-ce01bc8debb6/entries
|
209
|
+
body:
|
210
|
+
encoding: US-ASCII
|
211
|
+
string: ''
|
212
|
+
headers:
|
213
|
+
Authorization:
|
214
|
+
- DeepL-Auth-Key VALID_TOKEN
|
215
|
+
Accept-Encoding:
|
216
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
217
|
+
Accept:
|
218
|
+
- "*/*"
|
219
|
+
User-Agent:
|
220
|
+
- Ruby
|
221
|
+
response:
|
222
|
+
status:
|
223
|
+
code: 200
|
224
|
+
message: OK
|
225
|
+
headers:
|
226
|
+
Server:
|
227
|
+
- nginx
|
228
|
+
Date:
|
229
|
+
- Mon, 24 Jan 2022 02:52:12 GMT
|
230
|
+
Content-Type:
|
231
|
+
- text/tab-separated-values; charset=UTF-8
|
232
|
+
Content-Length:
|
233
|
+
- '22'
|
234
|
+
Connection:
|
235
|
+
- keep-alive
|
236
|
+
body:
|
237
|
+
encoding: UTF-8
|
238
|
+
string: "Hello\tHola\nWorld\tMundo"
|
239
|
+
recorded_at: Mon, 24 Jan 2022 02:52:12 GMT
|
240
|
+
- request:
|
241
|
+
method: get
|
242
|
+
uri: https://api-free.deepl.com/v2/glossaries/00000000-0000-0000-0000-000000000000/entries
|
243
|
+
body:
|
244
|
+
encoding: US-ASCII
|
245
|
+
string: ''
|
246
|
+
headers:
|
247
|
+
Authorization:
|
248
|
+
- DeepL-Auth-Key VALID_TOKEN
|
249
|
+
Accept-Encoding:
|
250
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
251
|
+
Accept:
|
252
|
+
- "*/*"
|
253
|
+
User-Agent:
|
254
|
+
- Ruby
|
255
|
+
response:
|
256
|
+
status:
|
257
|
+
code: 404
|
258
|
+
message: Not Found
|
259
|
+
headers:
|
260
|
+
Server:
|
261
|
+
- nginx
|
262
|
+
Date:
|
263
|
+
- Mon, 24 Jan 2022 02:52:13 GMT
|
264
|
+
Content-Type:
|
265
|
+
- application/json; charset=utf-8
|
266
|
+
Transfer-Encoding:
|
267
|
+
- chunked
|
268
|
+
Connection:
|
269
|
+
- keep-alive
|
270
|
+
body:
|
271
|
+
encoding: UTF-8
|
272
|
+
string: '{"message":"Not found"}'
|
273
|
+
recorded_at: Mon, 24 Jan 2022 02:52:12 GMT
|
274
|
+
- request:
|
275
|
+
method: get
|
276
|
+
uri: https://api-free.deepl.com/v2/glossary-language-pairs
|
277
|
+
body:
|
278
|
+
encoding: US-ASCII
|
279
|
+
string: ''
|
280
|
+
headers:
|
281
|
+
Authorization:
|
282
|
+
- DeepL-Auth-Key VALID_TOKEN
|
283
|
+
Accept-Encoding:
|
284
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
285
|
+
Accept:
|
286
|
+
- "*/*"
|
287
|
+
User-Agent:
|
288
|
+
- Ruby
|
289
|
+
response:
|
290
|
+
status:
|
291
|
+
code: 200
|
292
|
+
message: OK
|
293
|
+
headers:
|
294
|
+
Server:
|
295
|
+
- nginx
|
296
|
+
Date:
|
297
|
+
- Mon, 24 Jan 2022 03:01:06 GMT
|
298
|
+
Content-Type:
|
299
|
+
- application/json; charset=utf-8
|
300
|
+
Transfer-Encoding:
|
301
|
+
- chunked
|
302
|
+
Connection:
|
303
|
+
- keep-alive
|
304
|
+
body:
|
305
|
+
encoding: UTF-8
|
306
|
+
string: '{"supported_languages":[{"source_lang":"de","target_lang":"en"},{"source_lang":"en","target_lang":"de"},{"source_lang":"en","target_lang":"es"},{"source_lang":"en","target_lang":"fr"},{"source_lang":"es","target_lang":"en"},{"source_lang":"fr","target_lang":"en"}]}'
|
307
|
+
recorded_at: Mon, 24 Jan 2022 03:01:06 GMT
|
308
|
+
- request:
|
309
|
+
method: post
|
310
|
+
uri: https://api-free.deepl.com/v2/glossaries
|
311
|
+
body:
|
312
|
+
encoding: US-ASCII
|
313
|
+
string: name=fixture&source_lang=EN&target_lang=ES&entries=Hello%09Hola%0A&entries_format=tsv
|
314
|
+
headers:
|
315
|
+
Authorization:
|
316
|
+
- DeepL-Auth-Key VALID_TOKEN
|
317
|
+
Accept-Encoding:
|
318
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
319
|
+
Accept:
|
320
|
+
- "*/*"
|
321
|
+
User-Agent:
|
322
|
+
- Ruby
|
323
|
+
Content-Type:
|
324
|
+
- application/x-www-form-urlencoded
|
325
|
+
response:
|
326
|
+
status:
|
327
|
+
code: 201
|
328
|
+
message: Created
|
329
|
+
headers:
|
330
|
+
Server:
|
331
|
+
- nginx
|
332
|
+
Date:
|
333
|
+
- Tue, 25 Jan 2022 00:53:44 GMT
|
334
|
+
Content-Type:
|
335
|
+
- application/json; charset=utf-8
|
336
|
+
Transfer-Encoding:
|
337
|
+
- chunked
|
338
|
+
Connection:
|
339
|
+
- keep-alive
|
340
|
+
body:
|
341
|
+
encoding: UTF-8
|
342
|
+
string: '{"glossary_id":"fd53187f-2306-4f0a-aa13-00df678bd609","name":"fixture","ready":true,"source_lang":"en","target_lang":"es","creation_time":"2022-01-25T00:53:44.380234+00:00","entry_count":1}'
|
343
|
+
recorded_at: Tue, 25 Jan 2022 00:53:44 GMT
|
344
|
+
- request:
|
345
|
+
method: delete
|
346
|
+
uri: https://api-free.deepl.com/v2/glossaries/fd53187f-2306-4f0a-aa13-00df678bd609
|
347
|
+
body:
|
348
|
+
encoding: US-ASCII
|
349
|
+
string: ''
|
350
|
+
headers:
|
351
|
+
Authorization:
|
352
|
+
- DeepL-Auth-Key VALID_TOKEN
|
353
|
+
Accept-Encoding:
|
354
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
355
|
+
Accept:
|
356
|
+
- "*/*"
|
357
|
+
User-Agent:
|
358
|
+
- Ruby
|
359
|
+
response:
|
360
|
+
status:
|
361
|
+
code: 204
|
362
|
+
message: No Content
|
363
|
+
headers:
|
364
|
+
Server:
|
365
|
+
- nginx
|
366
|
+
Date:
|
367
|
+
- Tue, 25 Jan 2022 00:53:44 GMT
|
368
|
+
Connection:
|
369
|
+
- keep-alive
|
370
|
+
body:
|
371
|
+
encoding: UTF-8
|
372
|
+
string: ''
|
373
|
+
recorded_at: Tue, 25 Jan 2022 00:53:45 GMT
|
374
|
+
recorded_with: VCR 6.0.0
|
@@ -2,11 +2,13 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://api-free.deepl.com/v2/languages?
|
5
|
+
uri: https://api-free.deepl.com/v2/languages?type=target
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
|
+
Authorization:
|
11
|
+
- DeepL-Auth-Key VALID_TOKEN
|
10
12
|
Accept-Encoding:
|
11
13
|
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
14
|
Accept:
|