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,438 @@
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
+ # Response object for DLP audio detection with 23 PII detection types, transcript, and timestamps.
17
+ class DlpAudioDetectionResponse
18
+ # True if no disallowed PII or sensitive data types were detected; false if any disallowed type was found.
19
+ attr_accessor :clean_result
20
+
21
+ # Full transcript of the audio file.
22
+ attr_accessor :transcript
23
+
24
+ # Token-level timestamps from speech recognition.
25
+ attr_accessor :timestamps
26
+
27
+ # True if the audio transcript contains email addresses.
28
+ attr_accessor :contains_email_address
29
+
30
+ # True if the audio transcript contains phone numbers.
31
+ attr_accessor :contains_phone_number
32
+
33
+ # True if the audio transcript contains street addresses.
34
+ attr_accessor :contains_street_address
35
+
36
+ # True if the audio transcript contains person names.
37
+ attr_accessor :contains_person_name
38
+
39
+ # True if the audio transcript contains birth dates.
40
+ attr_accessor :contains_birth_date
41
+
42
+ # True if the audio transcript contains passport numbers.
43
+ attr_accessor :contains_passport_number
44
+
45
+ # True if the audio transcript contains drivers license numbers.
46
+ attr_accessor :contains_drivers_license
47
+
48
+ # True if the audio transcript contains social security numbers.
49
+ attr_accessor :contains_social_security_number
50
+
51
+ # True if the audio transcript contains taxpayer IDs.
52
+ attr_accessor :contains_taxpayer_id
53
+
54
+ # True if the audio transcript contains credit card numbers.
55
+ attr_accessor :contains_credit_card_number
56
+
57
+ # True if the audio transcript contains credit card expiration dates.
58
+ attr_accessor :contains_credit_card_expiration_date
59
+
60
+ # True if the audio transcript contains credit card verification codes.
61
+ attr_accessor :contains_credit_card_verification_code
62
+
63
+ # True if the audio transcript contains bank account numbers.
64
+ attr_accessor :contains_bank_account_number
65
+
66
+ # True if the audio transcript contains IBANs.
67
+ attr_accessor :contains_iban
68
+
69
+ # True if the audio transcript contains health insurance numbers.
70
+ attr_accessor :contains_health_insurance_number
71
+
72
+ # True if the audio transcript contains bearer tokens.
73
+ attr_accessor :contains_bearer_token
74
+
75
+ # True if the audio transcript contains HTTP cookies.
76
+ attr_accessor :contains_http_cookie
77
+
78
+ # True if the audio transcript contains private keys.
79
+ attr_accessor :contains_private_keys
80
+
81
+ # True if the audio transcript contains credentials (usernames/passwords).
82
+ attr_accessor :contains_credentials
83
+
84
+ # True if the audio transcript contains deep web URLs (.onion).
85
+ attr_accessor :contains_deep_web_urls
86
+
87
+ # True if the audio transcript contains source code.
88
+ attr_accessor :contains_source_code
89
+
90
+ # True if the audio transcript contains IP addresses.
91
+ attr_accessor :contains_ip_address
92
+
93
+ # True if the audio transcript contains MAC addresses.
94
+ attr_accessor :contains_mac_address
95
+
96
+ # Attribute mapping from ruby-style variable name to JSON key.
97
+ def self.attribute_map
98
+ {
99
+ :'clean_result' => :'CleanResult',
100
+ :'transcript' => :'Transcript',
101
+ :'timestamps' => :'Timestamps',
102
+ :'contains_email_address' => :'ContainsEmailAddress',
103
+ :'contains_phone_number' => :'ContainsPhoneNumber',
104
+ :'contains_street_address' => :'ContainsStreetAddress',
105
+ :'contains_person_name' => :'ContainsPersonName',
106
+ :'contains_birth_date' => :'ContainsBirthDate',
107
+ :'contains_passport_number' => :'ContainsPassportNumber',
108
+ :'contains_drivers_license' => :'ContainsDriversLicense',
109
+ :'contains_social_security_number' => :'ContainsSocialSecurityNumber',
110
+ :'contains_taxpayer_id' => :'ContainsTaxpayerID',
111
+ :'contains_credit_card_number' => :'ContainsCreditCardNumber',
112
+ :'contains_credit_card_expiration_date' => :'ContainsCreditCardExpirationDate',
113
+ :'contains_credit_card_verification_code' => :'ContainsCreditCardVerificationCode',
114
+ :'contains_bank_account_number' => :'ContainsBankAccountNumber',
115
+ :'contains_iban' => :'ContainsIBAN',
116
+ :'contains_health_insurance_number' => :'ContainsHealthInsuranceNumber',
117
+ :'contains_bearer_token' => :'ContainsBearerToken',
118
+ :'contains_http_cookie' => :'ContainsHttpCookie',
119
+ :'contains_private_keys' => :'ContainsPrivateKeys',
120
+ :'contains_credentials' => :'ContainsCredentials',
121
+ :'contains_deep_web_urls' => :'ContainsDeepWebUrls',
122
+ :'contains_source_code' => :'ContainsSourceCode',
123
+ :'contains_ip_address' => :'ContainsIpAddress',
124
+ :'contains_mac_address' => :'ContainsMacAddress'
125
+ }
126
+ end
127
+
128
+ # Attribute type mapping.
129
+ def self.swagger_types
130
+ {
131
+ :'clean_result' => :'BOOLEAN',
132
+ :'transcript' => :'String',
133
+ :'timestamps' => :'Array<AudioTimestamp>',
134
+ :'contains_email_address' => :'BOOLEAN',
135
+ :'contains_phone_number' => :'BOOLEAN',
136
+ :'contains_street_address' => :'BOOLEAN',
137
+ :'contains_person_name' => :'BOOLEAN',
138
+ :'contains_birth_date' => :'BOOLEAN',
139
+ :'contains_passport_number' => :'BOOLEAN',
140
+ :'contains_drivers_license' => :'BOOLEAN',
141
+ :'contains_social_security_number' => :'BOOLEAN',
142
+ :'contains_taxpayer_id' => :'BOOLEAN',
143
+ :'contains_credit_card_number' => :'BOOLEAN',
144
+ :'contains_credit_card_expiration_date' => :'BOOLEAN',
145
+ :'contains_credit_card_verification_code' => :'BOOLEAN',
146
+ :'contains_bank_account_number' => :'BOOLEAN',
147
+ :'contains_iban' => :'BOOLEAN',
148
+ :'contains_health_insurance_number' => :'BOOLEAN',
149
+ :'contains_bearer_token' => :'BOOLEAN',
150
+ :'contains_http_cookie' => :'BOOLEAN',
151
+ :'contains_private_keys' => :'BOOLEAN',
152
+ :'contains_credentials' => :'BOOLEAN',
153
+ :'contains_deep_web_urls' => :'BOOLEAN',
154
+ :'contains_source_code' => :'BOOLEAN',
155
+ :'contains_ip_address' => :'BOOLEAN',
156
+ :'contains_mac_address' => :'BOOLEAN'
157
+ }
158
+ end
159
+
160
+ # Initializes the object
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ def initialize(attributes = {})
163
+ return unless attributes.is_a?(Hash)
164
+
165
+ # convert string to symbol for hash key
166
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
167
+
168
+ if attributes.has_key?(:'CleanResult')
169
+ self.clean_result = attributes[:'CleanResult']
170
+ end
171
+
172
+ if attributes.has_key?(:'Transcript')
173
+ self.transcript = attributes[:'Transcript']
174
+ end
175
+
176
+ if attributes.has_key?(:'Timestamps')
177
+ if (value = attributes[:'Timestamps']).is_a?(Array)
178
+ self.timestamps = value
179
+ end
180
+ end
181
+
182
+ if attributes.has_key?(:'ContainsEmailAddress')
183
+ self.contains_email_address = attributes[:'ContainsEmailAddress']
184
+ end
185
+
186
+ if attributes.has_key?(:'ContainsPhoneNumber')
187
+ self.contains_phone_number = attributes[:'ContainsPhoneNumber']
188
+ end
189
+
190
+ if attributes.has_key?(:'ContainsStreetAddress')
191
+ self.contains_street_address = attributes[:'ContainsStreetAddress']
192
+ end
193
+
194
+ if attributes.has_key?(:'ContainsPersonName')
195
+ self.contains_person_name = attributes[:'ContainsPersonName']
196
+ end
197
+
198
+ if attributes.has_key?(:'ContainsBirthDate')
199
+ self.contains_birth_date = attributes[:'ContainsBirthDate']
200
+ end
201
+
202
+ if attributes.has_key?(:'ContainsPassportNumber')
203
+ self.contains_passport_number = attributes[:'ContainsPassportNumber']
204
+ end
205
+
206
+ if attributes.has_key?(:'ContainsDriversLicense')
207
+ self.contains_drivers_license = attributes[:'ContainsDriversLicense']
208
+ end
209
+
210
+ if attributes.has_key?(:'ContainsSocialSecurityNumber')
211
+ self.contains_social_security_number = attributes[:'ContainsSocialSecurityNumber']
212
+ end
213
+
214
+ if attributes.has_key?(:'ContainsTaxpayerID')
215
+ self.contains_taxpayer_id = attributes[:'ContainsTaxpayerID']
216
+ end
217
+
218
+ if attributes.has_key?(:'ContainsCreditCardNumber')
219
+ self.contains_credit_card_number = attributes[:'ContainsCreditCardNumber']
220
+ end
221
+
222
+ if attributes.has_key?(:'ContainsCreditCardExpirationDate')
223
+ self.contains_credit_card_expiration_date = attributes[:'ContainsCreditCardExpirationDate']
224
+ end
225
+
226
+ if attributes.has_key?(:'ContainsCreditCardVerificationCode')
227
+ self.contains_credit_card_verification_code = attributes[:'ContainsCreditCardVerificationCode']
228
+ end
229
+
230
+ if attributes.has_key?(:'ContainsBankAccountNumber')
231
+ self.contains_bank_account_number = attributes[:'ContainsBankAccountNumber']
232
+ end
233
+
234
+ if attributes.has_key?(:'ContainsIBAN')
235
+ self.contains_iban = attributes[:'ContainsIBAN']
236
+ end
237
+
238
+ if attributes.has_key?(:'ContainsHealthInsuranceNumber')
239
+ self.contains_health_insurance_number = attributes[:'ContainsHealthInsuranceNumber']
240
+ end
241
+
242
+ if attributes.has_key?(:'ContainsBearerToken')
243
+ self.contains_bearer_token = attributes[:'ContainsBearerToken']
244
+ end
245
+
246
+ if attributes.has_key?(:'ContainsHttpCookie')
247
+ self.contains_http_cookie = attributes[:'ContainsHttpCookie']
248
+ end
249
+
250
+ if attributes.has_key?(:'ContainsPrivateKeys')
251
+ self.contains_private_keys = attributes[:'ContainsPrivateKeys']
252
+ end
253
+
254
+ if attributes.has_key?(:'ContainsCredentials')
255
+ self.contains_credentials = attributes[:'ContainsCredentials']
256
+ end
257
+
258
+ if attributes.has_key?(:'ContainsDeepWebUrls')
259
+ self.contains_deep_web_urls = attributes[:'ContainsDeepWebUrls']
260
+ end
261
+
262
+ if attributes.has_key?(:'ContainsSourceCode')
263
+ self.contains_source_code = attributes[:'ContainsSourceCode']
264
+ end
265
+
266
+ if attributes.has_key?(:'ContainsIpAddress')
267
+ self.contains_ip_address = attributes[:'ContainsIpAddress']
268
+ end
269
+
270
+ if attributes.has_key?(:'ContainsMacAddress')
271
+ self.contains_mac_address = attributes[:'ContainsMacAddress']
272
+ end
273
+ end
274
+
275
+ # Show invalid properties with the reasons. Usually used together with valid?
276
+ # @return Array for valid properties with the reasons
277
+ def list_invalid_properties
278
+ invalid_properties = Array.new
279
+ invalid_properties
280
+ end
281
+
282
+ # Check to see if the all the properties in the model are valid
283
+ # @return true if the model is valid
284
+ def valid?
285
+ true
286
+ end
287
+
288
+ # Checks equality by comparing each attribute.
289
+ # @param [Object] Object to be compared
290
+ def ==(o)
291
+ return true if self.equal?(o)
292
+ self.class == o.class &&
293
+ clean_result == o.clean_result &&
294
+ transcript == o.transcript &&
295
+ timestamps == o.timestamps &&
296
+ contains_email_address == o.contains_email_address &&
297
+ contains_phone_number == o.contains_phone_number &&
298
+ contains_street_address == o.contains_street_address &&
299
+ contains_person_name == o.contains_person_name &&
300
+ contains_birth_date == o.contains_birth_date &&
301
+ contains_passport_number == o.contains_passport_number &&
302
+ contains_drivers_license == o.contains_drivers_license &&
303
+ contains_social_security_number == o.contains_social_security_number &&
304
+ contains_taxpayer_id == o.contains_taxpayer_id &&
305
+ contains_credit_card_number == o.contains_credit_card_number &&
306
+ contains_credit_card_expiration_date == o.contains_credit_card_expiration_date &&
307
+ contains_credit_card_verification_code == o.contains_credit_card_verification_code &&
308
+ contains_bank_account_number == o.contains_bank_account_number &&
309
+ contains_iban == o.contains_iban &&
310
+ contains_health_insurance_number == o.contains_health_insurance_number &&
311
+ contains_bearer_token == o.contains_bearer_token &&
312
+ contains_http_cookie == o.contains_http_cookie &&
313
+ contains_private_keys == o.contains_private_keys &&
314
+ contains_credentials == o.contains_credentials &&
315
+ contains_deep_web_urls == o.contains_deep_web_urls &&
316
+ contains_source_code == o.contains_source_code &&
317
+ contains_ip_address == o.contains_ip_address &&
318
+ contains_mac_address == o.contains_mac_address
319
+ end
320
+
321
+ # @see the `==` method
322
+ # @param [Object] Object to be compared
323
+ def eql?(o)
324
+ self == o
325
+ end
326
+
327
+ # Calculates hash code according to all attributes.
328
+ # @return [Fixnum] Hash code
329
+ def hash
330
+ [clean_result, transcript, timestamps, contains_email_address, contains_phone_number, contains_street_address, contains_person_name, contains_birth_date, contains_passport_number, contains_drivers_license, contains_social_security_number, contains_taxpayer_id, contains_credit_card_number, contains_credit_card_expiration_date, contains_credit_card_verification_code, contains_bank_account_number, contains_iban, contains_health_insurance_number, contains_bearer_token, contains_http_cookie, contains_private_keys, contains_credentials, contains_deep_web_urls, contains_source_code, contains_ip_address, contains_mac_address].hash
331
+ end
332
+
333
+ # Builds the object from hash
334
+ # @param [Hash] attributes Model attributes in the form of hash
335
+ # @return [Object] Returns the model itself
336
+ def build_from_hash(attributes)
337
+ return nil unless attributes.is_a?(Hash)
338
+ self.class.swagger_types.each_pair do |key, type|
339
+ if type =~ /\AArray<(.*)>/i
340
+ # check to ensure the input is an array given that the attribute
341
+ # is documented as an array but the input is not
342
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
343
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
344
+ end
345
+ elsif !attributes[self.class.attribute_map[key]].nil?
346
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
347
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
348
+ end
349
+
350
+ self
351
+ end
352
+
353
+ # Deserializes the data based on type
354
+ # @param string type Data type
355
+ # @param string value Value to be deserialized
356
+ # @return [Object] Deserialized data
357
+ def _deserialize(type, value)
358
+ case type.to_sym
359
+ when :DateTime
360
+ DateTime.parse(value)
361
+ when :Date
362
+ Date.parse(value)
363
+ when :String
364
+ value.to_s
365
+ when :Integer
366
+ value.to_i
367
+ when :Float
368
+ value.to_f
369
+ when :BOOLEAN
370
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
371
+ true
372
+ else
373
+ false
374
+ end
375
+ when :Object
376
+ # generic object (usually a Hash), return directly
377
+ value
378
+ when /\AArray<(?<inner_type>.+)>\z/
379
+ inner_type = Regexp.last_match[:inner_type]
380
+ value.map { |v| _deserialize(inner_type, v) }
381
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
382
+ k_type = Regexp.last_match[:k_type]
383
+ v_type = Regexp.last_match[:v_type]
384
+ {}.tap do |hash|
385
+ value.each do |k, v|
386
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
387
+ end
388
+ end
389
+ else # model
390
+ temp_model = CloudmersiveDlpApiClient.const_get(type).new
391
+ temp_model.build_from_hash(value)
392
+ end
393
+ end
394
+
395
+ # Returns the string representation of the object
396
+ # @return [String] String presentation of the object
397
+ def to_s
398
+ to_hash.to_s
399
+ end
400
+
401
+ # to_body is an alias to to_hash (backward compatibility)
402
+ # @return [Hash] Returns the object in the form of hash
403
+ def to_body
404
+ to_hash
405
+ end
406
+
407
+ # Returns the object in the form of hash
408
+ # @return [Hash] Returns the object in the form of hash
409
+ def to_hash
410
+ hash = {}
411
+ self.class.attribute_map.each_pair do |attr, param|
412
+ value = self.send(attr)
413
+ next if value.nil?
414
+ hash[param] = _to_hash(value)
415
+ end
416
+ hash
417
+ end
418
+
419
+ # Outputs non-array value in the form of hash
420
+ # For object, use to_hash. Otherwise, just return the value
421
+ # @param [Object] value Any valid value
422
+ # @return [Hash] Returns the value in the form of hash
423
+ def _to_hash(value)
424
+ if value.is_a?(Array)
425
+ value.compact.map { |v| _to_hash(v) }
426
+ elsif value.is_a?(Hash)
427
+ {}.tap do |hash|
428
+ value.each { |k, v| hash[k] = _to_hash(v) }
429
+ end
430
+ elsif value.respond_to? :to_hash
431
+ value.to_hash
432
+ else
433
+ value
434
+ end
435
+ end
436
+
437
+ end
438
+ end