oxford_dictionary 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7144d5e382464f319db6cf9c719d924a6972cf9318a3b080d0092a88c062835d
4
- data.tar.gz: 14e3d0cea4af11da63adc110d2304dc839727268a3a010c44f291fd78a393e83
3
+ metadata.gz: 181397797e822f74e2ffd2904834d9d057f611f166c3f1b4cc717f79ed899ad3
4
+ data.tar.gz: 14ed048797dafe19066a7fb9ad94ec21d6f776a8512dab20c389bead210da32b
5
5
  SHA512:
6
- metadata.gz: 74ab8edd4acdc8a7dddcb5c1af7a69d72f199a87f9af33d5be5306d655bd6e2312ee7355012ca451b5757cee8d6c77f967d8c1ff3700425cc76c7ae8ac3cc0de
7
- data.tar.gz: 7ddf15813f97f10daa13e0b9e0952efcd2036cc55273854e8cfe6f5f5a2fa97417b587eb982dffd2a4b684ad8fe443fb78cd4ac42a8c6317d1c31a01c92651b2
6
+ metadata.gz: e6d27d507afb9196658b8c07faa4170f1d2ccf3fe3fa5e216095eae04d027a87b04f189d390b898eebf40e6cf793179582d9b66408e691606f4830b92eb1969a
7
+ data.tar.gz: 47cf60f38d246938585962dd2d8aeead434337331cef0fd4c49e1cb40eb4b34b206475973db9503203f71b3ad2836f0a9197929852925172fad12ee73e5ff058
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## OxfordDictionary master (unreleased)
2
2
 
