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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -4
  3. data/README.md +94 -0
  4. data/VERSION +1 -1
  5. data/deepl-rb.gemspec +24 -4
  6. data/lib/deepl/exceptions/not_found.rb +13 -0
  7. data/lib/deepl/glossary_api.rb +35 -0
  8. data/lib/deepl/requests/base.rb +21 -4
  9. data/lib/deepl/requests/glossary/create.rb +45 -0
  10. data/lib/deepl/requests/glossary/destroy.rb +30 -0
  11. data/lib/deepl/requests/glossary/entries.rb +30 -0
  12. data/lib/deepl/requests/glossary/find.rb +31 -0
  13. data/lib/deepl/requests/glossary/language_pairs.rb +31 -0
  14. data/lib/deepl/requests/glossary/list.rb +30 -0
  15. data/lib/deepl/resources/glossary.rb +25 -0
  16. data/lib/deepl/resources/language_pair.rb +20 -0
  17. data/lib/deepl.rb +15 -0
  18. data/spec/api/deepl_spec.rb +189 -0
  19. data/spec/fixtures/vcr_cassettes/deepl_glossaries.yml +374 -0
  20. data/spec/fixtures/vcr_cassettes/deepl_languages.yml +3 -1
  21. data/spec/fixtures/vcr_cassettes/deepl_translate.yml +212 -1
  22. data/spec/fixtures/vcr_cassettes/deepl_usage.yml +3 -1
  23. data/spec/fixtures/vcr_cassettes/glossaries.yml +480 -0
  24. data/spec/fixtures/vcr_cassettes/languages.yml +9 -3
  25. data/spec/fixtures/vcr_cassettes/translate_texts.yml +340 -322
  26. data/spec/fixtures/vcr_cassettes/usage.yml +3 -1
  27. data/spec/requests/glossary/create_spec.rb +55 -0
  28. data/spec/requests/glossary/destroy_spec.rb +50 -0
  29. data/spec/requests/glossary/entries_spec.rb +48 -0
  30. data/spec/requests/glossary/find_spec.rb +54 -0
  31. data/spec/requests/glossary/language_pairs_spec.rb +30 -0
  32. data/spec/requests/glossary/list_spec.rb +44 -0
  33. data/spec/resources/glossary_spec.rb +35 -0
  34. data/spec/resources/language_pair_spec.rb +20 -0
  35. data/spec/spec_helper.rb +2 -2
  36. metadata +23 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f9236d354e5ca92bb03e6c8f34e9b332dff42c1bd985a80193b39f7509bbf99
4
- data.tar.gz: d0796f1d303279647026c81a588f1d8442b526edc9c0f7be13252fff7cbd957b
3
+ metadata.gz: 50a94f4bc3e0633bf578ae6fd53d794632e2b7a03b8d2a78b9678ed44289043c
4
+ data.tar.gz: 74e5911707588b9fd75684bbdce7092b492deafc5c3cef4e47c2732006a3bfb9
5
5
  SHA512:
6
- metadata.gz: 9c30aea5725784be6a7766bc9d7c8a0909338937352dfbe04254341d7355f12ffad801c14364b10a8b0eefccc52dd003783e22f3b9679f65767fb664b27b710f
7
- data.tar.gz: 3a4b61ebfdd6f130ec1d24a0d7ee81c7cab1b783dfb7a6e113a2af91f4240863fe727c5a054b9487e3d4bd2af011d644d15b426ae46a1c435b89ade536cc7c6a
6
+ metadata.gz: 9700c6128ab06b432596131da46cbdb240c433baeecb2ece7b74860040818fd3a9e32cf9c4a9384a6a8875200c4aa69f0fa74f533ffc6a4aeb9b9736e76b577f
7
+ data.tar.gz: 5a60db0a73691310159cfc92036c36e317f247f7bd0ece2b1002723068ffa531f43d4c96741e25e0fde4aff0fa1dc6c54596d6a91183c8ad4a75eaa62848153a
data/.rubocop.yml CHANGED
@@ -4,14 +4,17 @@ AllCops:
4
4
  DisplayCopNames: true
5
5
  NewCops: enable
6
6
  Exclude:
7
- - deepl-rb.gemspec
8
- - vendor/**/*
7
+ - deepl-rb.gemspec
8
+ - vendor/**/*
9
9
 
10
10
  Metrics/BlockLength:
11
11
  Exclude:
12
- - "**/*_spec.rb"
12
+ - "**/*_spec.rb"
13
13
 
