moderation_api 1.2.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.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +144 -0
  4. data/Rakefile +10 -0
  5. data/docs/AccountApi.md +74 -0
  6. data/docs/AccountGet200Response.md +26 -0
  7. data/docs/AccountGet200ResponseCurrentProject.md +20 -0
  8. data/docs/ActionsCreateRequest.md +36 -0
  9. data/docs/ActionsCreateRequestWebhooksInner.md +24 -0
  10. data/docs/ActionsDelete200Response.md +20 -0
  11. data/docs/ActionsExecute200Response.md +22 -0
  12. data/docs/ActionsExecuteDeprecatedRequest.md +22 -0
  13. data/docs/ActionsExecuteRequest.md +24 -0
  14. data/docs/ActionsGet200Response.md +40 -0
  15. data/docs/ActionsGet200ResponseWebhooksInner.md +26 -0
  16. data/docs/ActionsList200ResponseInner.md +38 -0
  17. data/docs/ActionsList200ResponseInnerPossibleValuesInner.md +18 -0
  18. data/docs/ActionsList400Response.md +22 -0
  19. data/docs/ActionsList400ResponseIssuesInner.md +18 -0
  20. data/docs/ActionsUpdateRequest.md +36 -0
  21. data/docs/ModerateApi.md +357 -0
  22. data/docs/ModerationAudioRequest.md +28 -0
  23. data/docs/ModerationImage200Response.md +28 -0
  24. data/docs/ModerationImage200ResponseLabelsInner.md +20 -0
  25. data/docs/ModerationImageRequest.md +28 -0
  26. data/docs/ModerationObject200Response.md +36 -0
  27. data/docs/ModerationObject200ResponseAllOfEntitiesInner.md +22 -0
  28. data/docs/ModerationObject200ResponseAllOfFieldsInner.md +22 -0
  29. data/docs/ModerationObject200ResponseAllOfLabelsInner.md +22 -0
  30. data/docs/ModerationObjectRequest.md +28 -0
  31. data/docs/ModerationObjectRequestValue.md +20 -0
  32. data/docs/ModerationObjectRequestValueDataValue.md +22 -0
  33. data/docs/ModerationText200Response.md +64 -0
  34. data/docs/ModerationText200ResponseAllOfAddress.md +28 -0
  35. data/docs/ModerationText200ResponseAllOfEmail.md +28 -0
  36. data/docs/ModerationText200ResponseAllOfName.md +28 -0
  37. data/docs/ModerationText200ResponseAllOfNsfw.md +26 -0
  38. data/docs/ModerationText200ResponseAllOfNsfwLabelScores.md +22 -0
  39. data/docs/ModerationText200ResponseAllOfPhone.md +28 -0
  40. data/docs/ModerationText200ResponseAllOfProfanity.md +28 -0
  41. data/docs/ModerationText200ResponseAllOfPropriety.md +26 -0
  42. data/docs/ModerationText200ResponseAllOfProprietyLabelScores.md +22 -0
  43. data/docs/ModerationText200ResponseAllOfQuality.md +26 -0
  44. data/docs/ModerationText200ResponseAllOfQualityLabelScores.md +24 -0
  45. data/docs/ModerationText200ResponseAllOfRequest.md +20 -0
  46. data/docs/ModerationText200ResponseAllOfSensitive.md +28 -0
  47. data/docs/ModerationText200ResponseAllOfSentiment.md +26 -0
  48. data/docs/ModerationText200ResponseAllOfSentimentLabelScores.md +22 -0
  49. data/docs/ModerationText200ResponseAllOfToxicity.md +26 -0
  50. data/docs/ModerationText200ResponseAllOfToxicityLabelScores.md +30 -0
  51. data/docs/ModerationText200ResponseAllOfUrl.md +28 -0
  52. data/docs/ModerationText200ResponseAllOfUsername.md +28 -0
  53. data/docs/ModerationText200ResponseAllOfWordlist.md +28 -0
  54. data/docs/ModerationText200ResponseAllOfWordlistsInner.md +36 -0
  55. data/docs/ModerationTextRequest.md +28 -0
  56. data/docs/ModerationVideo200Response.md +24 -0
  57. data/docs/ModerationVideoRequest.md +28 -0
  58. data/docs/QueueActionsApi.md +503 -0
  59. data/git_push.sh +57 -0
  60. data/lib/moderation_api/api/account_api.rb +79 -0
  61. data/lib/moderation_api/api/moderate_api.rb +362 -0
  62. data/lib/moderation_api/api/queue_actions_api.rb +492 -0
  63. data/lib/moderation_api/api_client.rb +437 -0
  64. data/lib/moderation_api/api_error.rb +58 -0
  65. data/lib/moderation_api/configuration.rb +392 -0
  66. data/lib/moderation_api/models/account_get200_response.rb +278 -0
  67. data/lib/moderation_api/models/account_get200_response_current_project.rb +237 -0
  68. data/lib/moderation_api/models/actions_create_request.rb +374 -0
  69. data/lib/moderation_api/models/actions_create_request_webhooks_inner.rb +260 -0
  70. data/lib/moderation_api/models/actions_delete200_response.rb +239 -0
  71. data/lib/moderation_api/models/actions_execute200_response.rb +258 -0
  72. data/lib/moderation_api/models/actions_execute_deprecated_request.rb +244 -0
  73. data/lib/moderation_api/models/actions_execute_request.rb +261 -0
  74. data/lib/moderation_api/models/actions_get200_response.rb +408 -0
  75. data/lib/moderation_api/models/actions_get200_response_webhooks_inner.rb +278 -0
  76. data/lib/moderation_api/models/actions_list200_response_inner.rb +396 -0
  77. data/lib/moderation_api/models/actions_list200_response_inner_possible_values_inner.rb +222 -0
  78. data/lib/moderation_api/models/actions_list400_response.rb +248 -0
  79. data/lib/moderation_api/models/actions_list400_response_issues_inner.rb +221 -0
  80. data/lib/moderation_api/models/actions_update_request.rb +367 -0
  81. data/lib/moderation_api/models/moderation_audio_request.rb +302 -0
  82. data/lib/moderation_api/models/moderation_image200_response.rb +296 -0
  83. data/lib/moderation_api/models/moderation_image200_response_labels_inner.rb +301 -0
  84. data/lib/moderation_api/models/moderation_image_request.rb +302 -0
  85. data/lib/moderation_api/models/moderation_object200_response.rb +368 -0
  86. data/lib/moderation_api/models/moderation_object200_response_all_of_entities_inner.rb +251 -0
  87. data/lib/moderation_api/models/moderation_object200_response_all_of_fields_inner.rb +258 -0
  88. data/lib/moderation_api/models/moderation_object200_response_all_of_labels_inner.rb +284 -0
  89. data/lib/moderation_api/models/moderation_object_request.rb +301 -0
  90. data/lib/moderation_api/models/moderation_object_request_value.rb +275 -0
  91. data/lib/moderation_api/models/moderation_object_request_value_data_value.rb +285 -0
  92. data/lib/moderation_api/models/moderation_text200_response.rb +488 -0
  93. data/lib/moderation_api/models/moderation_text200_response_all_of_address.rb +303 -0
  94. data/lib/moderation_api/models/moderation_text200_response_all_of_email.rb +303 -0
  95. data/lib/moderation_api/models/moderation_text200_response_all_of_name.rb +303 -0
  96. data/lib/moderation_api/models/moderation_text200_response_all_of_nsfw.rb +255 -0
  97. data/lib/moderation_api/models/moderation_text200_response_all_of_nsfw_label_scores.rb +235 -0
  98. data/lib/moderation_api/models/moderation_text200_response_all_of_phone.rb +303 -0
  99. data/lib/moderation_api/models/moderation_text200_response_all_of_profanity.rb +303 -0
  100. data/lib/moderation_api/models/moderation_text200_response_all_of_propriety.rb +255 -0
  101. data/lib/moderation_api/models/moderation_text200_response_all_of_propriety_label_scores.rb +235 -0
  102. data/lib/moderation_api/models/moderation_text200_response_all_of_quality.rb +255 -0
  103. data/lib/moderation_api/models/moderation_text200_response_all_of_quality_label_scores.rb +245 -0
  104. data/lib/moderation_api/models/moderation_text200_response_all_of_request.rb +240 -0
  105. data/lib/moderation_api/models/moderation_text200_response_all_of_sensitive.rb +303 -0
  106. data/lib/moderation_api/models/moderation_text200_response_all_of_sentiment.rb +255 -0
  107. data/lib/moderation_api/models/moderation_text200_response_all_of_sentiment_label_scores.rb +235 -0
  108. data/lib/moderation_api/models/moderation_text200_response_all_of_toxicity.rb +262 -0
  109. data/lib/moderation_api/models/moderation_text200_response_all_of_toxicity_label_scores.rb +275 -0
  110. data/lib/moderation_api/models/moderation_text200_response_all_of_url.rb +303 -0
  111. data/lib/moderation_api/models/moderation_text200_response_all_of_username.rb +303 -0
  112. data/lib/moderation_api/models/moderation_text200_response_all_of_wordlist.rb +303 -0
  113. data/lib/moderation_api/models/moderation_text200_response_all_of_wordlists_inner.rb +377 -0
  114. data/lib/moderation_api/models/moderation_text_request.rb +330 -0
  115. data/lib/moderation_api/models/moderation_video200_response.rb +265 -0
  116. data/lib/moderation_api/models/moderation_video_request.rb +302 -0
  117. data/lib/moderation_api/version.rb +15 -0
  118. data/lib/moderation_api.rb +93 -0
  119. data/moderation_api.gemspec +45 -0
  120. data/spec/api/account_api_spec.rb +46 -0
  121. data/spec/api/moderate_api_spec.rb +95 -0
  122. data/spec/api/queue_actions_api_spec.rb +121 -0
  123. data/spec/models/account_get200_response_current_project_spec.rb +42 -0
  124. data/spec/models/account_get200_response_spec.rb +60 -0
  125. data/spec/models/actions_create_request_spec.rb +98 -0
  126. data/spec/models/actions_create_request_webhooks_inner_spec.rb +54 -0
  127. data/spec/models/actions_delete200_response_spec.rb +42 -0
  128. data/spec/models/actions_execute200_response_spec.rb +48 -0
  129. data/spec/models/actions_execute_deprecated_request_spec.rb +48 -0
  130. data/spec/models/actions_execute_request_spec.rb +54 -0
  131. data/spec/models/actions_get200_response_spec.rb +110 -0
  132. data/spec/models/actions_get200_response_webhooks_inner_spec.rb +60 -0
  133. data/spec/models/actions_list200_response_inner_possible_values_inner_spec.rb +36 -0
  134. data/spec/models/actions_list200_response_inner_spec.rb +104 -0
  135. data/spec/models/actions_list400_response_issues_inner_spec.rb +36 -0
  136. data/spec/models/actions_list400_response_spec.rb +48 -0
  137. data/spec/models/actions_update_request_spec.rb +98 -0
  138. data/spec/models/moderation_audio_request_spec.rb +66 -0
  139. data/spec/models/moderation_image200_response_labels_inner_spec.rb +46 -0
  140. data/spec/models/moderation_image200_response_spec.rb +66 -0
  141. data/spec/models/moderation_image_request_spec.rb +66 -0
  142. data/spec/models/moderation_object200_response_all_of_entities_inner_spec.rb +48 -0
  143. data/spec/models/moderation_object200_response_all_of_fields_inner_spec.rb +48 -0
  144. data/spec/models/moderation_object200_response_all_of_labels_inner_spec.rb +48 -0
  145. data/spec/models/moderation_object200_response_spec.rb +90 -0
  146. data/spec/models/moderation_object_request_spec.rb +66 -0
  147. data/spec/models/moderation_object_request_value_data_value_spec.rb +52 -0
  148. data/spec/models/moderation_object_request_value_spec.rb +46 -0
  149. data/spec/models/moderation_text200_response_all_of_address_spec.rb +70 -0
  150. data/spec/models/moderation_text200_response_all_of_email_spec.rb +70 -0
  151. data/spec/models/moderation_text200_response_all_of_name_spec.rb +70 -0
  152. data/spec/models/moderation_text200_response_all_of_nsfw_label_scores_spec.rb +48 -0
  153. data/spec/models/moderation_text200_response_all_of_nsfw_spec.rb +60 -0
  154. data/spec/models/moderation_text200_response_all_of_phone_spec.rb +70 -0
  155. data/spec/models/moderation_text200_response_all_of_profanity_spec.rb +70 -0
  156. data/spec/models/moderation_text200_response_all_of_propriety_label_scores_spec.rb +48 -0
  157. data/spec/models/moderation_text200_response_all_of_propriety_spec.rb +60 -0
  158. data/spec/models/moderation_text200_response_all_of_quality_label_scores_spec.rb +54 -0
  159. data/spec/models/moderation_text200_response_all_of_quality_spec.rb +60 -0
  160. data/spec/models/moderation_text200_response_all_of_request_spec.rb +42 -0
  161. data/spec/models/moderation_text200_response_all_of_sensitive_spec.rb +70 -0
  162. data/spec/models/moderation_text200_response_all_of_sentiment_label_scores_spec.rb +48 -0
  163. data/spec/models/moderation_text200_response_all_of_sentiment_spec.rb +60 -0
  164. data/spec/models/moderation_text200_response_all_of_toxicity_label_scores_spec.rb +72 -0
  165. data/spec/models/moderation_text200_response_all_of_toxicity_spec.rb +60 -0
  166. data/spec/models/moderation_text200_response_all_of_url_spec.rb +70 -0
  167. data/spec/models/moderation_text200_response_all_of_username_spec.rb +70 -0
  168. data/spec/models/moderation_text200_response_all_of_wordlist_spec.rb +70 -0
  169. data/spec/models/moderation_text200_response_all_of_wordlists_inner_spec.rb +94 -0
  170. data/spec/models/moderation_text200_response_spec.rb +174 -0
  171. data/spec/models/moderation_text_request_spec.rb +66 -0
  172. data/spec/models/moderation_video200_response_spec.rb +54 -0
  173. data/spec/models/moderation_video_request_spec.rb +66 -0
  174. data/spec/spec_helper.rb +111 -0
  175. metadata +340 -0
