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