deepl-rb 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +1 -13
- data/.rubocop.yml +1 -0
- data/Gemfile +6 -0
- data/README.md +55 -24
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/deepl-rb.gemspec +16 -10
- data/lib/deepl.rb +9 -0
- data/lib/deepl/api.rb +2 -0
- data/lib/deepl/configuration.rb +2 -0
- data/lib/deepl/exceptions/authorization_failed.rb +2 -0
- data/lib/deepl/exceptions/bad_request.rb +4 -0
- data/lib/deepl/exceptions/error.rb +2 -0
- data/lib/deepl/exceptions/limit_exceeded.rb +2 -0
- data/lib/deepl/exceptions/quota_exceeded.rb +11 -0
- data/lib/deepl/exceptions/request_error.rb +4 -1
- data/lib/deepl/requests/base.rb +4 -1
- data/lib/deepl/requests/languages.rb +28 -0
- data/lib/deepl/requests/translate.rb +3 -0
- data/lib/deepl/requests/usage.rb +2 -0
- data/lib/deepl/resources/base.rb +2 -0
- data/lib/deepl/resources/language.rb +20 -0
- data/lib/deepl/resources/text.rb +2 -0
- data/lib/deepl/resources/usage.rb +2 -0
- data/spec/api/api_spec.rb +2 -0
- data/spec/api/configuration_spec.rb +3 -1
- data/spec/api/deepl_spec.rb +24 -0
- data/spec/fixtures/vcr_cassettes/deepl_languages.yml +41 -0
- data/spec/fixtures/vcr_cassettes/deepl_translate.yml +4 -5
- data/spec/fixtures/vcr_cassettes/deepl_usage.yml +10 -7
- data/spec/fixtures/vcr_cassettes/languages.yml +108 -0
- data/spec/fixtures/vcr_cassettes/translate_texts.yml +69 -33
- data/spec/fixtures/vcr_cassettes/usage.yml +10 -7
- data/spec/requests/languages_spec.rb +58 -0
- data/spec/requests/translate_spec.rb +6 -3
- data/spec/requests/usage_spec.rb +2 -0
- data/spec/resources/language_spec.rb +20 -0
- data/spec/resources/text_spec.rb +4 -2
- data/spec/resources/usage_spec.rb +5 -3
- data/spec/spec_helper.rb +3 -1
- metadata +27 -8
- data/Gemfile.lock +0 -113
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module DeepL
|
2
4
|
module Requests
|
3
5
|
class Translate < Base
|
@@ -31,6 +33,7 @@ module DeepL
|
|
31
33
|
def tweak_parameters!
|
32
34
|
OPTIONS_CONVERSIONS.each do |param, converter|
|
33
35
|
next unless option?(param) && converter[option(param)]
|
36
|
+
|
34
37
|
set_option(param, converter[option(param)])
|
35
38
|
end
|
36
39
|
end
|
data/lib/deepl/requests/usage.rb
CHANGED
data/lib/deepl/resources/base.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DeepL
|
4
|
+
module Resources
|
5
|
+
class Language < Base
|
6
|
+
attr_reader :code, :name
|
7
|
+
|
8
|
+
def initialize(code, name, *args)
|
9
|
+
super(*args)
|
10
|
+
|
11
|
+
@code = code
|
12
|
+
@name = name
|
13
|
+
end
|
14
|
+
|
15
|
+
def to_s
|
16
|
+
"#{code} - #{name}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/deepl/resources/text.rb
CHANGED
data/spec/api/api_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DeepL::Configuration do
|
@@ -14,7 +16,7 @@ describe DeepL::Configuration do
|
|
14
16
|
end
|
15
17
|
|
16
18
|
context 'When using custom configuration attributes' do
|
17
|
-
let(:attributes) { { auth_key: 'SAMPLE', host: '
|
19
|
+
let(:attributes) { { auth_key: 'SAMPLE', host: 'https://api-free.deepl.com', version: 'v1' } }
|
18
20
|
|
19
21
|
it 'should use custom attributes' do
|
20
22
|
expect(subject.auth_key).to eq(attributes[:auth_key])
|
data/spec/api/deepl_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe DeepL do
|
@@ -45,6 +47,7 @@ describe DeepL do
|
|
45
47
|
let(:options) { { param: 'fake' } }
|
46
48
|
|
47
49
|
around do |example|
|
50
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
48
51
|
VCR.use_cassette('deepl_translate') { example.call }
|
49
52
|
end
|
50
53
|
|
@@ -63,6 +66,7 @@ describe DeepL do
|
|
63
66
|
let(:options) { {} }
|
64
67
|
|
65
68
|
around do |example|
|
69
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
66
70
|
VCR.use_cassette('deepl_usage') { example.call }
|
67
71
|
end
|
68
72
|
|
@@ -76,4 +80,24 @@ describe DeepL do
|
|
76
80
|
end
|
77
81
|
end
|
78
82
|
end
|
83
|
+
|
84
|
+
describe '#languages' do
|
85
|
+
let(:options) { { type: :target } }
|
86
|
+
|
87
|
+
around do |example|
|
88
|
+
subject.configure { |config| config.host = 'https://api-free.deepl.com' }
|
89
|
+
VCR.use_cassette('deepl_languages') { example.call }
|
90
|
+
end
|
91
|
+
|
92
|
+
context 'When checking languages' do
|
93
|
+
it 'should create and call a request object' do
|
94
|
+
expect(DeepL::Requests::Languages).to receive(:new)
|
95
|
+
.with(subject.api, options).and_call_original
|
96
|
+
|
97
|
+
languages = subject.languages(options)
|
98
|
+
expect(languages).to be_an(Array)
|
99
|
+
expect(languages.all? { |l| l.is_a?(DeepL::Resources::Language) }).to be_truthy
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
79
103
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api-free.deepl.com/v2/languages?auth_key=VALID_TOKEN&type=target
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 May 2021 15:07:54 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '1667'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '[{"language":"BG","name":"Bulgarian","supports_formality":false},{"language":"CS","name":"Czech","supports_formality":false},{"language":"DA","name":"Danish","supports_formality":false},{"language":"DE","name":"German","supports_formality":true},{"language":"EL","name":"Greek","supports_formality":false},{"language":"EN-GB","name":"English
|
36
|
+
(British)","supports_formality":false},{"language":"EN-US","name":"English
|
37
|
+
(American)","supports_formality":false},{"language":"ES","name":"Spanish","supports_formality":true},{"language":"ET","name":"Estonian","supports_formality":false},{"language":"FI","name":"Finnish","supports_formality":false},{"language":"FR","name":"French","supports_formality":true},{"language":"HU","name":"Hungarian","supports_formality":false},{"language":"IT","name":"Italian","supports_formality":true},{"language":"JA","name":"Japanese","supports_formality":false},{"language":"LT","name":"Lithuanian","supports_formality":false},{"language":"LV","name":"Latvian","supports_formality":false},{"language":"NL","name":"Dutch","supports_formality":true},{"language":"PL","name":"Polish","supports_formality":true},{"language":"PT-BR","name":"Portuguese
|
38
|
+
(Brazilian)","supports_formality":true},{"language":"PT-PT","name":"Portuguese
|
39
|
+
(European)","supports_formality":true},{"language":"RO","name":"Romanian","supports_formality":false},{"language":"RU","name":"Russian","supports_formality":true},{"language":"SK","name":"Slovak","supports_formality":false},{"language":"SL","name":"Slovenian","supports_formality":false},{"language":"SV","name":"Swedish","supports_formality":false},{"language":"ZH","name":"Chinese","supports_formality":false}]'
|
40
|
+
recorded_at: Mon, 17 May 2021 15:07:54 GMT
|
41
|
+
recorded_with: VCR 6.0.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN¶m=fake
|
5
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN¶m=fake
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: text=Sample&source_lang=EN&target_lang=ES
|
@@ -23,7 +23,7 @@ http_interactions:
|
|
23
23
|
Server:
|
24
24
|
- nginx
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Mon, 17 May 2021 14:42:56 GMT
|
27
27
|
Content-Type:
|
28
28
|
- application/json
|
29
29
|
Content-Length:
|
@@ -35,6 +35,5 @@ http_interactions:
|
|
35
35
|
body:
|
36
36
|
encoding: UTF-8
|
37
37
|
string: '{"translations":[{"detected_source_language":"EN","text":"Muestra"}]}'
|
38
|
-
|
39
|
-
|
40
|
-
recorded_with: VCR 4.0.0
|
38
|
+
recorded_at: Mon, 17 May 2021 14:42:56 GMT
|
39
|
+
recorded_with: VCR 6.0.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://api.deepl.com/v2/usage?auth_key=VALID_TOKEN
|
5
|
+
uri: https://api-free.deepl.com/v2/usage?auth_key=VALID_TOKEN
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -21,14 +21,17 @@ http_interactions:
|
|
21
21
|
Server:
|
22
22
|
- nginx
|
23
23
|
Date:
|
24
|
-
-
|
24
|
+
- Mon, 17 May 2021 14:18:28 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
25
27
|
Content-Length:
|
26
|
-
- '
|
28
|
+
- '48'
|
27
29
|
Connection:
|
28
30
|
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
29
33
|
body:
|
30
34
|
encoding: UTF-8
|
31
|
-
string: '{"character_count":
|
32
|
-
|
33
|
-
|
34
|
-
recorded_with: VCR 4.0.0
|
35
|
+
string: '{"character_count":303,"character_limit":500000}'
|
36
|
+
recorded_at: Mon, 17 May 2021 14:18:28 GMT
|
37
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,108 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api-free.deepl.com/v2/languages?auth_key=VALID_TOKEN
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Mon, 17 May 2021 14:49:42 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Content-Length:
|
28
|
+
- '845'
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Access-Control-Allow-Origin:
|
32
|
+
- "*"
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '[{"language":"BG","name":"Bulgarian"},{"language":"CS","name":"Czech"},{"language":"DA","name":"Danish"},{"language":"DE","name":"German"},{"language":"EL","name":"Greek"},{"language":"EN","name":"English"},{"language":"ES","name":"Spanish"},{"language":"ET","name":"Estonian"},{"language":"FI","name":"Finnish"},{"language":"FR","name":"French"},{"language":"HU","name":"Hungarian"},{"language":"IT","name":"Italian"},{"language":"JA","name":"Japanese"},{"language":"LT","name":"Lithuanian"},{"language":"LV","name":"Latvian"},{"language":"NL","name":"Dutch"},{"language":"PL","name":"Polish"},{"language":"PT","name":"Portuguese"},{"language":"RO","name":"Romanian"},{"language":"RU","name":"Russian"},{"language":"SK","name":"Slovak"},{"language":"SL","name":"Slovenian"},{"language":"SV","name":"Swedish"},{"language":"ZH","name":"Chinese"}]'
|
36
|
+
recorded_at: Mon, 17 May 2021 14:49:42 GMT
|
37
|
+
- request:
|
38
|
+
method: get
|
39
|
+
uri: https://api-free.deepl.com/v2/languages?auth_key=VALID_TOKEN&type=target
|
40
|
+
body:
|
41
|
+
encoding: US-ASCII
|
42
|
+
string: ''
|
43
|
+
headers:
|
44
|
+
Accept-Encoding:
|
45
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
46
|
+
Accept:
|
47
|
+
- "*/*"
|
48
|
+
User-Agent:
|
49
|
+
- Ruby
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
55
|
+
Server:
|
56
|
+
- nginx
|
57
|
+
Date:
|
58
|
+
- Mon, 17 May 2021 14:55:30 GMT
|
59
|
+
Content-Type:
|
60
|
+
- application/json
|
61
|
+
Content-Length:
|
62
|
+
- '1667'
|
63
|
+
Connection:
|
64
|
+
- keep-alive
|
65
|
+
Access-Control-Allow-Origin:
|
66
|
+
- "*"
|
67
|
+
body:
|
68
|
+
encoding: UTF-8
|
69
|
+
string: '[{"language":"BG","name":"Bulgarian","supports_formality":false},{"language":"CS","name":"Czech","supports_formality":false},{"language":"DA","name":"Danish","supports_formality":false},{"language":"DE","name":"German","supports_formality":true},{"language":"EL","name":"Greek","supports_formality":false},{"language":"EN-GB","name":"English
|
70
|
+
(British)","supports_formality":false},{"language":"EN-US","name":"English
|
71
|
+
(American)","supports_formality":false},{"language":"ES","name":"Spanish","supports_formality":true},{"language":"ET","name":"Estonian","supports_formality":false},{"language":"FI","name":"Finnish","supports_formality":false},{"language":"FR","name":"French","supports_formality":true},{"language":"HU","name":"Hungarian","supports_formality":false},{"language":"IT","name":"Italian","supports_formality":true},{"language":"JA","name":"Japanese","supports_formality":false},{"language":"LT","name":"Lithuanian","supports_formality":false},{"language":"LV","name":"Latvian","supports_formality":false},{"language":"NL","name":"Dutch","supports_formality":true},{"language":"PL","name":"Polish","supports_formality":true},{"language":"PT-BR","name":"Portuguese
|
72
|
+
(Brazilian)","supports_formality":true},{"language":"PT-PT","name":"Portuguese
|
73
|
+
(European)","supports_formality":true},{"language":"RO","name":"Romanian","supports_formality":false},{"language":"RU","name":"Russian","supports_formality":true},{"language":"SK","name":"Slovak","supports_formality":false},{"language":"SL","name":"Slovenian","supports_formality":false},{"language":"SV","name":"Swedish","supports_formality":false},{"language":"ZH","name":"Chinese","supports_formality":false}]'
|
74
|
+
recorded_at: Mon, 17 May 2021 14:55:30 GMT
|
75
|
+
- request:
|
76
|
+
method: get
|
77
|
+
uri: https://api-free.deepl.com/v2/languages?auth_key=VALID_TOKEN&type=invalid
|
78
|
+
body:
|
79
|
+
encoding: US-ASCII
|
80
|
+
string: ''
|
81
|
+
headers:
|
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: 400
|
91
|
+
message: Bad Request
|
92
|
+
headers:
|
93
|
+
Server:
|
94
|
+
- nginx
|
95
|
+
Date:
|
96
|
+
- Mon, 17 May 2021 14:57:00 GMT
|
97
|
+
Content-Length:
|
98
|
+
- '82'
|
99
|
+
Connection:
|
100
|
+
- keep-alive
|
101
|
+
Access-Control-Allow-Origin:
|
102
|
+
- "*"
|
103
|
+
body:
|
104
|
+
encoding: UTF-8
|
105
|
+
string: '{"message":"Parameter ''type'' is invalid. ''source'' and ''target''
|
106
|
+
are valid values."}'
|
107
|
+
recorded_at: Mon, 17 May 2021 14:57:00 GMT
|
108
|
+
recorded_with: VCR 6.0.0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: post
|
5
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
5
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: text=Sample+text&source_lang=EN&target_lang=ES
|
@@ -23,11 +23,11 @@ http_interactions:
|
|
23
23
|
Server:
|
24
24
|
- nginx
|
25
25
|
Date:
|
26
|
-
-
|
26
|
+
- Mon, 17 May 2021 14:20:14 GMT
|
27
27
|
Content-Type:
|
28
28
|
- application/json
|
29
29
|
Content-Length:
|
30
|
-
- '
|
30
|
+
- '78'
|
31
31
|
Connection:
|
32
32
|
- keep-alive
|
33
33
|
Access-Control-Allow-Origin:
|
@@ -36,11 +36,10 @@ http_interactions:
|
|
36
36
|
encoding: UTF-8
|
37
37
|
string: '{"translations":[{"detected_source_language":"EN","text":"Texto de
|
38
38
|
muestra"}]}'
|
39
|
-
|
40
|
-
recorded_at: Tue, 08 May 2018 16:31:34 GMT
|
39
|
+
recorded_at: Mon, 17 May 2021 14:20:14 GMT
|
41
40
|
- request:
|
42
41
|
method: post
|
43
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
42
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
44
43
|
body:
|
45
44
|
encoding: US-ASCII
|
46
45
|
string: text=Sample&text=Word&source_lang=EN&target_lang=ES
|
@@ -61,7 +60,7 @@ http_interactions:
|
|
61
60
|
Server:
|
62
61
|
- nginx
|
63
62
|
Date:
|
64
|
-
-
|
63
|
+
- Mon, 17 May 2021 14:20:14 GMT
|
65
64
|
Content-Type:
|
66
65
|
- application/json
|
67
66
|
Content-Length:
|
@@ -73,11 +72,10 @@ http_interactions:
|
|
73
72
|
body:
|
74
73
|
encoding: UTF-8
|
75
74
|
string: '{"translations":[{"detected_source_language":"EN","text":"Muestra"},{"detected_source_language":"EN","text":"Palabra"}]}'
|
76
|
-
|
77
|
-
recorded_at: Tue, 08 May 2018 16:31:35 GMT
|
75
|
+
recorded_at: Mon, 17 May 2021 14:20:14 GMT
|
78
76
|
- request:
|
79
77
|
method: post
|
80
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
78
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&tag_handling=xml
|
81
79
|
body:
|
82
80
|
encoding: US-ASCII
|
83
81
|
string: text=%3Cp%3ESample+text%3C%2Fp%3E&source_lang=EN&target_lang=ES
|
@@ -98,7 +96,7 @@ http_interactions:
|
|
98
96
|
Server:
|
99
97
|
- nginx
|
100
98
|
Date:
|
101
|
-
-
|
99
|
+
- Mon, 17 May 2021 14:20:15 GMT
|
102
100
|
Content-Type:
|
103
101
|
- application/json
|
104
102
|
Content-Length:
|
@@ -111,11 +109,47 @@ http_interactions:
|
|
111
109
|
encoding: UTF-8
|
112
110
|
string: '{"translations":[{"detected_source_language":"EN","text":"<p>Texto
|
113
111
|
de muestra</p>"}]}'
|
114
|
-
|
115
|
-
recorded_at: Tue, 08 May 2018 16:31:36 GMT
|
112
|
+
recorded_at: Mon, 17 May 2021 14:20:15 GMT
|
116
113
|
- request:
|
117
114
|
method: post
|
118
|
-
uri: https://api.deepl.com/v2/translate?auth_key=
|
115
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&ignore_tags=code,span
|
116
|
+
body:
|
117
|
+
encoding: US-ASCII
|
118
|
+
string: text=Welcome+and+%3Ccode%3EHello+great+World%3C%2Fcode%3E+Good+Morning%21&source_lang=EN&target_lang=ES
|
119
|
+
headers:
|
120
|
+
Accept-Encoding:
|
121
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
122
|
+
Accept:
|
123
|
+
- "*/*"
|
124
|
+
User-Agent:
|
125
|
+
- Ruby
|
126
|
+
Content-Type:
|
127
|
+
- application/x-www-form-urlencoded
|
128
|
+
response:
|
129
|
+
status:
|
130
|
+
code: 200
|
131
|
+
message: OK
|
132
|
+
headers:
|
133
|
+
Server:
|
134
|
+
- nginx
|
135
|
+
Date:
|
136
|
+
- Mon, 17 May 2021 14:20:16 GMT
|
137
|
+
Content-Type:
|
138
|
+
- application/json
|
139
|
+
Content-Length:
|
140
|
+
- '119'
|
141
|
+
Connection:
|
142
|
+
- keep-alive
|
143
|
+
Access-Control-Allow-Origin:
|
144
|
+
- "*"
|
145
|
+
body:
|
146
|
+
encoding: ASCII-8BIT
|
147
|
+
string: !binary |-
|
148
|
+
eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IkJpZW52ZW5pZG8geSA8Y29kZT5Ib2xhIGdyYW4gbXVuZG88L2NvZGU+IMKhQnVlbm9zIGTDrWFzISJ9XX0=
|
149
|
+
recorded_at: Mon, 17 May 2021 14:20:16 GMT
|
150
|
+
- request:
|
151
|
+
method: post
|
152
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=invalid
|
119
153
|
body:
|
120
154
|
encoding: US-ASCII
|
121
155
|
string: text=Sample+text&source_lang=EN&target_lang=ES
|
@@ -136,19 +170,20 @@ http_interactions:
|
|
136
170
|
Server:
|
137
171
|
- nginx
|
138
172
|
Date:
|
139
|
-
-
|
173
|
+
- Mon, 17 May 2021 14:20:16 GMT
|
140
174
|
Content-Length:
|
141
175
|
- '0'
|
142
176
|
Connection:
|
143
177
|
- keep-alive
|
178
|
+
Access-Control-Allow-Origin:
|
179
|
+
- "*"
|
144
180
|
body:
|
145
181
|
encoding: UTF-8
|
146
182
|
string: ''
|
147
|
-
|
148
|
-
recorded_at: Tue, 08 May 2018 16:31:37 GMT
|
183
|
+
recorded_at: Mon, 17 May 2021 14:20:16 GMT
|
149
184
|
- request:
|
150
185
|
method: post
|
151
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
186
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
152
187
|
body:
|
153
188
|
encoding: US-ASCII
|
154
189
|
string: source_lang=EN&target_lang=ES
|
@@ -169,19 +204,20 @@ http_interactions:
|
|
169
204
|
Server:
|
170
205
|
- nginx
|
171
206
|
Date:
|
172
|
-
-
|
207
|
+
- Mon, 17 May 2021 14:20:16 GMT
|
173
208
|
Content-Length:
|
174
209
|
- '45'
|
175
210
|
Connection:
|
176
211
|
- keep-alive
|
212
|
+
Access-Control-Allow-Origin:
|
213
|
+
- "*"
|
177
214
|
body:
|
178
215
|
encoding: UTF-8
|
179
216
|
string: '{"message":"Parameter ''text'' not specified."}'
|
180
|
-
|
181
|
-
recorded_at: Tue, 08 May 2018 16:31:37 GMT
|
217
|
+
recorded_at: Mon, 17 May 2021 14:20:16 GMT
|
182
218
|
- request:
|
183
219
|
method: post
|
184
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
220
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN
|
185
221
|
body:
|
186
222
|
encoding: US-ASCII
|
187
223
|
string: text=Sample+text&source_lang=EN
|
@@ -202,19 +238,20 @@ http_interactions:
|
|
202
238
|
Server:
|
203
239
|
- nginx
|
204
240
|
Date:
|
205
|
-
-
|
241
|
+
- Mon, 17 May 2021 14:20:17 GMT
|
206
242
|
Content-Length:
|
207
243
|
- '52'
|
208
244
|
Connection:
|
209
245
|
- keep-alive
|
246
|
+
Access-Control-Allow-Origin:
|
247
|
+
- "*"
|
210
248
|
body:
|
211
249
|
encoding: UTF-8
|
212
|
-
string: '{"message":"
|
213
|
-
|
214
|
-
recorded_at: Tue, 08 May 2018 16:31:37 GMT
|
250
|
+
string: '{"message":"Value for ''target_lang'' not supported."}'
|
251
|
+
recorded_at: Mon, 17 May 2021 14:20:17 GMT
|
215
252
|
- request:
|
216
253
|
method: post
|
217
|
-
uri: https://api.deepl.com/v2/translate?auth_key=VALID_TOKEN&ignore_tags=code
|
254
|
+
uri: https://api-free.deepl.com/v2/translate?auth_key=VALID_TOKEN&ignore_tags=code,span&tag_handling=xml
|
218
255
|
body:
|
219
256
|
encoding: US-ASCII
|
220
257
|
string: text=Welcome+and+%3Ccode%3EHello+great+World%3C%2Fcode%3E+Good+Morning%21&source_lang=EN&target_lang=ES
|
@@ -235,11 +272,11 @@ http_interactions:
|
|
235
272
|
Server:
|
236
273
|
- nginx
|
237
274
|
Date:
|
238
|
-
-
|
275
|
+
- Mon, 17 May 2021 14:20:56 GMT
|
239
276
|
Content-Type:
|
240
277
|
- application/json
|
241
278
|
Content-Length:
|
242
|
-
- '
|
279
|
+
- '121'
|
243
280
|
Connection:
|
244
281
|
- keep-alive
|
245
282
|
Access-Control-Allow-Origin:
|
@@ -247,7 +284,6 @@ http_interactions:
|
|
247
284
|
body:
|
248
285
|
encoding: ASCII-8BIT
|
249
286
|
string: !binary |-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
recorded_with: VCR 4.0.0
|
287
|
+
eyJ0cmFuc2xhdGlvbnMiOlt7ImRldGVjdGVkX3NvdXJjZV9sYW5ndWFnZSI6IkVOIiwidGV4dCI6IkJpZW52ZW5pZG8geSA8Y29kZT5IZWxsbyBncmVhdCBXb3JsZDwvY29kZT4gwqFCdWVub3MgZMOtYXMhIn1dfQ==
|
288
|
+
recorded_at: Mon, 17 May 2021 14:20:56 GMT
|
289
|
+
recorded_with: VCR 6.0.0
|