@@ -0,0 +1,488 @@
1
+ =begin
2
+ #Moderation API
3
+
4
+ #API for automated content moderation
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.10.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module ModerationAPI
17
+ class ModerationText200Response
18
+ # Success if the request was successful
19
+ attr_accessor :status
20
+
21
+ attr_accessor :request
22
+
23
+ # Whether the content was flagged by any models
24
+ attr_accessor :flagged
25
+
26
+ # Whether the content was moderated or not. Same as `content` !== `original`
27
+ attr_accessor :content_moderated
28
+
29
+ # Whether the content is using look-alike characters. Often used by spammers.
30
+ attr_accessor :unicode_spoofing
31
+
32
+ # Whether any entity matchers found data for the content
33
+ attr_accessor :data_found
34
+
35
+ # The original content
36
+ attr_accessor :original
37
+
38
+ # The content after moderation. With all mask replacements applied and look-alike characters replaced with the original characters.
39
+ attr_accessor :content
40
+
41
+ # The ID of the content. Only returned if the content was stored.
42
+ attr_accessor :content_id
43
+
44
+ attr_accessor :nsfw
45
+
46
+ attr_accessor :toxicity
47
+
48
+ attr_accessor :quality
49
+
50
+ attr_accessor :sentiment
51
+
52
+ attr_accessor :propriety
53
+
54
+ attr_accessor :email
55
+
56
+ attr_accessor :phone
57
+
58
+ attr_accessor :url
59
+
60
+ attr_accessor :address
61
+
62
+ attr_accessor :name
63
+
64
+ attr_accessor :username
65
+
66
+ attr_accessor :profanity
67
+
68
+ attr_accessor :sensitive
69
+
70
+ attr_accessor :wordlist
71
+
72
+ # The wordlist entity matcher outputs if enabled in your project. Read more at https://docs.moderationapi.com/models/word
73
+ attr_accessor :wordlists
74
+
75
+ # Attribute mapping from ruby-style variable name to JSON key.
76
+ def self.attribute_map
77
+ {
78
+ :'status' => :'status',
79
+ :'request' => :'request',
80
+ :'flagged' => :'flagged',
81
+ :'content_moderated' => :'content_moderated',
82
+ :'unicode_spoofing' => :'unicode_spoofing',
83
+ :'data_found' => :'data_found',
84
+ :'original' => :'original',
85
+ :'content' => :'content',
86
+ :'content_id' => :'contentId',
87
+ :'nsfw' => :'nsfw',
88
+ :'toxicity' => :'toxicity',
89
+ :'quality' => :'quality',
90
+ :'sentiment' => :'sentiment',
91
+ :'propriety' => :'propriety',
92
+ :'email' => :'email',
93
+ :'phone' => :'phone',
94
+ :'url' => :'url',
95
+ :'address' => :'address',
96
+ :'name' => :'name',
97
+ :'username' => :'username',
98
+ :'profanity' => :'profanity',
99
+ :'sensitive' => :'sensitive',
100
+ :'wordlist' => :'wordlist',
101
+ :'wordlists' => :'wordlists'
102
+ }
103
+ end
104
+
105
+ # Returns all the JSON keys this model knows about
106
+ def self.acceptable_attributes
107
+ attribute_map.values
108
+ end
109
+
110
+ # Attribute type mapping.
111
+ def self.openapi_types
112
+ {
113
+ :'status' => :'String',
114
+ :'request' => :'ModerationText200ResponseAllOfRequest',
115
+ :'flagged' => :'Boolean',
116
+ :'content_moderated' => :'Boolean',
117
+ :'unicode_spoofing' => :'Boolean',
118
+ :'data_found' => :'Boolean',
119
+ :'original' => :'String',
120
+ :'content' => :'String',
121
+ :'content_id' => :'String',
122
+ :'nsfw' => :'ModerationText200ResponseAllOfNsfw',
123
+ :'toxicity' => :'ModerationText200ResponseAllOfToxicity',
124
+ :'quality' => :'ModerationText200ResponseAllOfQuality',
125
+ :'sentiment' => :'ModerationText200ResponseAllOfSentiment',
126
+ :'propriety' => :'ModerationText200ResponseAllOfPropriety',
127
+ :'email' => :'ModerationText200ResponseAllOfEmail',
128
+ :'phone' => :'ModerationText200ResponseAllOfPhone',
129
+ :'url' => :'ModerationText200ResponseAllOfUrl',
130
+ :'address' => :'ModerationText200ResponseAllOfAddress',
131
+ :'name' => :'ModerationText200ResponseAllOfName',
132
+ :'username' => :'ModerationText200ResponseAllOfUsername',
133
+ :'profanity' => :'ModerationText200ResponseAllOfProfanity',
134
+ :'sensitive' => :'ModerationText200ResponseAllOfSensitive',
135
+ :'wordlist' => :'ModerationText200ResponseAllOfWordlist',
136
+ :'wordlists' => :'Array<ModerationText200ResponseAllOfWordlistsInner>'
137
+ }
138
+ end
139
+
140
+ # List of attributes with nullable: true
141
+ def self.openapi_nullable
142
+ Set.new([
143
+ ])
144
+ end
145
+
146
+ # Initializes the object
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ def initialize(attributes = {})
149
+ if (!attributes.is_a?(Hash))
150
+ fail ArgumentError, "The input argument (attributes) must be a hash in `ModerationAPI::ModerationText200Response` initialize method"
151
+ end
152
+
153
+ # check to see if the attribute exists and convert string to symbol for hash key
154
+ attributes = attributes.each_with_object({}) { |(k, v), h|
155
+ if (!self.class.attribute_map.key?(k.to_sym))
156
+ fail ArgumentError, "`#{k}` is not a valid attribute in `ModerationAPI::ModerationText200Response`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
157
+ end
158
+ h[k.to_sym] = v
159
+ }
160
+
161
+ if attributes.key?(:'status')
162
+ self.status = attributes[:'status']
163
+ else
164
+ self.status = nil
165
+ end
166
+
167
+ if attributes.key?(:'request')
168
+ self.request = attributes[:'request']
169
+ else
170
+ self.request = nil
171
+ end
172
+
173
+ if attributes.key?(:'flagged')
174
+ self.flagged = attributes[:'flagged']
175
+ else
176
+ self.flagged = nil
177
+ end
178
+
179
+ if attributes.key?(:'content_moderated')
180
+ self.content_moderated = attributes[:'content_moderated']
181
+ else
182
+ self.content_moderated = nil
183
+ end
184
+
185
+ if attributes.key?(:'unicode_spoofing')
186
+ self.unicode_spoofing = attributes[:'unicode_spoofing']
187
+ else
188
+ self.unicode_spoofing = nil
189
+ end
190
+
191
+ if attributes.key?(:'data_found')
192
+ self.data_found = attributes[:'data_found']
193
+ else
194
+ self.data_found = nil
195
+ end
196
+
197
+ if attributes.key?(:'original')
198
+ self.original = attributes[:'original']
199
+ else
200
+ self.original = nil
201
+ end
202
+
203
+ if attributes.key?(:'content')
204
+ self.content = attributes[:'content']
205
+ else
206
+ self.content = nil
207
+ end
208
+
209
+ if attributes.key?(:'content_id')
210
+ self.content_id = attributes[:'content_id']
211
+ end
212
+
213
+ if attributes.key?(:'nsfw')
214
+ self.nsfw = attributes[:'nsfw']
215
+ end
216
+
217
+ if attributes.key?(:'toxicity')
218
+ self.toxicity = attributes[:'toxicity']
219
+ end
220
+
221
+ if attributes.key?(:'quality')
222
+ self.quality = attributes[:'quality']
223
+ end
224
+
225
+ if attributes.key?(:'sentiment')
226
+ self.sentiment = attributes[:'sentiment']
227
+ end
228
+
229
+ if attributes.key?(:'propriety')
230
+ self.propriety = attributes[:'propriety']
231
+ end
232
+
233
+ if attributes.key?(:'email')
234
+ self.email = attributes[:'email']
235
+ end
236
+
237
+ if attributes.key?(:'phone')
238
+ self.phone = attributes[:'phone']
239
+ end
240
+
241
+ if attributes.key?(:'url')
242
+ self.url = attributes[:'url']
243
+ end
244
+
245
+ if attributes.key?(:'address')
246
+ self.address = attributes[:'address']
247
+ end
248
+
249
+ if attributes.key?(:'name')
250
+ self.name = attributes[:'name']
251
+ end
252
+
253
+ if attributes.key?(:'username')
254
+ self.username = attributes[:'username']
255
+ end
256
+
257
+ if attributes.key?(:'profanity')
258
+ self.profanity = attributes[:'profanity']
259
+ end
260
+
261
+ if attributes.key?(:'sensitive')
262
+ self.sensitive = attributes[:'sensitive']
263
+ end
264
+
265
+ if attributes.key?(:'wordlist')
266
+ self.wordlist = attributes[:'wordlist']
267
+ end
268
+
269
+ if attributes.key?(:'wordlists')
270
+ if (value = attributes[:'wordlists']).is_a?(Array)
271
+ self.wordlists = value
272
+ end
273
+ end
274
+ end
275
+
276
+ # Show invalid properties with the reasons. Usually used together with valid?
277
+ # @return Array for valid properties with the reasons
278
+ def list_invalid_properties
279
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
280
+ invalid_properties = Array.new
281
+ if @status.nil?
282
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
283
+ end
284
+
285
+ if @request.nil?
286
+ invalid_properties.push('invalid value for "request", request cannot be nil.')
287
+ end
288
+
289
+ if @flagged.nil?
290
+ invalid_properties.push('invalid value for "flagged", flagged cannot be nil.')
291
+ end
292
+
293
+ if @content_moderated.nil?
294
+ invalid_properties.push('invalid value for "content_moderated", content_moderated cannot be nil.')
295
+ end
296
+
297
+ if @unicode_spoofing.nil?
298
+ invalid_properties.push('invalid value for "unicode_spoofing", unicode_spoofing cannot be nil.')
299
+ end
300
+
301
+ if @data_found.nil?
302
+ invalid_properties.push('invalid value for "data_found", data_found cannot be nil.')
303
+ end
304
+
305
+ if @original.nil?
306
+ invalid_properties.push('invalid value for "original", original cannot be nil.')
307
+ end
308
+
309
+ if @content.nil?
310
+ invalid_properties.push('invalid value for "content", content cannot be nil.')
311
+ end
312
+
313
+ invalid_properties
314
+ end
315
+
316
+ # Check to see if the all the properties in the model are valid
317
+ # @return true if the model is valid
318
+ def valid?
319
+ warn '[DEPRECATED] the `valid?` method is obsolete'
320
+ return false if @status.nil?
321
+ return false if @request.nil?
322
+ return false if @flagged.nil?
323
+ return false if @content_moderated.nil?
324
+ return false if @unicode_spoofing.nil?
325
+ return false if @data_found.nil?
326
+ return false if @original.nil?
327
+ return false if @content.nil?
328
+ true
329
+ end
330
+
331
+ # Checks equality by comparing each attribute.
332
+ # @param [Object] Object to be compared
333
+ def ==(o)
334
+ return true if self.equal?(o)
335
+ self.class == o.class &&
336
+ status == o.status &&
337
+ request == o.request &&
338
+ flagged == o.flagged &&
339
+ content_moderated == o.content_moderated &&
340
+ unicode_spoofing == o.unicode_spoofing &&
341
+ data_found == o.data_found &&
342
+ original == o.original &&
343
+ content == o.content &&
344
+ content_id == o.content_id &&
345
+ nsfw == o.nsfw &&
346
+ toxicity == o.toxicity &&
347
+ quality == o.quality &&
348
+ sentiment == o.sentiment &&
349
+ propriety == o.propriety &&
350
+ email == o.email &&
351
+ phone == o.phone &&
352
+ url == o.url &&
353
+ address == o.address &&
354
+ name == o.name &&
355
+ username == o.username &&
356
+ profanity == o.profanity &&
357
+ sensitive == o.sensitive &&
358
+ wordlist == o.wordlist &&
359
+ wordlists == o.wordlists
360
+ end
361
+
362
+ # @see the `==` method
363
+ # @param [Object] Object to be compared
364
+ def eql?(o)
365
+ self == o
366
+ end
367
+
368
+ # Calculates hash code according to all attributes.
369
+ # @return [Integer] Hash code
370
+ def hash
371
+ [status, request, flagged, content_moderated, unicode_spoofing, data_found, original, content, content_id, nsfw, toxicity, quality, sentiment, propriety, email, phone, url, address, name, username, profanity, sensitive, wordlist, wordlists].hash
372
+ end
373
+
374
+ # Builds the object from hash
375
+ # @param [Hash] attributes Model attributes in the form of hash
376
+ # @return [Object] Returns the model itself
377
+ def self.build_from_hash(attributes)
378
+ return nil unless attributes.is_a?(Hash)
379
+ attributes = attributes.transform_keys(&:to_sym)
380
+ transformed_hash = {}
381
+ openapi_types.each_pair do |key, type|
382
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
383
+ transformed_hash["#{key}"] = nil
384
+ elsif type =~ /\AArray<(.*)>/i
385
+ # check to ensure the input is an array given that the attribute
386
+ # is documented as an array but the input is not
387
+ if attributes[attribute_map[key]].is_a?(Array)
388
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
389
+ end
390
+ elsif !attributes[attribute_map[key]].nil?
391
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
392
+ end
393
+ end
394
+ new(transformed_hash)
395
+ end
396
+
397
+ # Deserializes the data based on type
398
+ # @param string type Data type
399
+ # @param string value Value to be deserialized
400
+ # @return [Object] Deserialized data
401
+ def self._deserialize(type, value)
402
+ case type.to_sym
403
+ when :Time
404
+ Time.parse(value)
405
+ when :Date
406
+ Date.parse(value)
407
+ when :String
408
+ value.to_s
409
+ when :Integer
410
+ value.to_i
411
+ when :Float
412
+ value.to_f
413
+ when :Boolean
414
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
415
+ true
416
+ else
417
+ false
418
+ end
419
+ when :Object
420
+ # generic object (usually a Hash), return directly
421
+ value
422
+ when /\AArray<(?<inner_type>.+)>\z/
423
+ inner_type = Regexp.last_match[:inner_type]
424
+ value.map { |v| _deserialize(inner_type, v) }
425
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
426
+ k_type = Regexp.last_match[:k_type]
427
+ v_type = Regexp.last_match[:v_type]
428
+ {}.tap do |hash|
429
+ value.each do |k, v|
430
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
431
+ end
432
+ end
433
+ else # model
434
+ # models (e.g. Pet) or oneOf
435
+ klass = ModerationAPI.const_get(type)
436
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
437
+ end
438
+ end
439
+
440
+ # Returns the string representation of the object
441
+ # @return [String] String presentation of the object
442
+ def to_s
443
+ to_hash.to_s
444
+ end
445
+
446
+ # to_body is an alias to to_hash (backward compatibility)
447
+ # @return [Hash] Returns the object in the form of hash
448
+ def to_body
449
+ to_hash
450
+ end
451
+
452
+ # Returns the object in the form of hash
453
+ # @return [Hash] Returns the object in the form of hash
454
+ def to_hash
455
+ hash = {}
456
+ self.class.attribute_map.each_pair do |attr, param|
457
+ value = self.send(attr)
458
+ if value.nil?
459
+ is_nullable = self.class.openapi_nullable.include?(attr)
460
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
461
+ end
462
+
463
+ hash[param] = _to_hash(value)
464
+ end
465
+ hash
466
+ end
467
+
468
+ # Outputs non-array value in the form of hash
469
+ # For object, use to_hash. Otherwise, just return the value
470
+ # @param [Object] value Any valid value
471
+ # @return [Hash] Returns the value in the form of hash
472
+ def _to_hash(value)
473
+ if value.is_a?(Array)
474
+ value.compact.map { |v| _to_hash(v) }
475
+ elsif value.is_a?(Hash)
476
+ {}.tap do |hash|
477
+ value.each { |k, v| hash[k] = _to_hash(v) }
478
+ end
479
+ elsif value.respond_to? :to_hash
480
+ value.to_hash
481
+ else
482
+ value
483
+ end
484
+ end
485
+
486
+ end
487
+
488
+ end