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,272 @@
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 'uri'
14
+
15
+ module CloudmersiveDlpApiClient
16
+ class TasksBatchJobApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Detect User Data in Audio File (Advanced) as a Batch Job
23
+ # Creates an async batch job for detecting user data in an audio file using Advanced detection. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the result when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA) and detects 29 configurable types of user data including health-related PHI in the transcript using Advanced AI. Returns the full transcript, token timestamps, detection results, and optional rationale. Requires Managed Instance or Private Cloud deployment.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [DlpAdvancedAudioDetectionRequest] :body Input request
26
+ # @return [DlpBatchJobResult]
27
+ def detect_audio_advanced_batch_job(opts = {})
28
+ data, _status_code, _headers = detect_audio_advanced_batch_job_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Detect User Data in Audio File (Advanced) as a Batch Job
33
+ # Creates an async batch job for detecting user data in an audio file using Advanced detection. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the result when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA) and detects 29 configurable types of user data including health-related PHI in the transcript using Advanced AI. Returns the full transcript, token timestamps, detection results, and optional rationale. Requires Managed Instance or Private Cloud deployment.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [DlpAdvancedAudioDetectionRequest] :body Input request
36
+ # @return [Array<(DlpBatchJobResult, Fixnum, Hash)>] DlpBatchJobResult data, response status code and response headers
37
+ def detect_audio_advanced_batch_job_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: TasksBatchJobApi.detect_audio_advanced_batch_job ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/dlp/batch-job/detect/audio/advanced'
43
+
44
+ # query parameters
45
+ query_params = {}
46
+
47
+ # header parameters
48
+ header_params = {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
51
+ # HTTP header 'Content-Type'
52
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
53
+
54
+ # form parameters
55
+ form_params = {}
56
+
57
+ # http body (model)
58
+ post_body = @api_client.object_to_http_body(opts[:'body'])
59
+ auth_names = ['Apikey']
60
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
61
+ :header_params => header_params,
62
+ :query_params => query_params,
63
+ :form_params => form_params,
64
+ :body => post_body,
65
+ :auth_names => auth_names,
66
+ :return_type => 'DlpBatchJobResult')
67
+ if @api_client.config.debugging
68
+ @api_client.config.logger.debug "API called: TasksBatchJobApi#detect_audio_advanced_batch_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
69
+ end
70
+ return data, status_code, headers
71
+ end
72
+ # Detect User Data in Audio File as a Batch Job
73
+ # Creates an async batch job for detecting user data in an audio file. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the result when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA) and detects 23 configurable types of user data in the transcript using Advanced AI. Returns the full transcript, token timestamps, and detection results. Requires Managed Instance or Private Cloud deployment.
74
+ # @param [Hash] opts the optional parameters
75
+ # @option opts [DlpAudioDetectionRequest] :body Input request
76
+ # @return [DlpBatchJobResult]
77
+ def detect_audio_batch_job(opts = {})
78
+ data, _status_code, _headers = detect_audio_batch_job_with_http_info(opts)
79
+ data
80
+ end
81
+
82
+ # Detect User Data in Audio File as a Batch Job
83
+ # Creates an async batch job for detecting user data in an audio file. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the result when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA) and detects 23 configurable types of user data in the transcript using Advanced AI. Returns the full transcript, token timestamps, and detection results. Requires Managed Instance or Private Cloud deployment.
84
+ # @param [Hash] opts the optional parameters
85
+ # @option opts [DlpAudioDetectionRequest] :body Input request
86
+ # @return [Array<(DlpBatchJobResult, Fixnum, Hash)>] DlpBatchJobResult data, response status code and response headers
87
+ def detect_audio_batch_job_with_http_info(opts = {})
88
+ if @api_client.config.debugging
89
+ @api_client.config.logger.debug 'Calling API: TasksBatchJobApi.detect_audio_batch_job ...'
90
+ end
91
+ # resource path
92
+ local_var_path = '/dlp/batch-job/detect/audio'
93
+
94
+ # query parameters
95
+ query_params = {}
96
+
97
+ # header parameters
98
+ header_params = {}
99
+ # HTTP header 'Accept' (if needed)
100
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
101
+ # HTTP header 'Content-Type'
102
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
103
+
104
+ # form parameters
105
+ form_params = {}
106
+
107
+ # http body (model)
108
+ post_body = @api_client.object_to_http_body(opts[:'body'])
109
+ auth_names = ['Apikey']
110
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
111
+ :header_params => header_params,
112
+ :query_params => query_params,
113
+ :form_params => form_params,
114
+ :body => post_body,
115
+ :auth_names => auth_names,
116
+ :return_type => 'DlpBatchJobResult')
117
+ if @api_client.config.debugging
118
+ @api_client.config.logger.debug "API called: TasksBatchJobApi#detect_audio_batch_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
119
+ end
120
+ return data, status_code, headers
121
+ end
122
+ # Get the status and result of a DLP Batch Job
123
+ # Returns the result of the Async Job - possible states can be STARTED or COMPLETED. When COMPLETED, the corresponding result field (detection or redaction result) is populated on the response. This API is only available for Cloudmersive Managed Instance and Private Cloud deployments.
124
+ # @param [Hash] opts the optional parameters
125
+ # @option opts [String] :async_job_id Job ID for the batch job to get the status of
126
+ # @return [DlpBatchJobStatusResult]
127
+ def get_async_job_status(opts = {})
128
+ data, _status_code, _headers = get_async_job_status_with_http_info(opts)
129
+ data
130
+ end
131
+
132
+ # Get the status and result of a DLP Batch Job
133
+ # Returns the result of the Async Job - possible states can be STARTED or COMPLETED. When COMPLETED, the corresponding result field (detection or redaction result) is populated on the response. This API is only available for Cloudmersive Managed Instance and Private Cloud deployments.
134
+ # @param [Hash] opts the optional parameters
135
+ # @option opts [String] :async_job_id Job ID for the batch job to get the status of
136
+ # @return [Array<(DlpBatchJobStatusResult, Fixnum, Hash)>] DlpBatchJobStatusResult data, response status code and response headers
137
+ def get_async_job_status_with_http_info(opts = {})
138
+ if @api_client.config.debugging
139
+ @api_client.config.logger.debug 'Calling API: TasksBatchJobApi.get_async_job_status ...'
140
+ end
141
+ # resource path
142
+ local_var_path = '/dlp/batch-job/status'
143
+
144
+ # query parameters
145
+ query_params = {}
146
+ query_params[:'AsyncJobID'] = opts[:'async_job_id'] if !opts[:'async_job_id'].nil?
147
+
148
+ # header parameters
149
+ header_params = {}
150
+ # HTTP header 'Accept' (if needed)
151
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
152
+
153
+ # form parameters
154
+ form_params = {}
155
+
156
+ # http body (model)
157
+ post_body = nil
158
+ auth_names = ['Apikey']
159
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
160
+ :header_params => header_params,
161
+ :query_params => query_params,
162
+ :form_params => form_params,
163
+ :body => post_body,
164
+ :auth_names => auth_names,
165
+ :return_type => 'DlpBatchJobStatusResult')
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug "API called: TasksBatchJobApi#get_async_job_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
168
+ end
169
+ return data, status_code, headers
170
+ end
171
+ # Redact User Data in Audio File (Advanced) as a Batch Job
172
+ # Creates an async batch job for redacting user data in an audio file using Advanced detection. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the redacted audio and transcript when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA), detects 34 configurable types of user data including health-related PHI in the transcript, and redacts audio segments containing PII. Returns the redacted audio, redacted transcript, detection results, redacted segment timestamps, and optional rationale. Requires Managed Instance or Private Cloud deployment.
173
+ # @param [Hash] opts the optional parameters
174
+ # @option opts [DlpAdvancedAudioRedactionRequest] :body Input request
175
+ # @return [DlpBatchJobResult]
176
+ def redact_audio_advanced_batch_job(opts = {})
177
+ data, _status_code, _headers = redact_audio_advanced_batch_job_with_http_info(opts)
178
+ data
179
+ end
180
+
181
+ # Redact User Data in Audio File (Advanced) as a Batch Job
182
+ # Creates an async batch job for redacting user data in an audio file using Advanced detection. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the redacted audio and transcript when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA), detects 34 configurable types of user data including health-related PHI in the transcript, and redacts audio segments containing PII. Returns the redacted audio, redacted transcript, detection results, redacted segment timestamps, and optional rationale. Requires Managed Instance or Private Cloud deployment.
183
+ # @param [Hash] opts the optional parameters
184
+ # @option opts [DlpAdvancedAudioRedactionRequest] :body Input request
185
+ # @return [Array<(DlpBatchJobResult, Fixnum, Hash)>] DlpBatchJobResult data, response status code and response headers
186
+ def redact_audio_advanced_batch_job_with_http_info(opts = {})
187
+ if @api_client.config.debugging
188
+ @api_client.config.logger.debug 'Calling API: TasksBatchJobApi.redact_audio_advanced_batch_job ...'
189
+ end
190
+ # resource path
191
+ local_var_path = '/dlp/batch-job/redact/audio/advanced'
192
+
193
+ # query parameters
194
+ query_params = {}
195
+
196
+ # header parameters
197
+ header_params = {}
198
+ # HTTP header 'Accept' (if needed)
199
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
200
+ # HTTP header 'Content-Type'
201
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
202
+
203
+ # form parameters
204
+ form_params = {}
205
+
206
+ # http body (model)
207
+ post_body = @api_client.object_to_http_body(opts[:'body'])
208
+ auth_names = ['Apikey']
209
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
210
+ :header_params => header_params,
211
+ :query_params => query_params,
212
+ :form_params => form_params,
213
+ :body => post_body,
214
+ :auth_names => auth_names,
215
+ :return_type => 'DlpBatchJobResult')
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: TasksBatchJobApi#redact_audio_advanced_batch_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+ # Redact User Data in Audio File as a Batch Job
222
+ # Creates an async batch job for redacting user data in an audio file. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the redacted audio and transcript when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA), detects 23 configurable types of user data in the transcript, and redacts audio segments containing PII. Returns the redacted audio, redacted transcript, detection results, and redacted segment timestamps. Requires Managed Instance or Private Cloud deployment.
223
+ # @param [Hash] opts the optional parameters
224
+ # @option opts [DlpAudioRedactionRequest] :body Input request
225
+ # @return [DlpBatchJobResult]
226
+ def redact_audio_batch_job(opts = {})
227
+ data, _status_code, _headers = redact_audio_batch_job_with_http_info(opts)
228
+ data
229
+ end
230
+
231
+ # Redact User Data in Audio File as a Batch Job
232
+ # Creates an async batch job for redacting user data in an audio file. Use the GetAsyncJobStatus API to check on the status of the job and retrieve the redacted audio and transcript when complete. Transcribes an audio file (WAV, MP3, M4A, FLAC, OGG, WMA), detects 23 configurable types of user data in the transcript, and redacts audio segments containing PII. Returns the redacted audio, redacted transcript, detection results, and redacted segment timestamps. Requires Managed Instance or Private Cloud deployment.
233
+ # @param [Hash] opts the optional parameters
234
+ # @option opts [DlpAudioRedactionRequest] :body Input request
235
+ # @return [Array<(DlpBatchJobResult, Fixnum, Hash)>] DlpBatchJobResult data, response status code and response headers
236
+ def redact_audio_batch_job_with_http_info(opts = {})
237
+ if @api_client.config.debugging
238
+ @api_client.config.logger.debug 'Calling API: TasksBatchJobApi.redact_audio_batch_job ...'
239
+ end
240
+ # resource path
241
+ local_var_path = '/dlp/batch-job/redact/audio'
242
+
243
+ # query parameters
244
+ query_params = {}
245
+
246
+ # header parameters
247
+ header_params = {}
248
+ # HTTP header 'Accept' (if needed)
249
+ header_params['Accept'] = @api_client.select_header_accept(['text/plain', 'application/json', 'text/json'])
250
+ # HTTP header 'Content-Type'
251
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/*+json'])
252
+
253
+ # form parameters
254
+ form_params = {}
255
+
256
+ # http body (model)
257
+ post_body = @api_client.object_to_http_body(opts[:'body'])
258
+ auth_names = ['Apikey']
259
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
260
+ :header_params => header_params,
261
+ :query_params => query_params,
262
+ :form_params => form_params,
263
+ :body => post_body,
264
+ :auth_names => auth_names,
265
+ :return_type => 'DlpBatchJobResult')
266
+ if @api_client.config.debugging
267
+ @api_client.config.logger.debug "API called: TasksBatchJobApi#redact_audio_batch_job\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
268
+ end
269
+ return data, status_code, headers
270
+ end
271
+ end
272
+ end
@@ -0,0 +1,226 @@
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
+ # A single token with its timestamp from speech recognition.
17
+ class AudioTimestamp
18
+ # The word or token recognized from the audio.
19
+ attr_accessor :token
20
+
21
+ # Start position of the token in the transcript text (character offset).
22
+ attr_accessor :character_offset_start
23
+
24
+ # End position of the token in the transcript text (character offset).
25
+ attr_accessor :character_offset_end
26
+
27
+ # Start time of the token in the audio, in milliseconds.
28
+ attr_accessor :start_time_ms
29
+
30
+ # End time of the token in the audio, in milliseconds.
31
+ attr_accessor :end_time_ms
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'token' => :'Token',
37
+ :'character_offset_start' => :'CharacterOffsetStart',
38
+ :'character_offset_end' => :'CharacterOffsetEnd',
39
+ :'start_time_ms' => :'StartTimeMs',
40
+ :'end_time_ms' => :'EndTimeMs'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.swagger_types
46
+ {
47
+ :'token' => :'String',
48
+ :'character_offset_start' => :'Integer',
49
+ :'character_offset_end' => :'Integer',
50
+ :'start_time_ms' => :'Integer',
51
+ :'end_time_ms' => :'Integer'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
62
+
63
+ if attributes.has_key?(:'Token')
64
+ self.token = attributes[:'Token']
65
+ end
66
+
67
+ if attributes.has_key?(:'CharacterOffsetStart')
68
+ self.character_offset_start = attributes[:'CharacterOffsetStart']
69
+ end
70
+
71
+ if attributes.has_key?(:'CharacterOffsetEnd')
72
+ self.character_offset_end = attributes[:'CharacterOffsetEnd']
73
+ end
74
+
75
+ if attributes.has_key?(:'StartTimeMs')
76
+ self.start_time_ms = attributes[:'StartTimeMs']
77
+ end
78
+
79
+ if attributes.has_key?(:'EndTimeMs')
80
+ self.end_time_ms = attributes[:'EndTimeMs']
81
+ end
82
+ end
83
+
84
+ # Show invalid properties with the reasons. Usually used together with valid?
85
+ # @return Array for valid properties with the reasons
86
+ def list_invalid_properties
87
+ invalid_properties = Array.new
88
+ invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ true
95
+ end
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] Object to be compared
99
+ def ==(o)
100
+ return true if self.equal?(o)
101
+ self.class == o.class &&
102
+ token == o.token &&
103
+ character_offset_start == o.character_offset_start &&
104
+ character_offset_end == o.character_offset_end &&
105
+ start_time_ms == o.start_time_ms &&
106
+ end_time_ms == o.end_time_ms
107
+ end
108
+
109
+ # @see the `==` method
110
+ # @param [Object] Object to be compared
111
+ def eql?(o)
112
+ self == o
113
+ end
114
+
115
+ # Calculates hash code according to all attributes.
116
+ # @return [Fixnum] Hash code
117
+ def hash
118
+ [token, character_offset_start, character_offset_end, start_time_ms, end_time_ms].hash
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.swagger_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :BOOLEAN
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ temp_model = CloudmersiveDlpApiClient.const_get(type).new
179
+ temp_model.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ next if value.nil?
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+
225
+ end
226
+ end
@@ -0,0 +1,196 @@
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
+ # Caller-defined custom PII field. The redaction LLM will look for content matching the description and redact it as a semantic tag derived from the title (e.g. title \"internal participant code\" → tag [INTERNAL-PARTICIPANT-CODE]).
17
+ class CustomPiiField
18
+ # Short title for the custom field, also used to derive the semantic tag (uppercased, spaces/underscores replaced with hyphens).
19
+ attr_accessor :title
20
+
21
+ # Description of what this field looks like, used to instruct the redaction LLM. Be specific so the LLM can locate matches.
22
+ attr_accessor :description
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'title' => :'Title',
28
+ :'description' => :'Description'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'title' => :'String',
36
+ :'description' => :'String'
37
+ }
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
47
+
48
+ if attributes.has_key?(:'Title')
49
+ self.title = attributes[:'Title']
50
+ end
51
+
52
+ if attributes.has_key?(:'Description')
53
+ self.description = attributes[:'Description']
54
+ end
55
+ end
56
+
57
+ # Show invalid properties with the reasons. Usually used together with valid?
58
+ # @return Array for valid properties with the reasons
59
+ def list_invalid_properties
60
+ invalid_properties = Array.new
61
+ invalid_properties
62
+ end
63
+
64
+ # Check to see if the all the properties in the model are valid
65
+ # @return true if the model is valid
66
+ def valid?
67
+ true
68
+ end
69
+
70
+ # Checks equality by comparing each attribute.
71
+ # @param [Object] Object to be compared
72
+ def ==(o)
73
+ return true if self.equal?(o)
74
+ self.class == o.class &&
75
+ title == o.title &&
76
+ description == o.description
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] Object to be compared
81
+ def eql?(o)
82
+ self == o
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [title, description].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /\AArray<(.*)>/i
98
+ # check to ensure the input is an array given that the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Deserializes the data based on type
112
+ # @param string type Data type
113
+ # @param string value Value to be deserialized
114
+ # @return [Object] Deserialized data
115
+ def _deserialize(type, value)
116
+ case type.to_sym
117
+ when :DateTime
118
+ DateTime.parse(value)
119
+ when :Date
120
+ Date.parse(value)
121
+ when :String
122
+ value.to_s
123
+ when :Integer
124
+ value.to_i
125
+ when :Float
126
+ value.to_f
127
+ when :BOOLEAN
128
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
+ true
130
+ else
131
+ false
132
+ end
133
+ when :Object
134
+ # generic object (usually a Hash), return directly
135
+ value
136
+ when /\AArray<(?<inner_type>.+)>\z/
137
+ inner_type = Regexp.last_match[:inner_type]
138
+ value.map { |v| _deserialize(inner_type, v) }
139
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
+ k_type = Regexp.last_match[:k_type]
141
+ v_type = Regexp.last_match[:v_type]
142
+ {}.tap do |hash|
143
+ value.each do |k, v|
144
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
+ end
146
+ end
147
+ else # model
148
+ temp_model = CloudmersiveDlpApiClient.const_get(type).new
149
+ temp_model.build_from_hash(value)
150
+ end
151
+ end
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # to_body is an alias to to_hash (backward compatibility)
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_body
162
+ to_hash
163
+ end
164
+
165
+ # Returns the object in the form of hash
166
+ # @return [Hash] Returns the object in the form of hash
167
+ def to_hash
168
+ hash = {}
169
+ self.class.attribute_map.each_pair do |attr, param|
170
+ value = self.send(attr)
171
+ next if value.nil?
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+
195
+ end
196
+ end