oxford_dictionary 1.3.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +37 -49
  4. data/fixtures/vcr_cassettes/v1_entry.yml +526 -0
  5. data/fixtures/vcr_cassettes/v1_entry_antonym_synonym.yml +42 -0
  6. data/fixtures/vcr_cassettes/v1_entry_antonyms.yml +42 -0
  7. data/fixtures/vcr_cassettes/v1_entry_definitions.yml +228 -0
  8. data/fixtures/vcr_cassettes/v1_entry_error.yml +49 -0
  9. data/fixtures/vcr_cassettes/v1_entry_es.yml +108 -0
  10. data/fixtures/vcr_cassettes/v1_entry_examples.yml +242 -0
  11. data/fixtures/vcr_cassettes/v1_entry_past_nouns.yml +49 -0
  12. data/fixtures/vcr_cassettes/v1_entry_pronunciations.yml +156 -0
  13. data/fixtures/vcr_cassettes/v1_entry_synonyms.yml +42 -0
  14. data/fixtures/vcr_cassettes/v1_entry_us.yml +526 -0
  15. data/fixtures/vcr_cassettes/v1_inflection.yml +74 -0
  16. data/fixtures/vcr_cassettes/v1_inflection_filters.yml +52 -0
  17. data/fixtures/vcr_cassettes/v1_search.yml +42 -0
  18. data/fixtures/vcr_cassettes/v1_search_prefix.yml +42 -0
  19. data/fixtures/vcr_cassettes/v1_search_translation.yml +42 -0
  20. data/lib/oxford_dictionary/client.rb +211 -18
  21. data/lib/oxford_dictionary/version.rb +1 -1
  22. metadata +19 -16
  23. data/lib/oxford_dictionary/api_objects/entry.rb +0 -11
  24. data/lib/oxford_dictionary/api_objects/entry_response.rb +0 -12
  25. data/lib/oxford_dictionary/api_objects/lexical_entry.rb +0 -16
  26. data/lib/oxford_dictionary/api_objects/list_response.rb +0 -7
  27. data/lib/oxford_dictionary/api_objects/pronunciation.rb +0 -10
  28. data/lib/oxford_dictionary/api_objects/sense.rb +0 -19
  29. data/lib/oxford_dictionary/deprecated_request.rb +0 -127
  30. data/lib/oxford_dictionary/endpoints/entry_endpoint.rb +0 -131
  31. data/lib/oxford_dictionary/endpoints/inflection_endpoint.rb +0 -23
  32. data/lib/oxford_dictionary/endpoints/search_endpoint.rb +0 -26
  33. data/lib/oxford_dictionary/endpoints/wordlist_endpoint.rb +0 -35
  34. data/lib/oxford_dictionary/error.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b30f885cc09faf1783a64f1b666103936d066373b0a8f2382750d1710fbe2a4
4
- data.tar.gz: 9e7bb4ee4e9d066c30dcf062085159218b0540db781130ca400227bd65157725
3
+ metadata.gz: 76a707cc6713b8162a27f4ccbd2dd5f705a2488298fc6a4f47f64c1cdf58249f
4
+ data.tar.gz: c1ccb8317f36dfd52dcf0dcf84600c8cf698030f94e1a67edca17ae7b0a7623d
5
5
  SHA512:
6
- metadata.gz: 30b60f3fceb455902872b749b61a7c9676d6962343051234d30d08414f43f98440a10d9c6a75029676d09bc5b7f8984874fb13573d94b0992ba2dc16c13a8302
7
- data.tar.gz: 7a69d03c0cab8929e9e30191d4662123823d8dd1d63be2e2a80bdb74f7aa30f5075fbbba16c9e14b41874ff05e00b82960092f41486072ed77b489ef2d44b40a
6
+ metadata.gz: 8adefff2b029d5e3bc780c12f457848ef97000a34bf04fec3a9211b330fb55ed0477283c34c2f919a570d6425d58928c72d923ff7968595a3871c7e535831af0
7
+ data.tar.gz: 7fced4aff346f014ade560cb5652d157ed289e7f8862da9881dc6aa07308b1b7c57c07db2019bc82274ff6bf81eb763ce66ef4ee97332ced2c8fd4663c678718
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## OxfordDictionary master (unreleased)
2
2
 
