cloudmersive-nlp-api-client 2.0.6 → 3.0.2

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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -136
  3. data/Gemfile +0 -7
  4. data/README.md +0 -151
  5. data/Rakefile +0 -8
  6. data/cloudmersive-nlp-api-client.gemspec +0 -45
  7. data/docs/AnalyticsApi.md +0 -118
  8. data/docs/CheckSentenceRequest.md +0 -8
  9. data/docs/CheckSentenceResponse.md +0 -9
  10. data/docs/CheckWordRequest.md +0 -8
  11. data/docs/CheckWordResponse.md +0 -9
  12. data/docs/CorrectWordInSentence.md +0 -10
  13. data/docs/Entity.md +0 -9
  14. data/docs/ExtractEntitiesApi.md +0 -63
  15. data/docs/ExtractEntitiesRequest.md +0 -8
  16. data/docs/ExtractEntitiesResponse.md +0 -9
  17. data/docs/GetWordsRequest.md +0 -8
  18. data/docs/GetWordsResponse.md +0 -8
  19. data/docs/LanguageDetectionApi.md +0 -63
  20. data/docs/LanguageDetectionRequest.md +0 -8
  21. data/docs/LanguageDetectionResponse.md +0 -10
  22. data/docs/LanguageTranslationApi.md +0 -228
  23. data/docs/LanguageTranslationRequest.md +0 -8
  24. data/docs/LanguageTranslationResponse.md +0 -10
  25. data/docs/ParseApi.md +0 -63
  26. data/docs/ParseRequest.md +0 -8
  27. data/docs/ParseResponse.md +0 -8
  28. data/docs/PosRequest.md +0 -8
  29. data/docs/PosResponse.md +0 -8
  30. data/docs/PosSentence.md +0 -8
  31. data/docs/PosTaggedWord.md +0 -9
  32. data/docs/PosTaggerApi.md +0 -338
  33. data/docs/ProfanityAnalysisRequest.md +0 -8
  34. data/docs/ProfanityAnalysisResponse.md +0 -10
  35. data/docs/RephraseApi.md +0 -63
  36. data/docs/RephraseRequest.md +0 -9
  37. data/docs/RephraseResponse.md +0 -10
  38. data/docs/RephrasedSentence.md +0 -10
  39. data/docs/RephrasedSentenceOption.md +0 -9
  40. data/docs/SegmentationApi.md +0 -118
  41. data/docs/SentenceSegmentationRequest.md +0 -8
  42. data/docs/SentenceSegmentationResponse.md +0 -10
  43. data/docs/SentimentAnalysisRequest.md +0 -8
  44. data/docs/SentimentAnalysisResponse.md +0 -11
  45. data/docs/SpellcheckApi.md +0 -118
  46. data/docs/WordPosition.md +0 -11
  47. data/git_push.sh +0 -55
  48. data/lib/cloudmersive-nlp-api-client.rb +0 -79
  49. data/lib/cloudmersive-nlp-api-client/api/analytics_api.rb +0 -133
  50. data/lib/cloudmersive-nlp-api-client/api/extract_entities_api.rb +0 -78
  51. data/lib/cloudmersive-nlp-api-client/api/language_detection_api.rb +0 -78
  52. data/lib/cloudmersive-nlp-api-client/api/language_translation_api.rb +0 -243
  53. data/lib/cloudmersive-nlp-api-client/api/parse_api.rb +0 -78
  54. data/lib/cloudmersive-nlp-api-client/api/pos_tagger_api.rb +0 -353
  55. data/lib/cloudmersive-nlp-api-client/api/rephrase_api.rb +0 -78
  56. data/lib/cloudmersive-nlp-api-client/api/segmentation_api.rb +0 -133
  57. data/lib/cloudmersive-nlp-api-client/api/spellcheck_api.rb +0 -133
  58. data/lib/cloudmersive-nlp-api-client/api_client.rb +0 -389
  59. data/lib/cloudmersive-nlp-api-client/api_error.rb +0 -38
  60. data/lib/cloudmersive-nlp-api-client/configuration.rb +0 -209
  61. data/lib/cloudmersive-nlp-api-client/models/check_sentence_request.rb +0 -189
  62. data/lib/cloudmersive-nlp-api-client/models/check_sentence_response.rb +0 -201
  63. data/lib/cloudmersive-nlp-api-client/models/check_word_request.rb +0 -188
  64. data/lib/cloudmersive-nlp-api-client/models/check_word_response.rb +0 -201
  65. data/lib/cloudmersive-nlp-api-client/models/correct_word_in_sentence.rb +0 -211
  66. data/lib/cloudmersive-nlp-api-client/models/entity.rb +0 -197
  67. data/lib/cloudmersive-nlp-api-client/models/extract_entities_request.rb +0 -189
  68. data/lib/cloudmersive-nlp-api-client/models/extract_entities_response.rb +0 -200
  69. data/lib/cloudmersive-nlp-api-client/models/get_words_request.rb +0 -188
  70. data/lib/cloudmersive-nlp-api-client/models/get_words_response.rb +0 -191
  71. data/lib/cloudmersive-nlp-api-client/models/language_detection_request.rb +0 -189
  72. data/lib/cloudmersive-nlp-api-client/models/language_detection_response.rb +0 -209
  73. data/lib/cloudmersive-nlp-api-client/models/language_translation_request.rb +0 -189
  74. data/lib/cloudmersive-nlp-api-client/models/language_translation_response.rb +0 -209
  75. data/lib/cloudmersive-nlp-api-client/models/parse_request.rb +0 -189
  76. data/lib/cloudmersive-nlp-api-client/models/parse_response.rb +0 -189
  77. data/lib/cloudmersive-nlp-api-client/models/pos_request.rb +0 -189
  78. data/lib/cloudmersive-nlp-api-client/models/pos_response.rb +0 -191
  79. data/lib/cloudmersive-nlp-api-client/models/pos_sentence.rb +0 -191
  80. data/lib/cloudmersive-nlp-api-client/models/pos_tagged_word.rb +0 -199
  81. data/lib/cloudmersive-nlp-api-client/models/profanity_analysis_request.rb +0 -189
  82. data/lib/cloudmersive-nlp-api-client/models/profanity_analysis_response.rb +0 -209
  83. data/lib/cloudmersive-nlp-api-client/models/rephrase_request.rb +0 -199
  84. data/lib/cloudmersive-nlp-api-client/models/rephrase_response.rb +0 -211
  85. data/lib/cloudmersive-nlp-api-client/models/rephrased_sentence.rb +0 -211
  86. data/lib/cloudmersive-nlp-api-client/models/rephrased_sentence_option.rb +0 -199
  87. data/lib/cloudmersive-nlp-api-client/models/sentence_segmentation_request.rb +0 -188
  88. data/lib/cloudmersive-nlp-api-client/models/sentence_segmentation_response.rb +0 -208
  89. data/lib/cloudmersive-nlp-api-client/models/sentiment_analysis_request.rb +0 -189
  90. data/lib/cloudmersive-nlp-api-client/models/sentiment_analysis_response.rb +0 -219
  91. data/lib/cloudmersive-nlp-api-client/models/word_position.rb +0 -219
  92. data/lib/cloudmersive-nlp-api-client/version.rb +0 -15
  93. data/spec/api/analytics_api_spec.rb +0 -59
  94. data/spec/api/extract_entities_api_spec.rb +0 -47
  95. data/spec/api/language_detection_api_spec.rb +0 -47
  96. data/spec/api/language_translation_api_spec.rb +0 -83
  97. data/spec/api/parse_api_spec.rb +0 -47
  98. data/spec/api/pos_tagger_api_spec.rb +0 -107
  99. data/spec/api/rephrase_api_spec.rb +0 -47
  100. data/spec/api/segmentation_api_spec.rb +0 -59
  101. data/spec/api/spellcheck_api_spec.rb +0 -59
  102. data/spec/api_client_spec.rb +0 -226
  103. data/spec/configuration_spec.rb +0 -42
  104. data/spec/models/check_sentence_request_spec.rb +0 -42
  105. data/spec/models/check_sentence_response_spec.rb +0 -48
  106. data/spec/models/check_word_request_spec.rb +0 -42
  107. data/spec/models/check_word_response_spec.rb +0 -48
  108. data/spec/models/correct_word_in_sentence_spec.rb +0 -54
  109. data/spec/models/entity_spec.rb +0 -48
  110. data/spec/models/extract_entities_request_spec.rb +0 -42
  111. data/spec/models/extract_entities_response_spec.rb +0 -48
  112. data/spec/models/get_words_request_spec.rb +0 -42
  113. data/spec/models/get_words_response_spec.rb +0 -42
  114. data/spec/models/language_detection_request_spec.rb +0 -42
  115. data/spec/models/language_detection_response_spec.rb +0 -54
  116. data/spec/models/language_translation_request_spec.rb +0 -42
  117. data/spec/models/language_translation_response_spec.rb +0 -54
  118. data/spec/models/parse_request_spec.rb +0 -42
  119. data/spec/models/parse_response_spec.rb +0 -42
  120. data/spec/models/pos_request_spec.rb +0 -42
  121. data/spec/models/pos_response_spec.rb +0 -42
  122. data/spec/models/pos_sentence_spec.rb +0 -42
  123. data/spec/models/pos_tagged_word_spec.rb +0 -48
  124. data/spec/models/profanity_analysis_request_spec.rb +0 -42
  125. data/spec/models/profanity_analysis_response_spec.rb +0 -54
  126. data/spec/models/rephrase_request_spec.rb +0 -48
  127. data/spec/models/rephrase_response_spec.rb +0 -54
  128. data/spec/models/rephrased_sentence_option_spec.rb +0 -48
  129. data/spec/models/rephrased_sentence_spec.rb +0 -54
  130. data/spec/models/sentence_segmentation_request_spec.rb +0 -42
  131. data/spec/models/sentence_segmentation_response_spec.rb +0 -54
  132. data/spec/models/sentiment_analysis_request_spec.rb +0 -42
  133. data/spec/models/sentiment_analysis_response_spec.rb +0 -60
  134. data/spec/models/word_position_spec.rb +0 -60
  135. data/spec/spec_helper.rb +0 -111
