cloudmersive-dlp-api-client 2.2.0 → 2.2.1

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 (80) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -8
  3. data/docs/AudioTimestamp.md +12 -0
  4. data/docs/CustomPiiField.md +9 -0
  5. data/docs/DetectApi.md +114 -2
  6. data/docs/DlpAdvancedAudioDetectionRequest.md +48 -0
  7. data/docs/DlpAdvancedAudioDetectionResponse.md +48 -0
  8. data/docs/DlpAdvancedAudioRedactionRequest.md +54 -0
  9. data/docs/DlpAdvancedAudioRedactionResponse.md +51 -0
  10. data/docs/DlpAdvancedDetectionRequest.md +4 -0
  11. data/docs/DlpAdvancedDetectionResponse.md +3 -0
  12. data/docs/DlpAdvancedDocumentDetectionRequest.md +6 -2
  13. data/docs/DlpAdvancedDocumentRedactionRequest.md +7 -2
  14. data/docs/DlpAdvancedDocumentRedactionResponse.md +3 -0
  15. data/docs/DlpAdvancedRedactionRequest.md +6 -1
  16. data/docs/DlpAdvancedRedactionResponse.md +3 -0
  17. data/docs/DlpAudioDetectionRequest.md +32 -0
  18. data/docs/DlpAudioDetectionResponse.md +33 -0
  19. data/docs/DlpAudioRedactionRequest.md +35 -0
  20. data/docs/DlpAudioRedactionResponse.md +36 -0
  21. data/docs/DlpBatchJobResult.md +9 -0
  22. data/docs/DlpBatchJobStatusResult.md +15 -0
  23. data/docs/DlpDocumentDetectionRequest.md +2 -2
  24. data/docs/DlpDocumentRedactionRequest.md +2 -2
  25. data/docs/DlpRedactionRequest.md +1 -1
  26. data/docs/RedactApi.md +114 -2
  27. data/docs/RedactedAudioSegment.md +10 -0
  28. data/docs/TasksBatchJobApi.md +288 -0
  29. data/lib/cloudmersive-dlp-api-client/api/detect_api.rb +104 -4
  30. data/lib/cloudmersive-dlp-api-client/api/redact_api.rb +104 -4
  31. data/lib/cloudmersive-dlp-api-client/api/tasks_batch_job_api.rb +272 -0
  32. data/lib/cloudmersive-dlp-api-client/models/audio_timestamp.rb +226 -0
  33. data/lib/cloudmersive-dlp-api-client/models/custom_pii_field.rb +196 -0
  34. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_audio_detection_request.rb +601 -0
  35. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_audio_detection_response.rb +588 -0
  36. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_audio_redaction_request.rb +663 -0
  37. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_audio_redaction_response.rb +635 -0
  38. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_detection_request.rb +44 -4
  39. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_detection_response.rb +31 -1
  40. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_document_detection_request.rb +46 -6
  41. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_document_redaction_request.rb +58 -6
  42. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_document_redaction_response.rb +31 -1
  43. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_redaction_request.rb +57 -5
  44. data/lib/cloudmersive-dlp-api-client/models/dlp_advanced_redaction_response.rb +31 -1
  45. data/lib/cloudmersive-dlp-api-client/models/dlp_audio_detection_request.rb +441 -0
  46. data/lib/cloudmersive-dlp-api-client/models/dlp_audio_detection_response.rb +438 -0
  47. data/lib/cloudmersive-dlp-api-client/models/dlp_audio_redaction_request.rb +471 -0
  48. data/lib/cloudmersive-dlp-api-client/models/dlp_audio_redaction_response.rb +485 -0
  49. data/lib/cloudmersive-dlp-api-client/models/dlp_batch_job_result.rb +196 -0
  50. data/lib/cloudmersive-dlp-api-client/models/dlp_batch_job_status_result.rb +252 -0
  51. data/lib/cloudmersive-dlp-api-client/models/dlp_document_detection_request.rb +2 -2
  52. data/lib/cloudmersive-dlp-api-client/models/dlp_document_redaction_request.rb +2 -2
  53. data/lib/cloudmersive-dlp-api-client/models/dlp_redaction_request.rb +1 -1
  54. data/lib/cloudmersive-dlp-api-client/models/redacted_audio_segment.rb +206 -0
  55. data/lib/cloudmersive-dlp-api-client/version.rb +1 -1
  56. data/lib/cloudmersive-dlp-api-client.rb +14 -0
  57. data/spec/api/detect_api_spec.rb +26 -2
  58. data/spec/api/redact_api_spec.rb +26 -2
  59. data/spec/api/tasks_batch_job_api_spec.rb +95 -0
  60. data/spec/models/audio_timestamp_spec.rb +65 -0
  61. data/spec/models/custom_pii_field_spec.rb +47 -0
  62. data/spec/models/dlp_advanced_audio_detection_request_spec.rb +281 -0
  63. data/spec/models/dlp_advanced_audio_detection_response_spec.rb +281 -0
  64. data/spec/models/dlp_advanced_audio_redaction_request_spec.rb +317 -0
  65. data/spec/models/dlp_advanced_audio_redaction_response_spec.rb +299 -0
  66. data/spec/models/dlp_advanced_detection_request_spec.rb +24 -0
  67. data/spec/models/dlp_advanced_detection_response_spec.rb +18 -0
  68. data/spec/models/dlp_advanced_document_detection_request_spec.rb +24 -0
  69. data/spec/models/dlp_advanced_document_redaction_request_spec.rb +30 -0
  70. data/spec/models/dlp_advanced_document_redaction_response_spec.rb +18 -0
  71. data/spec/models/dlp_advanced_redaction_request_spec.rb +30 -0
  72. data/spec/models/dlp_advanced_redaction_response_spec.rb +18 -0
  73. data/spec/models/dlp_audio_detection_request_spec.rb +185 -0
  74. data/spec/models/dlp_audio_detection_response_spec.rb +191 -0
  75. data/spec/models/dlp_audio_redaction_request_spec.rb +203 -0
  76. data/spec/models/dlp_audio_redaction_response_spec.rb +209 -0
  77. data/spec/models/dlp_batch_job_result_spec.rb +47 -0
  78. data/spec/models/dlp_batch_job_status_result_spec.rb +83 -0
  79. data/spec/models/redacted_audio_segment_spec.rb +53 -0
  80. metadata +44 -2