14
- Metrics/LineLength:
14
+ Metrics/ParameterLists:
15
+ Max: 6
16
+
17
+ Layout/LineLength:
15
18
  Max: 100
16
19
 
17
20
  Style/Documentation:
data/README.md CHANGED
@@ -133,6 +133,100 @@ The following parameters will be automatically converted:
133
133
  | `formality` | No conversion applied
134
134
  | `glossary_id` | No conversion applied
135
135
 
136
+ ### Glossaries
137
+
138
+ To create a glossary, use the `glossaries.create` method. The glossary `entries` argument should be an array of text pairs. Each pair includes the source and the target translations.
139
+
140
+ ```rb
141
+ entries = [
142
+ ['Hello World', 'Hola Tierra'],
143
+ ['car', 'auto']
144
+ ]
145
+ glossary = DeepL.glossaries.create 'Mi Glosario', 'EN', 'ES', entries
146
+
147
+ puts glossary.class
148
+ # => DeepL::Resources::Glossary
149
+ puts glossary.id
150
+ # => 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
151
+ puts glossary.entry_count
152
+ # => 2
153
+ ```
154
+
155
+ Created glossaries can be used in the `translate` method by specifying the `glossary_id` option:
156
+
157
+ ```rb
158
+ translation = DeepL.translate 'Hello World', 'EN', 'ES', glossary_id: 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
159
+
160
+ puts translation.class
161
+ # => DeepL::Resources::Text
162
+ puts translation.text
163
+ # => 'Hola Tierra'
164
+
165
+ translation = DeepL.translate "I wish we had a car.", 'EN', 'ES', glossary_id: 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
166
+
167
+ puts translation.class
168
+ # => DeepL::Resources::Text
169
+ puts translation.text
170
+ # => Ojalá tuviéramos un auto.
171
+ ```
172
+
173
+ To list all the glossaries available, use the `glossaries.list` method:
174
+
175
+ ```rb
176
+ glossaries = DeepL.glossaries.list
177
+
178
+ puts glossaries.class
179
+ # => Array
180
+ puts glossaries.first.class
181
+ # => DeepL::Resources::Glossary
182
+ ```
183
+
184
+ To find an existing glossary, use the `glossaries.find` method:
185
+
186
+ ```rb
187
+ glossary = DeepL.glossaries.find 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
188
+
189
+ puts glossary.class
190
+ # => DeepL::Resources::Glossary
191
+ ```
192
+
193
+ The glossary resource does not include the glossary entries. To list the glossary entries, use the `glossaries.entries` method:
194
+
195
+ ```rb
196
+ entries = DeepL.glossaries.entries 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
197
+
198
+ puts entries.class
199
+ # => Array
200
+ puts entries.size
201
+ # => 2
202
+ pp entries.first
203
+ # => ["Hello World", "Hola Tierra"]
204
+ ```
205
+
206
+ To delete an existing glossary, use the `glossaries.destroy` method:
207
+
208
+ ```rb
209
+ glossary_id = DeepL.glossaries.destroy 'aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e'
210
+
211
+ puts glossary_id
212
+ # => aa48c7f0-0d02-413e-8a06-d5bbf0ca7a6e
213
+ ```
214
+
215
+ You can list all the language pairs supported by glossaries using the `glossaries.language_pairs` method:
216
+
217
+ ```rb
218
+ language_pairs = DeepL.glossaries.language_pairs
219
+
220
+ puts language_pairs.class
221
+ # => Array
222
+ puts language_pairs.first.class
223
+ # => DeepL::Resources::LanguagePair
224
+ puts language_pairs.first.source_lang
225
+ # => en
226
+ puts language_pairs.first.target_lang
227
+ # => de
228
+ ```
229
+
136
230
  ### Monitor usage
137
231
 