3
+ ## OxfordDictionary 2.0.0 (2019-06-29)
4
+ - Remove wordlist endpoint
5
+ [\#20](https://github.com/swcraig/oxford-dictionary/pull/20)
6
+ - Use new V2 interface for V1 inflection usage
7
+ [\#21](https://github.com/swcraig/oxford-dictionary/pull/21)
8
+ - Use new V2 interface for V1 search usage
9
+ [\#22](https://github.com/swcraig/oxford-dictionary/pull/22)
10
+ - Use new V2 interface for V1 entry usage
11
+ [\#23](https://github.com/swcraig/oxford-dictionary/pull/23)
12
+ - Remove all V1 functionality
13
+ [\#24](https://github.com/swcraig/oxford-dictionary/pull/24)
14
+
3
15
  ## OxfordDictionary 1.3.0 (2019-06-22)
4
16
 
5
17
  - Add V2 translations support
data/README.md CHANGED
@@ -19,79 +19,67 @@ client = OxfordDictionary::Client.new(app_id: 'ID', app_key: 'SECRET')
19
19
  client = OxfordDictionary.new(app_id: 'ID', app_key: 'SECRET')
20
20
  ```
21
21
  ### Usage Examples
22
- Some documentation on the different endpoint function calls can be found [here](http://rubydoc.info/gems/oxford_dictionary/OxfordDictionary/Endpoints)
23
-
24
22
  This wrapper follows the schema laid out by the API quite closely. The data
25
23
  schema for the different API calls can be found [here](https://developer.oxforddictionaries.com/documentation).
26
24
 
27
- ###### Get the results for an entry
25
+ ###### Entries
28
26
  ```ruby
29
- entry = client.entry('vapid')
27
+ entry = client.entry(word: 'vapid', dataset: 'en-gb', params: {})
30
28
 
31
29
  # Access the first entry
32
30
  # Refer to the API documentation for the schema of the returned data structure
33
- first_lexical_entry = entry.lexical_entries[0]
31
+ first_lexical_entry = entry.lexicalEntries.first
34
32
 
35
33
  # With some filters
36
34
  filters = { lexicalCategory: 'Verb', domains: 'Art'}
37
- client.entry('truth', filters)
35
+ client.entry(word: 'truth', dataset: 'en-gb', params: filters)
36
+
37
+ # You can also search for the results for different datasets
38
+ # Refer to the Oxford Dictionaries documentation for all the
39
+ # possible datasets
40
+ client.entry(word: 'ace', dataset: 'es', params: {})
38
41
 
39
- # Or do them "inline"
40
- client.entry('truth', lexicalCategory: 'Verb', domains: 'Art')
42
+ # You can query for results from a specific "field"
43
+ # Refer to the Oxford Dictionaries documentation for all the
44
+ # possible fields
45
+ client.entry(word: 'explain', dataset: 'en-gb', params: { fields: 'examples' })
41
46
 
42
- # From a dictionary of a specific language (default is 'en')
43
- client.entry('ace', lang: 'es')
44
47
  ```
45
48
 
46
- ###### Or return some subset of information
49
+ ###### Lemmas
47
50
  ```ruby
48
- # Like just the examples
49
- examples = client.entry_examples('explain')
50
-
51
- # Or only the pronunciations...
52
- the_noises = client.entry_pronunciations('knight')
53
-
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'
57
-
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...
63
-
64
- # Generally the method names follow the documented API closely
51
+ client.lemma(word: 'condition', language: 'en', params: {})
65
52
  ```
66
53
 
67
- ###### Other endpoint calls
54
+ ###### Translations
68
55
  ```ruby
69
- # Inflections of a word
70
- inflections = client.inflection('changed')
71
-
72
- # Wordlist results (based on categorys, filters, etc...)
73
- related = client.wordlist(lexicalCategory: 'Noun', word_length: '>5,<10')
74
-
75
- # Or the search endpoint
76
- search_results = client.search('condition', prefix: true)
56
+ client.translation(
57
+ word: 'condition',
58
+ source_language: 'en',
59
+ target_language: 'es',
60
+ params: {}
61
+ )
77
62
  ```
78
63
 
79
- ###### A quick note on how to add filters to queries
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.
64
+ ###### Sentences
81
65
  ```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'] }
66
+ client.sentence(word: 'paraphrase', language: 'en', params: {})
67
+ ```
88
68
 
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)] }
69
+ ###### Search
70
+ ```ruby
71
+ client.search(language: 'en-gb', params: { q: 'vapid' })
92
72
  ```
93
73
 
94
- Argument names need to be in camelCase, not snake_case. However, the objects returned from API calls use snake_case attributes.
74
+ ###### Thesaurus
75
+ ```ruby
76
+ client.thesaurus(
77
+ word: 'book',
78
+ language: 'en',
79
+ params: { fields: 'synonyms,antonyms}
80
+ )
81
+ # Or use { fields: 'synonyms' } for just synonyms
82
+ ```
95
83
 
96
84
  ## Development
97
85