3
+ ## OxfordDictionary 1.2.0 (2019-06-22)
4
+
5
+ - Add V2 lemmas support
6
+ [\#10](https://github.com/swcraig/oxford-dictionary/pull/10)
7
+
3
8
  ## OxfordDictionary 1.1.0 (2019-06-22)
4
9
 
5
10
  - Add V2 entries support
data/Rakefile CHANGED
@@ -3,8 +3,4 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task default: [:spec, :rubocop]
7
-
8
- task :rubocop do
9
- sh 'rubocop'
10
- end
6
+ task default: [:spec]
@@ -0,0 +1,95 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://od-api.oxforddictionaries.com/api/v2/lemmas/es/fuego
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
+ - application/json
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - od-api.oxforddictionaries.com
18
+ App-Id:
19
+ - APP_ID
20
+ App-Key:
21
+ - APP_KEY
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Api-Version:
28
+ - v2
29
+ Code-Version:
30
+ - v2.3.2-g02aa52c
31
+ Content-Type:
32
+ - application/json;charset=utf-8
33
+ Date:
34
+ - Sat, 22 Jun 2019 23:43:20 GMT
35
+ Server:
36
+ - openresty/1.13.6.2
37
+ Content-Length:
38
+ - '1429'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: |-
44
+ {
45
+ "metadata": {
46
+ "provider": "Oxford University Press"
47
+ },
48
+ "results": [
49
+ {
50
+ "id": "fuego",
51
+ "language": "es",
52
+ "lexicalEntries": [
53
+ {
54
+ "grammaticalFeatures": [
55
+ {
56
+ "id": "masculine",
57
+ "text": "Masculine",
58
+ "type": "Gender"
59
+ }
60
+ ],
61
+ "inflectionOf": [
62
+ {
63
+ "id": "fuego",
64
+ "text": "fuego"
65
+ }
66
+ ],
67
+ "language": "es",
68
+ "lexicalCategory": {
69
+ "id": "noun",
70
+ "text": "Noun"
71
+ },
72
+ "text": "fuego"
73
+ },
74
+ {
75
+ "inflectionOf": [
76
+ {
77
+ "id": "fuego",
78
+ "text": "fuego"
79
+ }
80
+ ],
81
+ "language": "es",
82
+ "lexicalCategory": {
83
+ "id": "interjection",
84
+ "text": "Interjection"
85
+ },
86
+ "text": "fuego"
87
+ }
88
+ ],
89
+ "word": "fuego"
90
+ }
91
+ ]
92
+ }
93
+ http_version:
94
+ recorded_at: Sat, 22 Jun 2019 23:43:20 GMT
95
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,81 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://od-api.oxforddictionaries.com/api/v2/lemmas/en/ace?lexicalCategory=verb
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
+ - application/json
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - od-api.oxforddictionaries.com
18
+ App-Id:
19
+ - APP_ID
20
+ App-Key:
21
+ - APP_KEY
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Api-Version:
28
+ - v2
29
+ Code-Version:
30
+ - v2.3.2-g02aa52c
31
+ Content-Type:
32
+ - application/json;charset=utf-8
33
+ Date:
34
+ - Sat, 22 Jun 2019 23:43:19 GMT
35
+ Server:
36
+ - openresty/1.13.6.2
37
+ Content-Length:
38
+ - '964'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: |-
44
+ {
45
+ "metadata": {
46
+ "provider": "Oxford University Press"
47
+ },
48
+ "results": [
49
+ {
50
+ "id": "ace",
51
+ "language": "en",
52
+ "lexicalEntries": [
53
+ {
54
+ "grammaticalFeatures": [
55
+ {
56
+ "id": "transitive",
57
+ "text": "Transitive",
58
+ "type": "Subcategorization"
59
+ }
60
+ ],
61
+ "inflectionOf": [
62
+ {
63
+ "id": "ace",
64
+ "text": "ace"
65
+ }
66
+ ],
67
+ "language": "en",
68
+ "lexicalCategory": {
69
+ "id": "verb",
70
+ "text": "Verb"
71
+ },
72
+ "text": "ace"
73
+ }
74
+ ],
75
+ "word": "ace"
76
+ }
77
+ ]
78
+ }
79
+ http_version:
80
+ recorded_at: Sat, 22 Jun 2019 23:43:19 GMT
81
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,109 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://od-api.oxforddictionaries.com/api/v2/lemmas/en/ace
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
+ - application/json
14
+ User-Agent:
15
+ - Ruby
16
+ Host:
17
+ - od-api.oxforddictionaries.com
18
+ App-Id:
19
+ - APP_ID
20
+ App-Key:
21
+ - APP_KEY
22
+ response:
23
+ status:
24
+ code: 200
25
+ message: OK
26
+ headers:
27
+ Api-Version:
28
+ - v2
29
+ Code-Version:
30
+ - v2.3.2-g02aa52c
31
+ Content-Type:
32
+ - application/json;charset=utf-8
33
+ Date:
34
+ - Sat, 22 Jun 2019 23:42:51 GMT
35
+ Server:
36
+ - openresty/1.13.6.2
37
+ Content-Length:
38
+ - '1866'
39
+ Connection:
40
+ - keep-alive
41
+ body:
42
+ encoding: UTF-8
43
+ string: |-
44
+ {
45
+ "metadata": {
46
+ "provider": "Oxford University Press"
47
+ },
48
+ "results": [
49
+ {
50
+ "id": "ace",
51
+ "language": "en",
52
+ "lexicalEntries": [
53
+ {
54
+ "inflectionOf": [
55
+ {
56
+ "id": "ace",
57
+ "text": "ace"
58
+ }
59
+ ],
60
+ "language": "en",
61
+ "lexicalCategory": {
62
+ "id": "noun",
63
+ "text": "Noun"
64
+ },
65
+ "text": "ace"
66
+ },
67
+ {
68
+ "inflectionOf": [
69
+ {
70
+ "id": "ace",
71
+ "text": "ace"
72
+ }
73
+ ],
74
+ "language": "en",
75
+ "lexicalCategory": {
76
+ "id": "adjective",
77
+ "text": "Adjective"
78
+ },
79
+ "text": "ace"
80
+ },
81
+ {
82
+ "grammaticalFeatures": [
83
+ {
84
+ "id": "transitive",
85
+ "text": "Transitive",
86
+ "type": "Subcategorization"
87
+ }
88
+ ],
89
+ "inflectionOf": [
90
+ {
91
+ "id": "ace",
92
+ "text": "ace"
93
+ }
94
+ ],
95
+ "language": "en",
96
+ "lexicalCategory": {
97
+ "id": "verb",
98
+ "text": "Verb"
99
+ },
100
+ "text": "ace"
101
+ }
102
+ ],
103
+ "word": "ace"
104
+ }
105
+ ]
106
+ }
107
+ http_version:
108
+ recorded_at: Sat, 22 Jun 2019 23:42:51 GMT
109
+ recorded_with: VCR 4.0.0
@@ -3,6 +3,9 @@ require 'oxford_dictionary/endpoints/inflection_endpoint'
3
3
  require 'oxford_dictionary/endpoints/search_endpoint'
4
4
  require 'oxford_dictionary/endpoints/wordlist_endpoint'
5
5
 
6
+ require 'oxford_dictionary/endpoints/entries'
7
+ require 'oxford_dictionary/endpoints/lemmas'
8
+
6
9
  module OxfordDictionary
7
10
  # The client object to interact with
8
11
  class Client
@@ -49,8 +52,17 @@ module OxfordDictionary
49
52
  entry_snake_case(word: word, dataset: dataset, params: params)
50
53
  end
51
54
 
55
+ def lemma(word:, language:, params: {})
56
+ lemma_endpoint.lemma(word: word, language: language, params: params)
57
+ end
58
+
52
59
  private
53
60
 
61
+ def lemma_endpoint
62
+ @lemma_endpoint ||=
63
+ OxfordDictionary::Endpoints::Lemmas.new(request_client: request_client)
64
+ end
65
+
54
66
  def entry_endpoint
55
67
  @entry_endpoint ||=
56
68
  OxfordDictionary::Endpoints::Entries.new(request_client: request_client)
@@ -9,6 +9,13 @@ module OxfordDictionary
9
9
  ENDPOINT = 'inflections'.freeze
10
10
 
11
11
  def inflection(query, params = {})
12
+ warn '''
13
+ Client#inflection is DEPRECATED and will become non-functional
14
+ on June 30, 2019. Use Client#lemma instead. Reference
15
+ github.com/swcraig/oxford-dictionary/pull/10 for for more information.
16
+ Check out OxfordDictionary::Endpoints::Lemmas#lemma for the interface
17
+ to use.
18
+ '''
12
19
  EntryResponse.new(request(ENDPOINT, query, params)['results'][0])
13
20
  end
14
21
  end
@@ -0,0 +1,31 @@
1
+ require 'oxford_dictionary/deserialize'
2
+
3
+ module OxfordDictionary
4
+ module Endpoints
5
+ class Lemmas
6
+ ENDPOINT = 'lemmas'.freeze
7
+
8
+ def initialize(request_client:)
9
+ @request_client = request_client
10
+ end
11
+
12
+ def lemma(word:, language:, params: {})
13
+ query_string = "#{ENDPOINT}/#{language}/#{word}"
14
+ uri = URI(query_string)
15
+
16
+ unless params.empty?
17
+ uri.query = URI.encode_www_form(params)
18
+ end
19
+
20
+ response = @request_client.get(uri: uri)
21
+ deserialize.call(response.body)
22
+ end
23
+
24
+ private
25
+
26
+ def deserialize
27
+ @deserialize ||= OxfordDictionary::Deserialize.new
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module OxfordDictionary
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
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.1.0
4
+ version: 1.2.0
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-22 00:00:00.000000000 Z
11
+ date: 2019-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -158,6 +158,9 @@ files:
158
158
  - fixtures/vcr_cassettes/entries_entry-verbs.yml
159
159
  - fixtures/vcr_cassettes/entries_entry.yml
160
160
  - fixtures/vcr_cassettes/entries_entry_snake_case.yml
161
+ - fixtures/vcr_cassettes/lemmas_lemma-es.yml
162
+ - fixtures/vcr_cassettes/lemmas_lemma-verbs.yml
163
+ - fixtures/vcr_cassettes/lemmas_lemma.yml
161
164
  - lib/oxford_dictionary.rb
162
165
  - lib/oxford_dictionary/api_objects/entry.rb
163
166
  - lib/oxford_dictionary/api_objects/entry_response.rb
@@ -171,6 +174,7 @@ files:
171
174
  - lib/oxford_dictionary/endpoints/entries.rb
172
175
  - lib/oxford_dictionary/endpoints/entry_endpoint.rb
173
176
  - lib/oxford_dictionary/endpoints/inflection_endpoint.rb
177
+ - lib/oxford_dictionary/endpoints/lemmas.rb
174
178
  - lib/oxford_dictionary/endpoints/search_endpoint.rb
175
179
  - lib/oxford_dictionary/endpoints/wordlist_endpoint.rb
176
180
  - lib/oxford_dictionary/error.rb