138
232
  To check current API usage, use:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.5.0
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.4.0 ruby lib
5
+ # stub: deepl-rb 2.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "deepl-rb".freeze
9
- s.version = "2.4.0"
9
+ s.version = "2.5.0"
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 = "2022-01-24"
14
+ s.date = "2022-06-06"
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 = [
@@ -34,29 +34,49 @@ Gem::Specification.new do |s|
34
34
  "lib/deepl/exceptions/bad_request.rb",
35
35
  "lib/deepl/exceptions/error.rb",
36
36
  "lib/deepl/exceptions/limit_exceeded.rb",
37
+ "lib/deepl/exceptions/not_found.rb",
37
38
  "lib/deepl/exceptions/not_supported.rb",
38
39
  "lib/deepl/exceptions/quota_exceeded.rb",
39
40
  "lib/deepl/exceptions/request_error.rb",
41
+ "lib/deepl/glossary_api.rb",
40
42
  "lib/deepl/requests/base.rb",
43
+ "lib/deepl/requests/glossary/create.rb",
44
+ "lib/deepl/requests/glossary/destroy.rb",
45
+ "lib/deepl/requests/glossary/entries.rb",
46
+ "lib/deepl/requests/glossary/find.rb",
47
+ "lib/deepl/requests/glossary/language_pairs.rb",
48
+ "lib/deepl/requests/glossary/list.rb",
41
49
  "lib/deepl/requests/languages.rb",
42
50
  "lib/deepl/requests/translate.rb",
43
51
  "lib/deepl/requests/usage.rb",
44
52
  "lib/deepl/resources/base.rb",
53
+ "lib/deepl/resources/glossary.rb",
45
54
  "lib/deepl/resources/language.rb",
55
+ "lib/deepl/resources/language_pair.rb",
46
56
  "lib/deepl/resources/text.rb",
47
57
  "lib/deepl/resources/usage.rb",
48
58
  "spec/api/api_spec.rb",
49
59
  "spec/api/configuration_spec.rb",
50
60
  "spec/api/deepl_spec.rb",
61
+ "spec/fixtures/vcr_cassettes/deepl_glossaries.yml",
51
62
  "spec/fixtures/vcr_cassettes/deepl_languages.yml",
52
63
  "spec/fixtures/vcr_cassettes/deepl_translate.yml",
53
64
  "spec/fixtures/vcr_cassettes/deepl_usage.yml",
65
+ "spec/fixtures/vcr_cassettes/glossaries.yml",
54
66
  "spec/fixtures/vcr_cassettes/languages.yml",
55
67
  "spec/fixtures/vcr_cassettes/translate_texts.yml",
56
68
  "spec/fixtures/vcr_cassettes/usage.yml",
69
+ "spec/requests/glossary/create_spec.rb",
70
+ "spec/requests/glossary/destroy_spec.rb",
71
+ "spec/requests/glossary/entries_spec.rb",
72
+ "spec/requests/glossary/find_spec.rb",
73
+ "spec/requests/glossary/language_pairs_spec.rb",
74
+ "spec/requests/glossary/list_spec.rb",
57
75
  "spec/requests/languages_spec.rb",
58
76
  "spec/requests/translate_spec.rb",
59
77
  "spec/requests/usage_spec.rb",
78
+ "spec/resources/glossary_spec.rb",
79
+ "spec/resources/language_pair_spec.rb",
60
80
  "spec/resources/language_spec.rb",
61
81
  "spec/resources/text_spec.rb",
62
82
  "spec/resources/usage_spec.rb",
@@ -64,7 +84,7 @@ Gem::Specification.new do |s|
64
84
  ]
65
85
  s.homepage = "http://github.com/wikiti/deepl-rb".freeze
66
86
  s.licenses = ["MIT".freeze]
67
- s.rubygems_version = "3.1.2".freeze
87
+ s.rubygems_version = "3.3.7".freeze
68
88
  s.summary = "A simple ruby wrapper for the DeepL API".freeze
69
89
 
70
90
  if s.respond_to? :specification_version then
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Exceptions
5
+ class NotFound < RequestError
6
+ def message
7
+ JSON.parse(response.body)['message']
8
+ rescue JSON::ParserError
9
+ response.body
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ class GlossaryApi
5
+ def initialize(api, options = {})
6
+ @api = api
7
+ @options = options
8
+ end
9
+
10
+ def create(name, source_lang, target_lang, entries, options = {})
11
+ DeepL::Requests::Glossary::Create.new(@api, name, source_lang, target_lang, entries, options)
12
+ .request
13
+ end
14
+
15
+ def destroy(glossary_id, options = {})
16
+ DeepL::Requests::Glossary::Destroy.new(@api, glossary_id, options).request
17
+ end
18
+
19
+ def entries(glossary_id, options = {})
20
+ DeepL::Requests::Glossary::Entries.new(@api, glossary_id, options).request
21
+ end
22
+
23
+ def find(glossary_id, options = {})
24
+ DeepL::Requests::Glossary::Find.new(@api, glossary_id, options).request
25
+ end
26
+
27
+ def language_pairs(options = {})
28
+ DeepL::Requests::Glossary::LanguagePairs.new(@api, options).request
29
+ end
30
+
31
+ def list(options = {})
32
+ DeepL::Requests::Glossary::List.new(@api, options).request
33
+ end
34
+ end
35
+ end
@@ -24,6 +24,10 @@ module DeepL
24
24
  options[name.to_s] || options[name.to_sym]