@@ -1,188 +0,0 @@
1
- =begin
2
- #nlpapiv2
3
-
4
- #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveNlpApiClient
16
-
17
- class CheckWordRequest
18
- attr_accessor :word
19
-
20
-
21
- # Attribute mapping from ruby-style variable name to JSON key.
22
- def self.attribute_map
23
- {
24
- :'word' => :'Word'
25
- }
26
- end
27
-
28
- # Attribute type mapping.
29
- def self.swagger_types
30
- {
31
- :'word' => :'String'
32
- }
33
- end
34
-
35
- # Initializes the object
36
- # @param [Hash] attributes Model attributes in the form of hash
37
- def initialize(attributes = {})
38
- return unless attributes.is_a?(Hash)
39
-
40
- # convert string to symbol for hash key
41
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
-
43
- if attributes.has_key?(:'Word')
44
- self.word = attributes[:'Word']
45
- end
46
-
47
- end
48
-
49
- # Show invalid properties with the reasons. Usually used together with valid?
50
- # @return Array for valid properties with the reasons
51
- def list_invalid_properties
52
- invalid_properties = Array.new
53
- return invalid_properties
54
- end
55
-
56
- # Check to see if the all the properties in the model are valid
57
- # @return true if the model is valid
58
- def valid?
59
- return true
60
- end
61
-
62
- # Checks equality by comparing each attribute.
63
- # @param [Object] Object to be compared
64
- def ==(o)
65
- return true if self.equal?(o)
66
- self.class == o.class &&
67
- word == o.word
68
- end
69
-
70
- # @see the `==` method
71
- # @param [Object] Object to be compared
72
- def eql?(o)
73
- self == o
74
- end
75
-
76
- # Calculates hash code according to all attributes.
77
- # @return [Fixnum] Hash code
78
- def hash
79
- [word].hash
80
- end
81
-
82
- # Builds the object from hash
83
- # @param [Hash] attributes Model attributes in the form of hash
84
- # @return [Object] Returns the model itself
85
- def build_from_hash(attributes)
86
- return nil unless attributes.is_a?(Hash)
87
- self.class.swagger_types.each_pair do |key, type|
88
- if type =~ /\AArray<(.*)>/i
89
- # check to ensure the input is an array given that the the attribute
90
- # is documented as an array but the input is not
91
- if attributes[self.class.attribute_map[key]].is_a?(Array)
92
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
- end
94
- elsif !attributes[self.class.attribute_map[key]].nil?
95
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
- end # or else data not found in attributes(hash), not an issue as the data can be optional
97
- end
98
-
99
- self
100
- end
101
-
102
- # Deserializes the data based on type
103
- # @param string type Data type
104
- # @param string value Value to be deserialized
105
- # @return [Object] Deserialized data
106
- def _deserialize(type, value)
107
- case type.to_sym
108
- when :DateTime
109
- DateTime.parse(value)
110
- when :Date
111
- Date.parse(value)
112
- when :String
113
- value.to_s
114
- when :Integer
115
- value.to_i
116
- when :Float
117
- value.to_f
118
- when :BOOLEAN
119
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
- true
121
- else
122
- false
123
- end
124
- when :Object
125
- # generic object (usually a Hash), return directly
126
- value
127
- when /\AArray<(?<inner_type>.+)>\z/
128
- inner_type = Regexp.last_match[:inner_type]
129
- value.map { |v| _deserialize(inner_type, v) }
130
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
- k_type = Regexp.last_match[:k_type]
132
- v_type = Regexp.last_match[:v_type]
133
- {}.tap do |hash|
134
- value.each do |k, v|
135
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
- end
137
- end
138
- else # model
139
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
140
- temp_model.build_from_hash(value)
141
- end
142
- end
143
-
144
- # Returns the string representation of the object
145
- # @return [String] String presentation of the object
146
- def to_s
147
- to_hash.to_s
148
- end
149
-
150
- # to_body is an alias to to_hash (backward compatibility)
151
- # @return [Hash] Returns the object in the form of hash
152
- def to_body
153
- to_hash
154
- end
155
-
156
- # Returns the object in the form of hash
157
- # @return [Hash] Returns the object in the form of hash
158
- def to_hash
159
- hash = {}
160
- self.class.attribute_map.each_pair do |attr, param|
161
- value = self.send(attr)
162
- next if value.nil?
163
- hash[param] = _to_hash(value)
164
- end
165
- hash
166
- end
167
-
168
- # Outputs non-array value in the form of hash
169
- # For object, use to_hash. Otherwise, just return the value
170
- # @param [Object] value Any valid value
171
- # @return [Hash] Returns the value in the form of hash
172
- def _to_hash(value)
173
- if value.is_a?(Array)
174
- value.compact.map{ |v| _to_hash(v) }
175
- elsif value.is_a?(Hash)
176
- {}.tap do |hash|
177
- value.each { |k, v| hash[k] = _to_hash(v) }
178
- end
179
- elsif value.respond_to? :to_hash
180
- value.to_hash
181
- else
182
- value
183
- end
184
- end
185
-
186
- end
187
-
188
- end
@@ -1,201 +0,0 @@
1
- =begin
2
- #nlpapiv2
3
-
4
- #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveNlpApiClient
16
- # Spelling correction check result
17
- class CheckWordResponse
18
- # True if the word is spelled correctly, false otherwise
19
- attr_accessor :correct
20
-
21
- # Suggested spelling corrections
22
- attr_accessor :suggestions
23
-
24
-
25
- # Attribute mapping from ruby-style variable name to JSON key.
26
- def self.attribute_map
27
- {
28
- :'correct' => :'Correct',
29
- :'suggestions' => :'Suggestions'
30
- }
31
- end
32
-
33
- # Attribute type mapping.
34
- def self.swagger_types
35
- {
36
- :'correct' => :'BOOLEAN',
37
- :'suggestions' => :'Array<String>'
38
- }
39
- end
40
-
41
- # Initializes the object
42
- # @param [Hash] attributes Model attributes in the form of hash
43
- def initialize(attributes = {})
44
- return unless attributes.is_a?(Hash)
45
-
46
- # convert string to symbol for hash key
47
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
48
-
49
- if attributes.has_key?(:'Correct')
50
- self.correct = attributes[:'Correct']
51
- end
52
-
53
- if attributes.has_key?(:'Suggestions')
54
- if (value = attributes[:'Suggestions']).is_a?(Array)
55
- self.suggestions = value
56
- end
57
- end
58
-
59
- end
60
-
61
- # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properties with the reasons
63
- def list_invalid_properties
64
- invalid_properties = Array.new
65
- return invalid_properties
66
- end
67
-
68
- # Check to see if the all the properties in the model are valid
69
- # @return true if the model is valid
70
- def valid?
71
- return true
72
- end
73
-
74
- # Checks equality by comparing each attribute.
75
- # @param [Object] Object to be compared
76
- def ==(o)
77
- return true if self.equal?(o)
78
- self.class == o.class &&
79
- correct == o.correct &&
80
- suggestions == o.suggestions
81
- end
82
-
83
- # @see the `==` method
84
- # @param [Object] Object to be compared
85
- def eql?(o)
86
- self == o
87
- end
88
-
89
- # Calculates hash code according to all attributes.
90
- # @return [Fixnum] Hash code
91
- def hash
92
- [correct, suggestions].hash
93
- end
94
-
95
- # Builds the object from hash
96
- # @param [Hash] attributes Model attributes in the form of hash
97
- # @return [Object] Returns the model itself
98
- def build_from_hash(attributes)
99
- return nil unless attributes.is_a?(Hash)
100
- self.class.swagger_types.each_pair do |key, type|
101
- if type =~ /\AArray<(.*)>/i
102
- # check to ensure the input is an array given that the the attribute
103
- # is documented as an array but the input is not
104
- if attributes[self.class.attribute_map[key]].is_a?(Array)
105
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
- end
107
- elsif !attributes[self.class.attribute_map[key]].nil?
108
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
109
- end # or else data not found in attributes(hash), not an issue as the data can be optional
110
- end
111
-
112
- self
113
- end
114
-
115
- # Deserializes the data based on type
116
- # @param string type Data type
117
- # @param string value Value to be deserialized
118
- # @return [Object] Deserialized data
119
- def _deserialize(type, value)
120
- case type.to_sym
121
- when :DateTime
122
- DateTime.parse(value)
123
- when :Date
124
- Date.parse(value)
125
- when :String
126
- value.to_s
127
- when :Integer
128
- value.to_i
129
- when :Float
130
- value.to_f
131
- when :BOOLEAN
132
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
- true
134
- else
135
- false
136
- end
137
- when :Object
138
- # generic object (usually a Hash), return directly
139
- value
140
- when /\AArray<(?<inner_type>.+)>\z/
141
- inner_type = Regexp.last_match[:inner_type]
142
- value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
- k_type = Regexp.last_match[:k_type]
145
- v_type = Regexp.last_match[:v_type]
146
- {}.tap do |hash|
147
- value.each do |k, v|
148
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
149
- end
150
- end
151
- else # model
152
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
153
- temp_model.build_from_hash(value)
154
- end
155
- end
156
-
157
- # Returns the string representation of the object
158
- # @return [String] String presentation of the object
159
- def to_s
160
- to_hash.to_s
161
- end
162
-
163
- # to_body is an alias to to_hash (backward compatibility)
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_body
166
- to_hash
167
- end
168
-
169
- # Returns the object in the form of hash
170
- # @return [Hash] Returns the object in the form of hash
171
- def to_hash
172
- hash = {}
173
- self.class.attribute_map.each_pair do |attr, param|
174
- value = self.send(attr)
175
- next if value.nil?
176
- hash[param] = _to_hash(value)
177
- end
178
- hash
179
- end
180
-
181
- # Outputs non-array value in the form of hash
182
- # For object, use to_hash. Otherwise, just return the value
183
- # @param [Object] value Any valid value
184
- # @return [Hash] Returns the value in the form of hash
185
- def _to_hash(value)
186
- if value.is_a?(Array)
187
- value.compact.map{ |v| _to_hash(v) }
188
- elsif value.is_a?(Hash)
189
- {}.tap do |hash|
190
- value.each { |k, v| hash[k] = _to_hash(v) }
191
- end
192
- elsif value.respond_to? :to_hash
193
- value.to_hash
194
- else
195
- value
196
- end
197
- end
198
-
199
- end
200
-
201
- end
@@ -1,211 +0,0 @@
1
- =begin
2
- #nlpapiv2
3
-
4
- #The powerful Natural Language Processing APIs (v2) let you perform part of speech tagging, entity identification, sentence parsing, and much more to help you understand the meaning of unstructured text.
5
-
6
- OpenAPI spec version: v1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveNlpApiClient
16
- # A word in a sentence
17
- class CorrectWordInSentence
18
- # Position of the word
19
- attr_accessor :word
20
-
21
- # True if the word is spelled correctly, false otherwise
22
- attr_accessor :correct
23
-
24
- # Suggested spelling improvements
25
- attr_accessor :suggestions
26
-
27
-
28
- # Attribute mapping from ruby-style variable name to JSON key.
29
- def self.attribute_map
30
- {
31
- :'word' => :'Word',
32
- :'correct' => :'Correct',
33
- :'suggestions' => :'Suggestions'
34
- }
35
- end
36
-
37
- # Attribute type mapping.
38
- def self.swagger_types
39
- {
40
- :'word' => :'WordPosition',
41
- :'correct' => :'BOOLEAN',
42
- :'suggestions' => :'Array<String>'
43
- }
44
- end
45
-
46
- # Initializes the object
47
- # @param [Hash] attributes Model attributes in the form of hash
48
- def initialize(attributes = {})
49
- return unless attributes.is_a?(Hash)
50
-
51
- # convert string to symbol for hash key
52
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
-
54
- if attributes.has_key?(:'Word')
55
- self.word = attributes[:'Word']
56
- end
57
-
58
- if attributes.has_key?(:'Correct')
59
- self.correct = attributes[:'Correct']
60
- end
61
-
62
- if attributes.has_key?(:'Suggestions')
63
- if (value = attributes[:'Suggestions']).is_a?(Array)
64
- self.suggestions = value
65
- end
66
- end
67
-
68
- end
69
-
70
- # Show invalid properties with the reasons. Usually used together with valid?
71
- # @return Array for valid properties with the reasons
72
- def list_invalid_properties
73
- invalid_properties = Array.new
74
- return invalid_properties
75
- end
76
-
77
- # Check to see if the all the properties in the model are valid
78
- # @return true if the model is valid
79
- def valid?
80
- return true
81
- end
82
-
83
- # Checks equality by comparing each attribute.
84
- # @param [Object] Object to be compared
85
- def ==(o)
86
- return true if self.equal?(o)
87
- self.class == o.class &&
88
- word == o.word &&
89
- correct == o.correct &&
90
- suggestions == o.suggestions
91
- end
92
-
93
- # @see the `==` method
94
- # @param [Object] Object to be compared
95
- def eql?(o)
96
- self == o
97
- end
98
-
99
- # Calculates hash code according to all attributes.
100
- # @return [Fixnum] Hash code
101
- def hash
102
- [word, correct, suggestions].hash
103
- end
104
-
105
- # Builds the object from hash
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- # @return [Object] Returns the model itself
108
- def build_from_hash(attributes)
109
- return nil unless attributes.is_a?(Hash)
110
- self.class.swagger_types.each_pair do |key, type|
111
- if type =~ /\AArray<(.*)>/i
112
- # check to ensure the input is an array given that the the attribute
113
- # is documented as an array but the input is not
114
- if attributes[self.class.attribute_map[key]].is_a?(Array)
115
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
- end
117
- elsif !attributes[self.class.attribute_map[key]].nil?
118
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
- end # or else data not found in attributes(hash), not an issue as the data can be optional
120
- end
121
-
122
- self
123
- end
124
-
125
- # Deserializes the data based on type
126
- # @param string type Data type
127
- # @param string value Value to be deserialized
128
- # @return [Object] Deserialized data
129
- def _deserialize(type, value)
130
- case type.to_sym
131
- when :DateTime
132
- DateTime.parse(value)
133
- when :Date
134
- Date.parse(value)
135
- when :String
136
- value.to_s
137
- when :Integer
138
- value.to_i
139
- when :Float
140
- value.to_f
141
- when :BOOLEAN
142
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
- true
144
- else
145
- false
146
- end
147
- when :Object
148
- # generic object (usually a Hash), return directly
149
- value
150
- when /\AArray<(?<inner_type>.+)>\z/
151
- inner_type = Regexp.last_match[:inner_type]
152
- value.map { |v| _deserialize(inner_type, v) }
153
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
- k_type = Regexp.last_match[:k_type]
155
- v_type = Regexp.last_match[:v_type]
156
- {}.tap do |hash|
157
- value.each do |k, v|
158
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
- end
160
- end
161
- else # model
162
- temp_model = CloudmersiveNlpApiClient.const_get(type).new
163
- temp_model.build_from_hash(value)
164
- end
165
- end
166
-
167
- # Returns the string representation of the object
168
- # @return [String] String presentation of the object
169
- def to_s
170
- to_hash.to_s
171
- end
172
-
173
- # to_body is an alias to to_hash (backward compatibility)
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_body
176
- to_hash
177
- end
178
-
179
- # Returns the object in the form of hash
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_hash
182
- hash = {}
183
- self.class.attribute_map.each_pair do |attr, param|
184
- value = self.send(attr)
185
- next if value.nil?
186
- hash[param] = _to_hash(value)
187
- end
188
- hash
189
- end
190
-
191
- # Outputs non-array value in the form of hash
192
- # For object, use to_hash. Otherwise, just return the value
193
- # @param [Object] value Any valid value
194
- # @return [Hash] Returns the value in the form of hash
195
- def _to_hash(value)
196
- if value.is_a?(Array)
197
- value.compact.map{ |v| _to_hash(v) }
198
- elsif value.is_a?(Hash)
199
- {}.tap do |hash|
200
- value.each { |k, v| hash[k] = _to_hash(v) }
201
- end
202
- elsif value.respond_to? :to_hash
203
- value.to_hash
204
- else
205
- value
206
- end
207
- end
208
-
209
- end
210
-
211
- end