@@ -0,0 +1,441 @@
1
+ =begin
2
+ #dlpapi
3
+
4
+ #Easily and directly scan and detect sensitive data (PII) in input text.
5
+
6
+ OpenAPI spec version: v1
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.14
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module CloudmersiveDlpApiClient
16
+ # Request object for DLP audio detection with 23 PII detection types.
17
+ class DlpAudioDetectionRequest
18
+ # Audio file bytes (WAV, MP3, M4A, FLAC, OGG, or WMA) to transcribe and scan for PII and sensitive data.
19
+ attr_accessor :input_file
20
+
21
+ # Language code for speech recognition. Default is \"ENG\" (English).
22
+ attr_accessor :language_code
23
+
24
+ # Set to true to allow email addresses in the audio transcript and not flag them as PII.
25
+ attr_accessor :allow_email_address
26
+
27
+ # Set to true to allow phone numbers in the audio transcript and not flag them as PII.
28
+ attr_accessor :allow_phone_number
29
+
30
+ # Set to true to allow street addresses in the audio transcript and not flag them as PII.
31
+ attr_accessor :allow_street_address
32
+
33
+ # Set to true to allow person names in the audio transcript and not flag them as PII.
34
+ attr_accessor :allow_person_name
35
+
36
+ # Set to true to allow birth dates in the audio transcript and not flag them as PII.
37
+ attr_accessor :allow_birth_date
38
+
39
+ # Set to true to allow passport numbers in the audio transcript and not flag them as PII.
40
+ attr_accessor :allow_passport_number
41
+
42
+ # Set to true to allow drivers license numbers in the audio transcript and not flag them as PII.
43
+ attr_accessor :allow_drivers_license
44
+
45
+ # Set to true to allow social security numbers in the audio transcript and not flag them as PII.
46
+ attr_accessor :allow_social_security_number
47
+
48
+ # Set to true to allow taxpayer IDs in the audio transcript and not flag them as PII.
49
+ attr_accessor :allow_taxpayer_id
50
+
51
+ # Set to true to allow credit card numbers in the audio transcript and not flag them as PII.
52
+ attr_accessor :allow_credit_card_number
53
+
54
+ # Set to true to allow credit card expiration dates in the audio transcript and not flag them as PII.
55
+ attr_accessor :allow_credit_card_expiration_date
56
+
57
+ # Set to true to allow credit card verification codes in the audio transcript and not flag them as PII.
58
+ attr_accessor :allow_credit_card_verification_code
59
+
60
+ # Set to true to allow bank account numbers in the audio transcript and not flag them as PII.
61
+ attr_accessor :allow_bank_account_number
62
+
63
+ # Set to true to allow IBANs in the audio transcript and not flag them as PII.
64
+ attr_accessor :allow_iban
65
+
66
+ # Set to true to allow health insurance numbers in the audio transcript and not flag them as PII.
67
+ attr_accessor :allow_health_insurance_number
68
+
69
+ # Set to true to allow bearer tokens in the audio transcript and not flag them as PII.
70
+ attr_accessor :allow_bearer_token
71
+
72
+ # Set to true to allow HTTP cookies in the audio transcript and not flag them as PII.
73
+ attr_accessor :allow_http_cookie
74
+
75
+ # Set to true to allow private keys in the audio transcript and not flag them as PII.
76
+ attr_accessor :allow_private_keys
77
+
78
+ # Set to true to allow credentials (usernames/passwords) in the audio transcript and not flag them as PII.
79
+ attr_accessor :allow_credentials
80
+
81
+ # Set to true to allow deep web URLs (.onion) in the audio transcript and not flag them as PII.
82
+ attr_accessor :allow_deep_web_urls
83
+
84
+ # Set to true to allow source code in the audio transcript and not flag it as sensitive data.
85
+ attr_accessor :allow_source_code
86
+
87
+ # Set to true to allow IP addresses in the audio transcript and not flag them as PII.
88
+ attr_accessor :allow_ip_address
89
+
90
+ # Set to true to allow MAC addresses in the audio transcript and not flag them as PII.
91
+ attr_accessor :allow_mac_address
92
+
93
+ # Attribute mapping from ruby-style variable name to JSON key.
94
+ def self.attribute_map
95
+ {
96
+ :'input_file' => :'InputFile',
97
+ :'language_code' => :'LanguageCode',
98
+ :'allow_email_address' => :'AllowEmailAddress',
99
+ :'allow_phone_number' => :'AllowPhoneNumber',
100
+ :'allow_street_address' => :'AllowStreetAddress',
101
+ :'allow_person_name' => :'AllowPersonName',
102
+ :'allow_birth_date' => :'AllowBirthDate',
103
+ :'allow_passport_number' => :'AllowPassportNumber',
104
+ :'allow_drivers_license' => :'AllowDriversLicense',
105
+ :'allow_social_security_number' => :'AllowSocialSecurityNumber',
106
+ :'allow_taxpayer_id' => :'AllowTaxpayerID',
107
+ :'allow_credit_card_number' => :'AllowCreditCardNumber',
108
+ :'allow_credit_card_expiration_date' => :'AllowCreditCardExpirationDate',
109
+ :'allow_credit_card_verification_code' => :'AllowCreditCardVerificationCode',
110
+ :'allow_bank_account_number' => :'AllowBankAccountNumber',
111
+ :'allow_iban' => :'AllowIBAN',
112
+ :'allow_health_insurance_number' => :'AllowHealthInsuranceNumber',
113
+ :'allow_bearer_token' => :'AllowBearerToken',
114
+ :'allow_http_cookie' => :'AllowHttpCookie',
115
+ :'allow_private_keys' => :'AllowPrivateKeys',
116
+ :'allow_credentials' => :'AllowCredentials',
117
+ :'allow_deep_web_urls' => :'AllowDeepWebUrls',
118
+ :'allow_source_code' => :'AllowSourceCode',
119
+ :'allow_ip_address' => :'AllowIpAddress',
120
+ :'allow_mac_address' => :'AllowMacAddress'
121
+ }
122
+ end
123
+
124
+ # Attribute type mapping.
125
+ def self.swagger_types
126
+ {
127
+ :'input_file' => :'String',
128
+ :'language_code' => :'String',
129
+ :'allow_email_address' => :'BOOLEAN',
130
+ :'allow_phone_number' => :'BOOLEAN',
131
+ :'allow_street_address' => :'BOOLEAN',
132
+ :'allow_person_name' => :'BOOLEAN',
133
+ :'allow_birth_date' => :'BOOLEAN',
134
+ :'allow_passport_number' => :'BOOLEAN',
135
+ :'allow_drivers_license' => :'BOOLEAN',
136
+ :'allow_social_security_number' => :'BOOLEAN',
137
+ :'allow_taxpayer_id' => :'BOOLEAN',
138
+ :'allow_credit_card_number' => :'BOOLEAN',
139
+ :'allow_credit_card_expiration_date' => :'BOOLEAN',
140
+ :'allow_credit_card_verification_code' => :'BOOLEAN',
141
+ :'allow_bank_account_number' => :'BOOLEAN',
142
+ :'allow_iban' => :'BOOLEAN',
143
+ :'allow_health_insurance_number' => :'BOOLEAN',
144
+ :'allow_bearer_token' => :'BOOLEAN',
145
+ :'allow_http_cookie' => :'BOOLEAN',
146
+ :'allow_private_keys' => :'BOOLEAN',
147
+ :'allow_credentials' => :'BOOLEAN',
148
+ :'allow_deep_web_urls' => :'BOOLEAN',
149
+ :'allow_source_code' => :'BOOLEAN',
150
+ :'allow_ip_address' => :'BOOLEAN',
151
+ :'allow_mac_address' => :'BOOLEAN'
152
+ }
153
+ end
154
+
155
+ # Initializes the object
156
+ # @param [Hash] attributes Model attributes in the form of hash
157
+ def initialize(attributes = {})
158
+ return unless attributes.is_a?(Hash)
159
+
160
+ # convert string to symbol for hash key
161
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
162
+
163
+ if attributes.has_key?(:'InputFile')
164
+ self.input_file = attributes[:'InputFile']
165
+ end
166
+
167
+ if attributes.has_key?(:'LanguageCode')
168
+ self.language_code = attributes[:'LanguageCode']
169
+ end
170
+
171
+ if attributes.has_key?(:'AllowEmailAddress')
172
+ self.allow_email_address = attributes[:'AllowEmailAddress']
173
+ end
174
+
175
+ if attributes.has_key?(:'AllowPhoneNumber')
176
+ self.allow_phone_number = attributes[:'AllowPhoneNumber']
177
+ end
178
+
179
+ if attributes.has_key?(:'AllowStreetAddress')
180
+ self.allow_street_address = attributes[:'AllowStreetAddress']
181
+ end
182
+
183
+ if attributes.has_key?(:'AllowPersonName')
184
+ self.allow_person_name = attributes[:'AllowPersonName']
185
+ end
186
+
187
+ if attributes.has_key?(:'AllowBirthDate')
188
+ self.allow_birth_date = attributes[:'AllowBirthDate']
189
+ end
190
+
191
+ if attributes.has_key?(:'AllowPassportNumber')
192
+ self.allow_passport_number = attributes[:'AllowPassportNumber']
193
+ end
194
+
195
+ if attributes.has_key?(:'AllowDriversLicense')
196
+ self.allow_drivers_license = attributes[:'AllowDriversLicense']
197
+ end
198
+
199
+ if attributes.has_key?(:'AllowSocialSecurityNumber')
200
+ self.allow_social_security_number = attributes[:'AllowSocialSecurityNumber']
201
+ end
202
+
203
+ if attributes.has_key?(:'AllowTaxpayerID')
204
+ self.allow_taxpayer_id = attributes[:'AllowTaxpayerID']
205
+ end
206
+
207
+ if attributes.has_key?(:'AllowCreditCardNumber')
208
+ self.allow_credit_card_number = attributes[:'AllowCreditCardNumber']
209
+ end
210
+
211
+ if attributes.has_key?(:'AllowCreditCardExpirationDate')
212
+ self.allow_credit_card_expiration_date = attributes[:'AllowCreditCardExpirationDate']
213
+ end
214
+
215
+ if attributes.has_key?(:'AllowCreditCardVerificationCode')
216
+ self.allow_credit_card_verification_code = attributes[:'AllowCreditCardVerificationCode']
217
+ end
218
+
219
+ if attributes.has_key?(:'AllowBankAccountNumber')
220
+ self.allow_bank_account_number = attributes[:'AllowBankAccountNumber']
221
+ end
222
+
223
+ if attributes.has_key?(:'AllowIBAN')
224
+ self.allow_iban = attributes[:'AllowIBAN']
225
+ end
226
+
227
+ if attributes.has_key?(:'AllowHealthInsuranceNumber')
228
+ self.allow_health_insurance_number = attributes[:'AllowHealthInsuranceNumber']
229
+ end
230
+
231
+ if attributes.has_key?(:'AllowBearerToken')
232
+ self.allow_bearer_token = attributes[:'AllowBearerToken']
233
+ end
234
+
235
+ if attributes.has_key?(:'AllowHttpCookie')
236
+ self.allow_http_cookie = attributes[:'AllowHttpCookie']
237
+ end
238
+
239
+ if attributes.has_key?(:'AllowPrivateKeys')
240
+ self.allow_private_keys = attributes[:'AllowPrivateKeys']
241
+ end
242
+
243
+ if attributes.has_key?(:'AllowCredentials')
244
+ self.allow_credentials = attributes[:'AllowCredentials']
245
+ end
246
+
247
+ if attributes.has_key?(:'AllowDeepWebUrls')
248
+ self.allow_deep_web_urls = attributes[:'AllowDeepWebUrls']
249
+ end
250
+
251
+ if attributes.has_key?(:'AllowSourceCode')
252
+ self.allow_source_code = attributes[:'AllowSourceCode']
253
+ end
254
+
255
+ if attributes.has_key?(:'AllowIpAddress')
256
+ self.allow_ip_address = attributes[:'AllowIpAddress']
257
+ end
258
+
259
+ if attributes.has_key?(:'AllowMacAddress')
260
+ self.allow_mac_address = attributes[:'AllowMacAddress']
261
+ end
262
+ end
263
+
264
+ # Show invalid properties with the reasons. Usually used together with valid?
265
+ # @return Array for valid properties with the reasons
266
+ def list_invalid_properties
267
+ invalid_properties = Array.new
268
+ if !@input_file.nil? && @input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
269
+ invalid_properties.push('invalid value for "input_file", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.')
270
+ end
271
+
272
+ invalid_properties
273
+ end
274
+
275
+ # Check to see if the all the properties in the model are valid
276
+ # @return true if the model is valid
277
+ def valid?
278
+ return false if !@input_file.nil? && @input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
279
+ true
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] input_file Value to be assigned
284
+ def input_file=(input_file)
285
+ if !input_file.nil? && input_file !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
286
+ fail ArgumentError, 'invalid value for "input_file", must conform to the pattern /^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.'
287
+ end
288
+
289
+ @input_file = input_file
290
+ end
291
+
292
+ # Checks equality by comparing each attribute.
293
+ # @param [Object] Object to be compared
294
+ def ==(o)
295
+ return true if self.equal?(o)
296
+ self.class == o.class &&
297
+ input_file == o.input_file &&
298
+ language_code == o.language_code &&
299
+ allow_email_address == o.allow_email_address &&
300
+ allow_phone_number == o.allow_phone_number &&
301
+ allow_street_address == o.allow_street_address &&
302
+ allow_person_name == o.allow_person_name &&
303
+ allow_birth_date == o.allow_birth_date &&
304
+ allow_passport_number == o.allow_passport_number &&
305
+ allow_drivers_license == o.allow_drivers_license &&
306
+ allow_social_security_number == o.allow_social_security_number &&
307
+ allow_taxpayer_id == o.allow_taxpayer_id &&
308
+ allow_credit_card_number == o.allow_credit_card_number &&
309
+ allow_credit_card_expiration_date == o.allow_credit_card_expiration_date &&
310
+ allow_credit_card_verification_code == o.allow_credit_card_verification_code &&
311
+ allow_bank_account_number == o.allow_bank_account_number &&
312
+ allow_iban == o.allow_iban &&
313
+ allow_health_insurance_number == o.allow_health_insurance_number &&
314
+ allow_bearer_token == o.allow_bearer_token &&
315
+ allow_http_cookie == o.allow_http_cookie &&
316
+ allow_private_keys == o.allow_private_keys &&
317
+ allow_credentials == o.allow_credentials &&
318
+ allow_deep_web_urls == o.allow_deep_web_urls &&
319
+ allow_source_code == o.allow_source_code &&
320
+ allow_ip_address == o.allow_ip_address &&
321
+ allow_mac_address == o.allow_mac_address
322
+ end
323
+
324
+ # @see the `==` method
325
+ # @param [Object] Object to be compared
326
+ def eql?(o)
327
+ self == o
328
+ end
329
+
330
+ # Calculates hash code according to all attributes.
331
+ # @return [Fixnum] Hash code
332
+ def hash
333
+ [input_file, language_code, allow_email_address, allow_phone_number, allow_street_address, allow_person_name, allow_birth_date, allow_passport_number, allow_drivers_license, allow_social_security_number, allow_taxpayer_id, allow_credit_card_number, allow_credit_card_expiration_date, allow_credit_card_verification_code, allow_bank_account_number, allow_iban, allow_health_insurance_number, allow_bearer_token, allow_http_cookie, allow_private_keys, allow_credentials, allow_deep_web_urls, allow_source_code, allow_ip_address, allow_mac_address].hash
334
+ end
335
+
336
+ # Builds the object from hash
337
+ # @param [Hash] attributes Model attributes in the form of hash
338
+ # @return [Object] Returns the model itself
339
+ def build_from_hash(attributes)
340
+ return nil unless attributes.is_a?(Hash)
341
+ self.class.swagger_types.each_pair do |key, type|
342
+ if type =~ /\AArray<(.*)>/i
343
+ # check to ensure the input is an array given that the attribute
344
+ # is documented as an array but the input is not
345
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
346
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
347
+ end
348
+ elsif !attributes[self.class.attribute_map[key]].nil?
349
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
350
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
351
+ end
352
+
353
+ self
354
+ end
355
+
356
+ # Deserializes the data based on type
357
+ # @param string type Data type
358
+ # @param string value Value to be deserialized
359
+ # @return [Object] Deserialized data
360
+ def _deserialize(type, value)
361
+ case type.to_sym
362
+ when :DateTime
363
+ DateTime.parse(value)
364
+ when :Date
365
+ Date.parse(value)
366
+ when :String
367
+ value.to_s
368
+ when :Integer
369
+ value.to_i
370
+ when :Float
371
+ value.to_f
372
+ when :BOOLEAN
373
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
374
+ true
375
+ else
376
+ false
377
+ end
378
+ when :Object
379
+ # generic object (usually a Hash), return directly
380
+ value
381
+ when /\AArray<(?<inner_type>.+)>\z/
382
+ inner_type = Regexp.last_match[:inner_type]
383
+ value.map { |v| _deserialize(inner_type, v) }
384
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
385
+ k_type = Regexp.last_match[:k_type]
386
+ v_type = Regexp.last_match[:v_type]
387
+ {}.tap do |hash|
388
+ value.each do |k, v|
389
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
390
+ end
391
+ end
392
+ else # model
393
+ temp_model = CloudmersiveDlpApiClient.const_get(type).new
394
+ temp_model.build_from_hash(value)
395
+ end
396
+ end
397
+
398
+ # Returns the string representation of the object
399
+ # @return [String] String presentation of the object
400
+ def to_s
401
+ to_hash.to_s
402
+ end
403
+
404
+ # to_body is an alias to to_hash (backward compatibility)
405
+ # @return [Hash] Returns the object in the form of hash
406
+ def to_body
407
+ to_hash
408
+ end
409
+
410
+ # Returns the object in the form of hash
411
+ # @return [Hash] Returns the object in the form of hash
412
+ def to_hash
413
+ hash = {}
414
+ self.class.attribute_map.each_pair do |attr, param|
415
+ value = self.send(attr)
416
+ next if value.nil?
417
+ hash[param] = _to_hash(value)
418
+ end
419
+ hash
420
+ end
421
+
422
+ # Outputs non-array value in the form of hash
423
+ # For object, use to_hash. Otherwise, just return the value
424
+ # @param [Object] value Any valid value
425
+ # @return [Hash] Returns the value in the form of hash
426
+ def _to_hash(value)
427
+ if value.is_a?(Array)
428
+ value.compact.map { |v| _to_hash(v) }
429
+ elsif value.is_a?(Hash)
430
+ {}.tap do |hash|
431
+ value.each { |k, v| hash[k] = _to_hash(v) }
432
+ end
433
+ elsif value.respond_to? :to_hash
434
+ value.to_hash
435
+ else
436
+ value
437
+ end
438
+ end
439
+
440
+ end
441
+ end