25
25
  end
26
26
 
27
+ def delete_option(name)
28
+ options.delete(name.to_s) || options.delete(name.to_sym)
29
+ end
30
+
27
31
  def set_option(name, value)
28
32
  if options.key?(name.to_sym)
29
33
  options[name.to_sym] = value
@@ -33,7 +37,7 @@ module DeepL
33
37
  end
34
38
 
35
39
  def post(payload)
36
- request = Net::HTTP::Post.new(uri.request_uri)
40
+ request = Net::HTTP::Post.new(uri.request_uri, headers)
37
41
  request.set_form_data(payload.compact)
38
42
  response = http.request(request)
39
43
 
@@ -42,7 +46,15 @@ module DeepL
42
46
  end
43
47
 
44
48
  def get
45
- request = Net::HTTP::Get.new(uri.request_uri)
49
+ request = Net::HTTP::Get.new(uri.request_uri, headers)
50
+ response = http.request(request)
51
+
52
+ validate_response!(request, response)
53
+ [request, response]
54
+ end
55
+
56
+ def delete
57
+ request = Net::HTTP::Delete.new(uri.request_uri, headers)
46
58
  response = http.request(request)
47
59
 
48
60
  validate_response!(request, response)
@@ -62,7 +74,8 @@ module DeepL
62
74
 
63
75
  case response.code
64
76
  when '400' then raise Exceptions::BadRequest.new(request, response)
65
- when '403' then raise Exceptions::AuthorizationFailed.new(request, response)
77
+ when '401', '403' then raise Exceptions::AuthorizationFailed.new(request, response)
78
+ when '404' then raise Exceptions::NotFound.new(request, response)
66
79
  when '429' then raise Exceptions::LimitExceeded.new(request, response)
67
80
  when '456' then raise Exceptions::QuotaExceeded.new(request, response)
68
81
  else raise Exceptions::RequestError.new(request, response)
@@ -91,7 +104,11 @@ module DeepL
91
104
  end
92
105
 
93
106
  def query_params
94
- { auth_key: api.configuration.auth_key }.merge(options)
107
+ options
108
+ end
109
+
110
+ def headers
111
+ { 'Authorization' => "DeepL-Auth-Key #{api.configuration.auth_key}" }
95
112
  end
96
113
  end
