test-words-api-client-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +76 -0
- data/lib/words_api/api_helper.rb +10 -0
- data/lib/words_api/client.rb +60 -0
- data/lib/words_api/configuration.rb +127 -0
- data/lib/words_api/controllers/ap_is_controller.rb +134 -0
- data/lib/words_api/controllers/base_controller.rb +66 -0
- data/lib/words_api/exceptions/api_exception.rb +10 -0
- data/lib/words_api/http/auth/custom_header_authentication.rb +44 -0
- data/lib/words_api/http/http_call_back.rb +10 -0
- data/lib/words_api/http/http_method_enum.rb +10 -0
- data/lib/words_api/http/http_request.rb +10 -0
- data/lib/words_api/http/http_response.rb +10 -0
- data/lib/words_api/models/base_model.rb +62 -0
- data/lib/words_api/models/definitions_response.rb +56 -0
- data/lib/words_api/models/examples_response.rb +56 -0
- data/lib/words_api/models/frequency_details.rb +64 -0
- data/lib/words_api/models/frequency_response.rb +56 -0
- data/lib/words_api/models/pronunciation_details.rb +67 -0
- data/lib/words_api/models/pronunciation_response.rb +57 -0
- data/lib/words_api/models/syllable_details.rb +59 -0
- data/lib/words_api/models/synonyms_response.rb +56 -0
- data/lib/words_api/models/word_details.rb +152 -0
- data/lib/words_api/models/word_response.rb +94 -0
- data/lib/words_api/utilities/date_time_helper.rb +11 -0
- data/lib/words_api/utilities/file_wrapper.rb +16 -0
- data/lib/words_api.rb +49 -0
- data/test/controllers/controller_test_base.rb +29 -0
- data/test/controllers/test_ap_is_controller.rb +171 -0
- data/test/http_response_catcher.rb +19 -0
- metadata +146 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains response for definitions endpoint.
|
|
8
|
+
class DefinitionsResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The word that is searched.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :word
|
|
15
|
+
|
|
16
|
+
# The definitions of the searched word.
|
|
17
|
+
# @return [Array[String]]
|
|
18
|
+
attr_accessor :definition
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['word'] = 'word'
|
|
24
|
+
@_hash['definition'] = 'definition'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(word = nil, definition = nil)
|
|
39
|
+
@word = word
|
|
40
|
+
@definition = definition
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
word = hash.key?('word') ? hash['word'] : nil
|
|
49
|
+
definition = hash.key?('definition') ? hash['definition'] : nil
|
|
50
|
+
|
|
51
|
+
# Create object from extracted values.
|
|
52
|
+
DefinitionsResponse.new(word,
|
|
53
|
+
definition)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains response for examples endpoint.
|
|
8
|
+
class ExamplesResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The word that is searched.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :word
|
|
15
|
+
|
|
16
|
+
# The usage examples of the searched word.
|
|
17
|
+
# @return [Array[String]]
|
|
18
|
+
attr_accessor :examples
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['word'] = 'word'
|
|
24
|
+
@_hash['examples'] = 'examples'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(word = nil, examples = nil)
|
|
39
|
+
@word = word
|
|
40
|
+
@examples = examples
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
word = hash.key?('word') ? hash['word'] : nil
|
|
49
|
+
examples = hash.key?('examples') ? hash['examples'] : nil
|
|
50
|
+
|
|
51
|
+
# Create object from extracted values.
|
|
52
|
+
ExamplesResponse.new(word,
|
|
53
|
+
examples)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This model contains frequency details of a specific word.
|
|
8
|
+
class FrequencyDetails < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Explains the zipf score.
|
|
13
|
+
# @return [Float]
|
|
14
|
+
attr_accessor :zipf
|
|
15
|
+
|
|
16
|
+
# Explains the perMillion score.
|
|
17
|
+
# @return [Float]
|
|
18
|
+
attr_accessor :per_million
|
|
19
|
+
|
|
20
|
+
# Explains the diversity score.
|
|
21
|
+
# @return [Float]
|
|
22
|
+
attr_accessor :diversity
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['zipf'] = 'zipf'
|
|
28
|
+
@_hash['per_million'] = 'perMillion'
|
|
29
|
+
@_hash['diversity'] = 'diversity'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# An array for nullable fields
|
|
39
|
+
def self.nullables
|
|
40
|
+
[]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def initialize(zipf = nil, per_million = nil, diversity = nil)
|
|
44
|
+
@zipf = zipf
|
|
45
|
+
@per_million = per_million
|
|
46
|
+
@diversity = diversity
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Creates an instance of the object from a hash.
|
|
50
|
+
def self.from_hash(hash)
|
|
51
|
+
return nil unless hash
|
|
52
|
+
|
|
53
|
+
# Extract variables from the hash.
|
|
54
|
+
zipf = hash.key?('zipf') ? hash['zipf'] : nil
|
|
55
|
+
per_million = hash.key?('perMillion') ? hash['perMillion'] : nil
|
|
56
|
+
diversity = hash.key?('diversity') ? hash['diversity'] : nil
|
|
57
|
+
|
|
58
|
+
# Create object from extracted values.
|
|
59
|
+
FrequencyDetails.new(zipf,
|
|
60
|
+
per_million,
|
|
61
|
+
diversity)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains response for frequency endpoint.
|
|
8
|
+
class FrequencyResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The word that is searched.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :word
|
|
15
|
+
|
|
16
|
+
# This model contains frequency details of a specific word.
|
|
17
|
+
# @return [FrequencyDetails]
|
|
18
|
+
attr_accessor :frequency
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['word'] = 'word'
|
|
24
|
+
@_hash['frequency'] = 'frequency'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(word = nil, frequency = nil)
|
|
39
|
+
@word = word
|
|
40
|
+
@frequency = frequency
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
word = hash.key?('word') ? hash['word'] : nil
|
|
49
|
+
frequency = FrequencyDetails.from_hash(hash['frequency']) if hash['frequency']
|
|
50
|
+
|
|
51
|
+
# Create object from extracted values.
|
|
52
|
+
FrequencyResponse.new(word,
|
|
53
|
+
frequency)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This model contains pronunciation details of a specific word.
|
|
8
|
+
class PronunciationDetails < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The pronunciation of the word.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :all
|
|
15
|
+
|
|
16
|
+
# The noun pronunciation of the word.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :noun
|
|
19
|
+
|
|
20
|
+
# The verb pronunciation of the word.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :verb
|
|
23
|
+
|
|
24
|
+
# A mapping from model property names to API property names.
|
|
25
|
+
def self.names
|
|
26
|
+
@_hash = {} if @_hash.nil?
|
|
27
|
+
@_hash['all'] = 'all'
|
|
28
|
+
@_hash['noun'] = 'noun'
|
|
29
|
+
@_hash['verb'] = 'verb'
|
|
30
|
+
@_hash
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for optional fields
|
|
34
|
+
def self.optionals
|
|
35
|
+
%w[
|
|
36
|
+
noun
|
|
37
|
+
verb
|
|
38
|
+
]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# An array for nullable fields
|
|
42
|
+
def self.nullables
|
|
43
|
+
[]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def initialize(all = nil, noun = SKIP, verb = SKIP)
|
|
47
|
+
@all = all
|
|
48
|
+
@noun = noun unless noun == SKIP
|
|
49
|
+
@verb = verb unless verb == SKIP
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Creates an instance of the object from a hash.
|
|
53
|
+
def self.from_hash(hash)
|
|
54
|
+
return nil unless hash
|
|
55
|
+
|
|
56
|
+
# Extract variables from the hash.
|
|
57
|
+
all = hash.key?('all') ? hash['all'] : nil
|
|
58
|
+
noun = hash.key?('noun') ? hash['noun'] : SKIP
|
|
59
|
+
verb = hash.key?('verb') ? hash['verb'] : SKIP
|
|
60
|
+
|
|
61
|
+
# Create object from extracted values.
|
|
62
|
+
PronunciationDetails.new(all,
|
|
63
|
+
noun,
|
|
64
|
+
verb)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains response for pronunciation endpoint.
|
|
8
|
+
class PronunciationResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The word that is searched.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :word
|
|
15
|
+
|
|
16
|
+
# This model contains pronunciation details of a specific word.
|
|
17
|
+
# @return [PronunciationDetails]
|
|
18
|
+
attr_accessor :pronunciation
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['word'] = 'word'
|
|
24
|
+
@_hash['pronunciation'] = 'pronunciation'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(word = nil, pronunciation = nil)
|
|
39
|
+
@word = word
|
|
40
|
+
@pronunciation = pronunciation
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
word = hash.key?('word') ? hash['word'] : nil
|
|
49
|
+
pronunciation = PronunciationDetails.from_hash(hash['pronunciation']) if
|
|
50
|
+
hash['pronunciation']
|
|
51
|
+
|
|
52
|
+
# Create object from extracted values.
|
|
53
|
+
PronunciationResponse.new(word,
|
|
54
|
+
pronunciation)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains the syllable details for word API.
|
|
8
|
+
class SyllableDetails < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The count of syllables.
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
attr_accessor :count
|
|
15
|
+
|
|
16
|
+
# The list of syllables.
|
|
17
|
+
# @return [Array[String]]
|
|
18
|
+
attr_accessor :list
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['count'] = 'count'
|
|
24
|
+
@_hash['list'] = 'list'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
%w[
|
|
31
|
+
count
|
|
32
|
+
list
|
|
33
|
+
]
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# An array for nullable fields
|
|
37
|
+
def self.nullables
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(count = SKIP, list = SKIP)
|
|
42
|
+
@count = count unless count == SKIP
|
|
43
|
+
@list = list unless list == SKIP
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Creates an instance of the object from a hash.
|
|
47
|
+
def self.from_hash(hash)
|
|
48
|
+
return nil unless hash
|
|
49
|
+
|
|
50
|
+
# Extract variables from the hash.
|
|
51
|
+
count = hash.key?('count') ? hash['count'] : SKIP
|
|
52
|
+
list = hash.key?('list') ? hash['list'] : SKIP
|
|
53
|
+
|
|
54
|
+
# Create object from extracted values.
|
|
55
|
+
SyllableDetails.new(count,
|
|
56
|
+
list)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type contains response for synonyms endpoint.
|
|
8
|
+
class SynonymsResponse < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# The word that is searched.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :word
|
|
15
|
+
|
|
16
|
+
# The synonyms of the searched word.
|
|
17
|
+
# @return [Array[String]]
|
|
18
|
+
attr_accessor :synonyms
|
|
19
|
+
|
|
20
|
+
# A mapping from model property names to API property names.
|
|
21
|
+
def self.names
|
|
22
|
+
@_hash = {} if @_hash.nil?
|
|
23
|
+
@_hash['word'] = 'word'
|
|
24
|
+
@_hash['synonyms'] = 'synonyms'
|
|
25
|
+
@_hash
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# An array for optional fields
|
|
29
|
+
def self.optionals
|
|
30
|
+
[]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# An array for nullable fields
|
|
34
|
+
def self.nullables
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def initialize(word = nil, synonyms = nil)
|
|
39
|
+
@word = word
|
|
40
|
+
@synonyms = synonyms
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Creates an instance of the object from a hash.
|
|
44
|
+
def self.from_hash(hash)
|
|
45
|
+
return nil unless hash
|
|
46
|
+
|
|
47
|
+
# Extract variables from the hash.
|
|
48
|
+
word = hash.key?('word') ? hash['word'] : nil
|
|
49
|
+
synonyms = hash.key?('synonyms') ? hash['synonyms'] : nil
|
|
50
|
+
|
|
51
|
+
# Create object from extracted values.
|
|
52
|
+
SynonymsResponse.new(word,
|
|
53
|
+
synonyms)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# words_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
|
4
|
+
# ( https://apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module WordsApi
|
|
7
|
+
# This custom type stores word information.
|
|
8
|
+
class WordDetails < BaseModel
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# Explains the definition of the word.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :definition
|
|
15
|
+
|
|
16
|
+
# Explains what part of speech the word is.
|
|
17
|
+
# @return [String]
|
|
18
|
+
attr_accessor :part_of_speech
|
|
19
|
+
|
|
20
|
+
# The list of synonyms.
|
|
21
|
+
# @return [Array[String]]
|
|
22
|
+
attr_accessor :synonyms
|
|
23
|
+
|
|
24
|
+
# List of words that are more general than the searched word.
|
|
25
|
+
# @return [Array[String]]
|
|
26
|
+
attr_accessor :type_of
|
|
27
|
+
|
|
28
|
+
# More specific examples of types of searched word.
|
|
29
|
+
# @return [Array[String]]
|
|
30
|
+
attr_accessor :has_types
|
|
31
|
+
|
|
32
|
+
# The derivation if any.
|
|
33
|
+
# @return [Array[String]]
|
|
34
|
+
attr_accessor :derivation
|
|
35
|
+
|
|
36
|
+
# The usage examples of word if any.
|
|
37
|
+
# @return [Array[String]]
|
|
38
|
+
attr_accessor :examples
|
|
39
|
+
|
|
40
|
+
# List of antonyms for the searched word.
|
|
41
|
+
# @return [Array[String]]
|
|
42
|
+
attr_accessor :antonyms
|
|
43
|
+
|
|
44
|
+
# The verb group of the searched word.
|
|
45
|
+
# @return [Array[String]]
|
|
46
|
+
attr_accessor :verb_group
|
|
47
|
+
|
|
48
|
+
# Words that are parts of the searched word.
|
|
49
|
+
# @return [Array[String]]
|
|
50
|
+
attr_accessor :has_parts
|
|
51
|
+
|
|
52
|
+
# Words that are substances of the searched word.
|
|
53
|
+
# @return [Array[String]]
|
|
54
|
+
attr_accessor :has_substances
|
|
55
|
+
|
|
56
|
+
# Words that are implied by the searched word. Usually used for verbs.
|
|
57
|
+
# @return [Array[String]]
|
|
58
|
+
attr_accessor :entails
|
|
59
|
+
|
|
60
|
+
# A mapping from model property names to API property names.
|
|
61
|
+
def self.names
|
|
62
|
+
@_hash = {} if @_hash.nil?
|
|
63
|
+
@_hash['definition'] = 'definition'
|
|
64
|
+
@_hash['part_of_speech'] = 'partOfSpeech'
|
|
65
|
+
@_hash['synonyms'] = 'synonyms'
|
|
66
|
+
@_hash['type_of'] = 'typeOf'
|
|
67
|
+
@_hash['has_types'] = 'hasTypes'
|
|
68
|
+
@_hash['derivation'] = 'derivation'
|
|
69
|
+
@_hash['examples'] = 'examples'
|
|
70
|
+
@_hash['antonyms'] = 'antonyms'
|
|
71
|
+
@_hash['verb_group'] = 'verbGroup'
|
|
72
|
+
@_hash['has_parts'] = 'hasParts'
|
|
73
|
+
@_hash['has_substances'] = 'hasSubstances'
|
|
74
|
+
@_hash['entails'] = 'entails'
|
|
75
|
+
@_hash
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# An array for optional fields
|
|
79
|
+
def self.optionals
|
|
80
|
+
%w[
|
|
81
|
+
definition
|
|
82
|
+
part_of_speech
|
|
83
|
+
synonyms
|
|
84
|
+
type_of
|
|
85
|
+
has_types
|
|
86
|
+
derivation
|
|
87
|
+
examples
|
|
88
|
+
antonyms
|
|
89
|
+
verb_group
|
|
90
|
+
has_parts
|
|
91
|
+
has_substances
|
|
92
|
+
entails
|
|
93
|
+
]
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# An array for nullable fields
|
|
97
|
+
def self.nullables
|
|
98
|
+
[]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def initialize(definition = SKIP, part_of_speech = SKIP, synonyms = SKIP,
|
|
102
|
+
type_of = SKIP, has_types = SKIP, derivation = SKIP,
|
|
103
|
+
examples = SKIP, antonyms = SKIP, verb_group = SKIP,
|
|
104
|
+
has_parts = SKIP, has_substances = SKIP, entails = SKIP)
|
|
105
|
+
@definition = definition unless definition == SKIP
|
|
106
|
+
@part_of_speech = part_of_speech unless part_of_speech == SKIP
|
|
107
|
+
@synonyms = synonyms unless synonyms == SKIP
|
|
108
|
+
@type_of = type_of unless type_of == SKIP
|
|
109
|
+
@has_types = has_types unless has_types == SKIP
|
|
110
|
+
@derivation = derivation unless derivation == SKIP
|
|
111
|
+
@examples = examples unless examples == SKIP
|
|
112
|
+
@antonyms = antonyms unless antonyms == SKIP
|
|
113
|
+
@verb_group = verb_group unless verb_group == SKIP
|
|
114
|
+
@has_parts = has_parts unless has_parts == SKIP
|
|
115
|
+
@has_substances = has_substances unless has_substances == SKIP
|
|
116
|
+
@entails = entails unless entails == SKIP
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# Creates an instance of the object from a hash.
|
|
120
|
+
def self.from_hash(hash)
|
|
121
|
+
return nil unless hash
|
|
122
|
+
|
|
123
|
+
# Extract variables from the hash.
|
|
124
|
+
definition = hash.key?('definition') ? hash['definition'] : SKIP
|
|
125
|
+
part_of_speech = hash.key?('partOfSpeech') ? hash['partOfSpeech'] : SKIP
|
|
126
|
+
synonyms = hash.key?('synonyms') ? hash['synonyms'] : SKIP
|
|
127
|
+
type_of = hash.key?('typeOf') ? hash['typeOf'] : SKIP
|
|
128
|
+
has_types = hash.key?('hasTypes') ? hash['hasTypes'] : SKIP
|
|
129
|
+
derivation = hash.key?('derivation') ? hash['derivation'] : SKIP
|
|
130
|
+
examples = hash.key?('examples') ? hash['examples'] : SKIP
|
|
131
|
+
antonyms = hash.key?('antonyms') ? hash['antonyms'] : SKIP
|
|
132
|
+
verb_group = hash.key?('verbGroup') ? hash['verbGroup'] : SKIP
|
|
133
|
+
has_parts = hash.key?('hasParts') ? hash['hasParts'] : SKIP
|
|
134
|
+
has_substances = hash.key?('hasSubstances') ? hash['hasSubstances'] : SKIP
|
|
135
|
+
entails = hash.key?('entails') ? hash['entails'] : SKIP
|
|
136
|
+
|
|
137
|
+
# Create object from extracted values.
|
|
138
|
+
WordDetails.new(definition,
|
|
139
|
+
part_of_speech,
|
|
140
|
+
synonyms,
|
|
141
|
+
type_of,
|
|
142
|
+
has_types,
|
|
143
|
+
derivation,
|
|
144
|
+
examples,
|
|
145
|
+
antonyms,
|
|
146
|
+
verb_group,
|
|
147
|
+
has_parts,
|
|
148
|
+
has_substances,
|
|
149
|
+
entails)
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|