oxford_dictionary 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/README.md +52 -48
- data/lib/oxford_dictionary/endpoints/wordlist_endpoint.rb +3 -0
- data/lib/oxford_dictionary/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ffecd6360a45c8bdfad1a77ff7e73784e785690c05c87d6d6bb58456c764d716
|
4
|
+
data.tar.gz: 4f5ad09e2c4b424d1bb49eae62a5e37b5c3ee2faf2de7cec72c2bbcab2ea3e83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b3d5945ce79c7e0d36ac8d981b73813c12245870146d68132e0da67ee98a5149994ac8262c48da1951fba09febd39b639e1f603517f3b12e67851601ee92178
|
7
|
+
data.tar.gz: 28dbe3edc24b6ec9ede400141a01029e21bdfde2aeadedafc0fedc66dbbdc1051e79c833673dab32c5cf11bc105a770c0e457d750bf4106953f6ae7cc3dc3f0f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## OxfordDictionary master (unreleased)
|
2
2
|
|
3
|
+
## OxfordDictionary 1.0.1 (2019-05-07)
|
4
|
+
|
5
|
+
- Deprecate the Wordlist endpoint
|
6
|
+
[\#5](https://github.com/swcraig/oxford-dictionary/pull/5)
|
7
|
+
|
3
8
|
## OxfordDictionary 1.0.0 (2017-09-19)
|
4
9
|
|
5
10
|
- Remove httparty as a runtime dependency
|
data/README.md
CHANGED
@@ -14,10 +14,10 @@ Ruby wrapper to consume the [Oxford Dictionary API](https://developer.oxforddict
|
|
14
14
|
require 'oxford_dictionary'
|
15
15
|
|
16
16
|
After registering for an API key, setup the client:
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
```ruby
|
18
|
+
client = OxfordDictionary::Client.new(app_id: 'ID', app_key: 'SECRET')
|
19
|
+
client = OxfordDictionary.new(app_id: 'ID', app_key: 'SECRET')
|
20
|
+
```
|
21
21
|
### Usage Examples
|
22
22
|
Some documentation on the different endpoint function calls can be found [here](http://rubydoc.info/gems/oxford_dictionary/OxfordDictionary/Endpoints)
|
23
23
|
|
@@ -25,67 +25,71 @@ This wrapper follows the schema laid out by the API quite closely. The data
|
|
25
25
|
schema for the different API calls can be found [here](https://developer.oxforddictionaries.com/documentation).
|
26
26
|
|
27
27
|
###### Get the results for an entry
|
28
|
+
```ruby
|
29
|
+
entry = client.entry('vapid')
|
28
30
|
|
29
|
-
|
31
|
+
# Access the first entry
|
32
|
+
# Refer to the API documentation for the schema of the returned data structure
|
33
|
+
first_lexical_entry = entry.lexical_entries[0]
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
# With some filters
|
36
|
+
filters = { lexicalCategory: 'Verb', domains: 'Art'}
|
37
|
+
client.entry('truth', filters)
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
client.entry('truth', filters)
|
39
|
+
# Or do them "inline"
|
40
|
+
client.entry('truth', lexicalCategory: 'Verb', domains: 'Art')
|
38
41
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# From a dictionary of a specific language (default is 'en')
|
43
|
-
client.entry('ace', lang: 'es')
|
42
|
+
# From a dictionary of a specific language (default is 'en')
|
43
|
+
client.entry('ace', lang: 'es')
|
44
|
+
```
|
44
45
|
|
45
46
|
###### Or return some subset of information
|
47
|
+
```ruby
|
48
|
+
# Like just the examples
|
49
|
+
examples = client.entry_examples('explain')
|
46
50
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
# Or only the pronunciations...
|
51
|
-
the_noises = client.entry_pronunciations('knight')
|
51
|
+
# Or only the pronunciations...
|
52
|
+
the_noises = client.entry_pronunciations('knight')
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
# Or the translations (for Swahili in this example)
|
55
|
+
en_to_es = client.entry_translations('change', translations: 'sw')
|
56
|
+
# If no :translations filter is supplied, default is 'es'
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
58
|
+
# Or some of the other documented API calls
|
59
|
+
client.entry_sentences('scholar')
|
60
|
+
client.entry_definitions('correct')
|
61
|
+
client.entry_antonyms_synonyms('monotonous')
|
62
|
+
# Etc...
|
62
63
|
|
63
|
-
|
64
|
+
# Generally the method names follow the documented API closely
|
65
|
+
```
|
64
66
|
|
65
67
|
###### Other endpoint calls
|
68
|
+
```ruby
|
69
|
+
# Inflections of a word
|
70
|
+
inflections = client.inflection('changed')
|
66
71
|
|
67
|
-
|
68
|
-
|
72
|
+
# Wordlist results (based on categorys, filters, etc...)
|
73
|
+
related = client.wordlist(lexicalCategory: 'Noun', word_length: '>5,<10')
|
69
74
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# Or the search endpoint
|
74
|
-
search_results = client.search('condition', prefix: true)
|
75
|
+
# Or the search endpoint
|
76
|
+
search_results = client.search('condition', prefix: true)
|
77
|
+
```
|
75
78
|
|
76
79
|
###### A quick note on how to add filters to queries
|
77
80
|
There isn't much argument checking at the moment. Some endpoints do not accept filter arguments, refer to the API documentation to check for endpoints that accept filters.
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
```ruby
|
82
|
+
# All endpoints accept the :lang filter. This specifies which dictionary to use
|
83
|
+
# If no argument is supplied, default is 'en'
|
84
|
+
filters = { lang: 'es' }
|
85
|
+
|
86
|
+
# To use multiple values on a single filter, make it an array
|
87
|
+
filters = { lexicalCategory: ['Noun', 'Verb'] }
|
88
|
+
|
89
|
+
# The wordlist endpoint specifically may include "nested" filters
|
90
|
+
# These filters (exclude, exclude_senses, etc...) require arrays
|
91
|
+
filters = { exclude: [domains: %w(sport art)] }
|
92
|
+
```
|
89
93
|
|
90
94
|
Argument names need to be in camelCase, not snake_case. However, the objects returned from API calls use snake_case attributes.
|
91
95
|
|
@@ -6,6 +6,8 @@ module OxfordDictionary
|
|
6
6
|
# Interface to '/wordlist' endpoint
|
7
7
|
module WordlistEndpoint
|
8
8
|
include OxfordDictionary::Request
|
9
|
+
extend Gem::Deprecate
|
10
|
+
|
9
11
|
ENDPOINT = 'wordlist'.freeze
|
10
12
|
ADVANCED_FILTERS = [:exact, :exclude, :exclude_senses,
|
11
13
|
:exclude_prime_senses, :limit, :offset,
|
@@ -18,6 +20,7 @@ module OxfordDictionary
|
|
18
20
|
end
|
19
21
|
ListResponse.new(request(ENDPOINT, nil, params))
|
20
22
|
end
|
23
|
+
deprecate :wordlist, :none, 2019, 6
|
21
24
|
|
22
25
|
private
|
23
26
|
|
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.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- swcraig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.7.4
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: A wrapper for the Oxford Dictionary API
|