97
114
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class Create < Base
7
+ attr_reader :name, :source_lang, :target_lang, :entries, :entries_format
8
+
9
+ def initialize(api, name, source_lang, target_lang, entries, options = {})
10
+ super(api, options)
11
+ @name = name
12
+ @source_lang = source_lang
13
+ @target_lang = target_lang
14
+ @entries = entries
15
+ @entries_format = delete_option(:entries_format) || 'tsv'
16
+ end
17
+
18
+ def request
19
+ payload = {
20
+ name: name, source_lang: source_lang, target_lang: target_lang, entries: entries_to_tsv,
21
+ entries_format: entries_format
22
+ }
23
+ build_glossary(*post(payload))
24
+ end
25
+
26
+ private
27
+
28
+ def entries_to_tsv
29
+ return entries if entries.is_a?(String)
30
+
31
+ entries.reduce('') { |tsv, entry| "#{tsv}#{entry.first}\t#{entry.last}\n" }
32
+ end
33
+
34
+ def build_glossary(request, response)
35
+ glossary = JSON.parse(response.body)
36
+ Resources::Glossary.new(glossary, request, response)
37
+ end
38
+
39
+ def path
40
+ 'glossaries'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class Destroy < Base
7
+ attr_reader :id
8
+
9
+ def initialize(api, id, options = {})
10
+ super(api, options)
11
+ @id = id
12
+ end
13
+
14
+ def request
15
+ build_response(*delete)
16
+ end
17
+
18
+ private
19
+
20
+ def build_response(_, _)
21
+ id
22
+ end
23
+
24
+ def path
25
+ "glossaries/#{id}"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class Entries < Base
7
+ attr_reader :id
8
+
9
+ def initialize(api, id, options = {})
10
+ super(api, options)
11
+ @id = id
12
+ end
13
+
14
+ def request
15
+ build_entries(*get)
16
+ end
17
+
18
+ private
19
+
20
+ def build_entries(_, response)
21
+ response.body.split("\n").map { |entry| entry.split("\t") }
22
+ end
23
+
24
+ def path
25
+ "glossaries/#{id}/entries"
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class Find < Base
7
+ attr_reader :id
8
+
9
+ def initialize(api, id, options = {})
10
+ super(api, options)
11
+ @id = id
12
+ end
13
+
14
+ def request
15
+ build_glossary(*get)
16
+ end
17
+
18
+ private
19
+
20
+ def build_glossary(request, response)
21
+ glossary = JSON.parse(response.body)
22
+ Resources::Glossary.new(glossary, request, response)
23
+ end
24
+
25
+ def path
26
+ "glossaries/#{id}"
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class LanguagePairs < Base
7
+ def initialize(api, options = {})
8
+ super(api, options)
9
+ end
10
+
11
+ def request
12
+ build_language_pair_list(*get)
13
+ end
14
+
15
+ private
16
+
17
+ def build_language_pair_list(request, response)
18
+ data = JSON.parse(response.body)
19
+ data['supported_languages'].map do |language_pair|
20
+ Resources::LanguagePair.new(language_pair['source_lang'], language_pair['target_lang'],
21
+ request, response)
22
+ end
23
+ end
24
+
25
+ def path
26
+ 'glossary-language-pairs'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Requests
5
+ module Glossary
6
+ class List < Base
7
+ def initialize(api, options = {})
8
+ super(api, options)
9
+ end
10
+
11
+ def request
12
+ build_glossary_list(*get)
13
+ end
14
+
15
+ private
16
+
17
+ def build_glossary_list(request, response)
18
+ data = JSON.parse(response.body)
19
+ data['glossaries'].map do |glossary|
20
+ Resources::Glossary.new(glossary, request, response)
21
+ end
22
+ end
23
+
24
+ def path
25
+ 'glossaries'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Resources
5
+ class Glossary < Base
6
+ attr_reader :id, :name, :ready, :source_lang, :target_lang, :creation_time, :entry_count
7
+
8
+ def initialize(glossary, *args)
9
+ super(*args)
10
+
11
+ @id = glossary['glossary_id']
12
+ @name = glossary['name']
13
+ @ready = glossary['ready']
14
+ @source_lang = glossary['source_lang']
15
+ @target_lang = glossary['target_lang']
16
+ @creation_time = glossary['creation_time']
17
+ @entry_count = glossary['entry_count']
18
+ end
19
+
20
+ def to_s
21
+ "#{id} - #{name}"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DeepL
4
+ module Resources
5
+ class LanguagePair < Base
6
+ attr_reader :source_lang, :target_lang
7
+
8
+ def initialize(source_lang, target_lang, *args)
9
+ super(*args)
10
+
11
+ @source_lang = source_lang
12
+ @target_lang = target_lang
13
+ end
14
+
15
+ def to_s
16
+ "#{source_lang} - #{target_lang}"
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/deepl.rb CHANGED
@@ -11,23 +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'
14
15
  require 'deepl/exceptions/not_supported'
15
16
 
16
17
  # -- Requests
17
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'
18
25
  require 'deepl/requests/languages'
19
26
  require 'deepl/requests/translate'
20
27
  require 'deepl/requests/usage'
21
28
 
22
29
  # -- Responses and resources
23
30
  require 'deepl/resources/base'
31
+ require 'deepl/resources/glossary'
24
32
  require 'deepl/resources/language'
33
+ require 'deepl/resources/language_pair'
25
34
  require 'deepl/resources/text'
26
35
  require 'deepl/resources/usage'
27
36
 
28
37
  # -- Other wrappers
29
38
  require 'deepl/api'
30
39
  require 'deepl/configuration'
40
+ require 'deepl/glossary_api'
31
41
 
32
42
  # -- Gem interface
33
43
  module DeepL
@@ -48,6 +58,11 @@ module DeepL
48
58
  Requests::Translate.new(api, text, source_lang, target_lang, options).request
49
59
  end
50
60
 
61
+ def glossaries(options = {})
62
+ configure if @configuration.nil?
63
+ GlossaryApi.new(api, options)
64
+ end
65
+
51
66
  def usage(options = {})
52
67
  configure if @configuration.nil?
53
68
  Requests::Usage.new(api, options).request