oxford_dictionary 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -4
- data/lib/oxford_dictionary/client.rb +2 -0
- data/lib/oxford_dictionary/endpoints/endpoint.rb +6 -0
- data/lib/oxford_dictionary/endpoints/entries.rb +4 -12
- data/lib/oxford_dictionary/endpoints/lemmas.rb +2 -6
- data/lib/oxford_dictionary/endpoints/search.rb +4 -13
- data/lib/oxford_dictionary/endpoints/sentences.rb +2 -6
- data/lib/oxford_dictionary/endpoints/thesaurus.rb +2 -6
- data/lib/oxford_dictionary/endpoints/translations.rb +2 -7
- data/lib/oxford_dictionary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b30f885cc09faf1783a64f1b666103936d066373b0a8f2382750d1710fbe2a4
|
4
|
+
data.tar.gz: 9e7bb4ee4e9d066c30dcf062085159218b0540db781130ca400227bd65157725
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30b60f3fceb455902872b749b61a7c9676d6962343051234d30d08414f43f98440a10d9c6a75029676d09bc5b7f8984874fb13573d94b0992ba2dc16c13a8302
|
7
|
+
data.tar.gz: 7a69d03c0cab8929e9e30191d4662123823d8dd1d63be2e2a80bdb74f7aa30f5075fbbba16c9e14b41874ff05e00b82960092f41486072ed77b489ef2d44b40a
|
data/CHANGELOG.md
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
## OxfordDictionary 1.3.0 (2019-06-22)
|
4
4
|
|
5
5
|
- Add V2 translations support
|
6
|
-
[\#
|
6
|
+
[\#12](https://github.com/swcraig/oxford-dictionary/pull/12)
|
7
7
|
- Add V2 sentences support
|
8
|
-
[\#
|
8
|
+
[\#13](https://github.com/swcraig/oxford-dictionary/pull/13)
|
9
9
|
- Add V2 thesaurus support
|
10
|
-
[\#
|
10
|
+
[\#14](https://github.com/swcraig/oxford-dictionary/pull/14)
|
11
11
|
- Add V2 search support
|
12
|
-
[\#
|
12
|
+
[\#15](https://github.com/swcraig/oxford-dictionary/pull/15)
|
13
13
|
|
14
14
|
## OxfordDictionary 1.2.0 (2019-06-22)
|
15
15
|
|
@@ -10,6 +10,8 @@ require 'oxford_dictionary/endpoints/sentences'
|
|
10
10
|
require 'oxford_dictionary/endpoints/thesaurus'
|
11
11
|
require 'oxford_dictionary/endpoints/search'
|
12
12
|
|
13
|
+
require 'oxford_dictionary/request'
|
14
|
+
|
13
15
|
module OxfordDictionary
|
14
16
|
# The client object to interact with
|
15
17
|
class Client
|
@@ -12,6 +12,12 @@ module OxfordDictionary
|
|
12
12
|
def deserialize
|
13
13
|
@deserialize ||= OxfordDictionary::Deserialize.new
|
14
14
|
end
|
15
|
+
|
16
|
+
def request_uri(path:, params:)
|
17
|
+
URI(path).tap do |uri|
|
18
|
+
uri.query = URI.encode_www_form(params) unless params.empty?
|
19
|
+
end
|
20
|
+
end
|
15
21
|
end
|
16
22
|
end
|
17
23
|
end
|
@@ -7,24 +7,16 @@ module OxfordDictionary
|
|
7
7
|
ENDPOINT = 'entries'.freeze
|
8
8
|
|
9
9
|
def entry(word:, dataset:, params: {})
|
10
|
-
|
11
|
-
uri =
|
12
|
-
|
13
|
-
unless params.empty?
|
14
|
-
uri.query = URI.encode_www_form(params)
|
15
|
-
end
|
10
|
+
path = "#{ENDPOINT}/#{dataset}/#{word}"
|
11
|
+
uri = request_uri(path: path, params: params)
|
16
12
|
|
17
13
|
response = @request_client.get(uri: uri)
|
18
14
|
deserialize.call(response.body)
|
19
15
|
end
|
20
16
|
|
21
17
|
def entry_snake_case(word:, dataset:, params: {})
|
22
|
-
|
23
|
-
uri =
|
24
|
-
|
25
|
-
unless params.empty?
|
26
|
-
uri.query = URI.encode_www_form(params)
|
27
|
-
end
|
18
|
+
path = "#{ENDPOINT}/#{dataset}/#{word}"
|
19
|
+
uri = request_uri(path: path, params: params)
|
28
20
|
|
29
21
|
response = @request_client.get(uri: uri)
|
30
22
|
snake_keys = JSON.parse(response.body).to_snake_keys
|
@@ -6,12 +6,8 @@ module OxfordDictionary
|
|
6
6
|
ENDPOINT = 'lemmas'.freeze
|
7
7
|
|
8
8
|
def lemma(word:, language:, params: {})
|
9
|
-
|
10
|
-
uri =
|
11
|
-
|
12
|
-
unless params.empty?
|
13
|
-
uri.query = URI.encode_www_form(params)
|
14
|
-
end
|
9
|
+
path = "#{ENDPOINT}/#{language}/#{word}"
|
10
|
+
uri = request_uri(path: path, params: params)
|
15
11
|
|
16
12
|
response = @request_client.get(uri: uri)
|
17
13
|
deserialize.call(response.body)
|
@@ -6,25 +6,16 @@ module OxfordDictionary
|
|
6
6
|
ENDPOINT = 'search'.freeze
|
7
7
|
|
8
8
|
def search(language:, params: {})
|
9
|
-
|
10
|
-
uri =
|
11
|
-
|
12
|
-
unless params.empty?
|
13
|
-
uri.query = URI.encode_www_form(params)
|
14
|
-
end
|
9
|
+
path = "#{ENDPOINT}/#{language}"
|
10
|
+
uri = request_uri(path: path, params: params)
|
15
11
|
|
16
12
|
response = @request_client.get(uri: uri)
|
17
13
|
deserialize.call(response.body)
|
18
14
|
end
|
19
15
|
|
20
16
|
def search_translation(source_language:, target_language:, params: {})
|
21
|
-
|
22
|
-
|
23
|
-
uri = URI(query_string)
|
24
|
-
|
25
|
-
unless params.empty?
|
26
|
-
uri.query = URI.encode_www_form(params)
|
27
|
-
end
|
17
|
+
path = "#{ENDPOINT}/translations/#{source_language}/#{target_language}"
|
18
|
+
uri = request_uri(path: path, params: params)
|
28
19
|
|
29
20
|
response = @request_client.get(uri: uri)
|
30
21
|
deserialize.call(response.body)
|
@@ -6,12 +6,8 @@ module OxfordDictionary
|
|
6
6
|
ENDPOINT = 'sentences'.freeze
|
7
7
|
|
8
8
|
def sentence(word:, language:, params: {})
|
9
|
-
|
10
|
-
uri =
|
11
|
-
|
12
|
-
unless params.empty?
|
13
|
-
uri.query = URI.encode_www_form(params)
|
14
|
-
end
|
9
|
+
path = "#{ENDPOINT}/#{language}/#{word}"
|
10
|
+
uri = request_uri(path: path, params: params)
|
15
11
|
|
16
12
|
response = @request_client.get(uri: uri)
|
17
13
|
deserialize.call(response.body)
|
@@ -6,12 +6,8 @@ module OxfordDictionary
|
|
6
6
|
ENDPOINT = 'thesaurus'.freeze
|
7
7
|
|
8
8
|
def thesaurus(word:, language:, params: {})
|
9
|
-
|
10
|
-
uri =
|
11
|
-
|
12
|
-
unless params.empty?
|
13
|
-
uri.query = URI.encode_www_form(params)
|
14
|
-
end
|
9
|
+
path = "#{ENDPOINT}/#{language}/#{word}"
|
10
|
+
uri = request_uri(path: path, params: params)
|
15
11
|
|
16
12
|
response = @request_client.get(uri: uri)
|
17
13
|
deserialize.call(response.body)
|
@@ -6,13 +6,8 @@ module OxfordDictionary
|
|
6
6
|
ENDPOINT = 'translations'.freeze
|
7
7
|
|
8
8
|
def translation(word:, source_language:, target_language:, params: {})
|
9
|
-
|
10
|
-
|
11
|
-
uri = URI(query_string)
|
12
|
-
|
13
|
-
unless params.empty?
|
14
|
-
uri.query = URI.encode_www_form(params)
|
15
|
-
end
|
9
|
+
path = "#{ENDPOINT}/#{source_language}/#{target_language}/#{word}"
|
10
|
+
uri = request_uri(path: path, params: params)
|
16
11
|
|
17
12
|
response = @request_client.get(uri: uri)
|
18
13
|
deserialize.call(response.body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oxford_dictionary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- swcraig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|