Class: CloudmersiveCdrApiClient::FileSanitizationApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FileSanitizationApi

Returns a new instance of FileSanitizationApi.



19
20
21
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#file(opts = {}) ⇒ String

Content Disarm and Reconstruction on a File Processes the input file via CDR to produce a secured output file. Input content is parsed, disarmed, and then reconstructed into a new output file with the same file format as the input.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :input_file (File)

    Input document, or photos of a document, to extract data from

Returns:

  • (String)


27
28
29
30
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 27

def file(opts = {})
  data, _status_code, _headers = file_with_http_info(opts)
  data
end

#file_advanced(opts = {}) ⇒ String

Advanced Content Disarm and Reconstruction on a File Processes the input file via CDR to produce a secured output file with advanced scan options and response headers containing scan metadata.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (EXE, DLL, etc.)

  • :allow_invalid_files (BOOLEAN)

    Set to false to block files that are not valid for their detected type

  • :allow_scripts (BOOLEAN)

    Set to false to block script files. PDF and Office macro sanitization still runs regardless.

  • :allow_password_protected_files (BOOLEAN)

    Set to false to block password-protected files

  • :allow_macros (BOOLEAN)

    Set to false to block files containing macros. Office macro removal still runs regardless.

  • :allow_xml_external_entities (BOOLEAN)

    Set to false to block XML files with external entity references (XXE)

  • :allow_insecure_deserialization (BOOLEAN)

    Set to false to block files with insecure deserialization patterns

  • :allow_html (BOOLEAN)

    Set to false to block HTML files

  • :allow_unsafe_archives (BOOLEAN)

    Set to false to block archive files flagged as unsafe (e.g., zip bombs)

  • :allow_ole_embedded_object (BOOLEAN)

    Set to false to block files with embedded OLE objects

  • :allow_unwanted_action (BOOLEAN)

    Set to false to block files with unwanted actions

  • :restrict_file_types (String)

    Comma-separated list of allowed file extensions (e.g., \".pdf,.docx,.xlsx\"). Files not matching will be blocked.

  • :input_file (File)

    Input document to CDR process

Returns:

  • (String)


90
91
92
93
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 90

def file_advanced(opts = {})
  data, _status_code, _headers = file_advanced_with_http_info(opts)
  data
end

#file_advanced_with_http_info(opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Advanced Content Disarm and Reconstruction on a File Processes the input file via CDR to produce a secured output file with advanced scan options and response headers containing scan metadata.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (EXE, DLL, etc.)

  • :allow_invalid_files (BOOLEAN)

    Set to false to block files that are not valid for their detected type

  • :allow_scripts (BOOLEAN)

    Set to false to block script files. PDF and Office macro sanitization still runs regardless.

  • :allow_password_protected_files (BOOLEAN)

    Set to false to block password-protected files

  • :allow_macros (BOOLEAN)

    Set to false to block files containing macros. Office macro removal still runs regardless.

  • :allow_xml_external_entities (BOOLEAN)

    Set to false to block XML files with external entity references (XXE)

  • :allow_insecure_deserialization (BOOLEAN)

    Set to false to block files with insecure deserialization patterns

  • :allow_html (BOOLEAN)

    Set to false to block HTML files

  • :allow_unsafe_archives (BOOLEAN)

    Set to false to block archive files flagged as unsafe (e.g., zip bombs)

  • :allow_ole_embedded_object (BOOLEAN)

    Set to false to block files with embedded OLE objects

  • :allow_unwanted_action (BOOLEAN)

    Set to false to block files with unwanted actions

  • :restrict_file_types (String)

    Comma-separated list of allowed file extensions (e.g., \&quot;.pdf,.docx,.xlsx\&quot;). Files not matching will be blocked.

  • :input_file (File)

    Input document to CDR process

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 112

def file_advanced_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSanitizationApi.file_advanced ...'
  end
  # resource path
  local_var_path = '/cdr/sanitization/file/advanced'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'allowExecutables'] = opts[:'allow_executables'] if !opts[:'allow_executables'].nil?
  header_params[:'allowInvalidFiles'] = opts[:'allow_invalid_files'] if !opts[:'allow_invalid_files'].nil?
  header_params[:'allowScripts'] = opts[:'allow_scripts'] if !opts[:'allow_scripts'].nil?
  header_params[:'allowPasswordProtectedFiles'] = opts[:'allow_password_protected_files'] if !opts[:'allow_password_protected_files'].nil?
  header_params[:'allowMacros'] = opts[:'allow_macros'] if !opts[:'allow_macros'].nil?
  header_params[:'allowXmlExternalEntities'] = opts[:'allow_xml_external_entities'] if !opts[:'allow_xml_external_entities'].nil?
  header_params[:'allowInsecureDeserialization'] = opts[:'allow_insecure_deserialization'] if !opts[:'allow_insecure_deserialization'].nil?
  header_params[:'allowHtml'] = opts[:'allow_html'] if !opts[:'allow_html'].nil?
  header_params[:'allowUnsafeArchives'] = opts[:'allow_unsafe_archives'] if !opts[:'allow_unsafe_archives'].nil?
  header_params[:'allowOleEmbeddedObject'] = opts[:'allow_ole_embedded_object'] if !opts[:'allow_ole_embedded_object'].nil?
  header_params[:'allowUnwantedAction'] = opts[:'allow_unwanted_action'] if !opts[:'allow_unwanted_action'].nil?
  header_params[:'restrictFileTypes'] = opts[:'restrict_file_types'] if !opts[:'restrict_file_types'].nil?

  # form parameters
  form_params = {}
  form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSanitizationApi#file_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_to_pdf(opts = {}) ⇒ String

Content Disarm and Reconstruction on a File with PDFA Output Processes the input file via CDR to produce a secured PDF/A output file. Input content is parsed, disarmed, and then reconstructed into a new PDF/A output file.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :input_file (File)

    Input document, or photos of a document, to extract data from

Returns:

  • (String)


165
166
167
168
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 165

def file_to_pdf(opts = {})
  data, _status_code, _headers = file_to_pdf_with_http_info(opts)
  data
end

#file_to_pdf_advanced(opts = {}) ⇒ String

Advanced Content Disarm and Reconstruction on a File with PDFA Output Processes the input file via CDR to produce a secured PDF/A output file with advanced scan options and response headers containing scan metadata.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (EXE, DLL, etc.)

  • :allow_invalid_files (BOOLEAN)

    Set to false to block files that are not valid for their detected type

  • :allow_scripts (BOOLEAN)

    Set to false to block script files. PDF and Office macro sanitization still runs regardless.

  • :allow_password_protected_files (BOOLEAN)

    Set to false to block password-protected files

  • :allow_macros (BOOLEAN)

    Set to false to block files containing macros. Office macro removal still runs regardless.

  • :allow_xml_external_entities (BOOLEAN)

    Set to false to block XML files with external entity references (XXE)

  • :allow_insecure_deserialization (BOOLEAN)

    Set to false to block files with insecure deserialization patterns

  • :allow_html (BOOLEAN)

    Set to false to block HTML files

  • :allow_unsafe_archives (BOOLEAN)

    Set to false to block archive files flagged as unsafe (e.g., zip bombs)

  • :allow_ole_embedded_object (BOOLEAN)

    Set to false to block files with embedded OLE objects

  • :allow_unwanted_action (BOOLEAN)

    Set to false to block files with unwanted actions

  • :restrict_file_types (String)

    Comma-separated list of allowed file extensions (e.g., \&quot;.pdf,.docx,.xlsx\&quot;). Files not matching will be blocked.

  • :input_file (File)

    Input document to CDR process

Returns:

  • (String)


228
229
230
231
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 228

def file_to_pdf_advanced(opts = {})
  data, _status_code, _headers = file_to_pdf_advanced_with_http_info(opts)
  data
end

#file_to_pdf_advanced_with_http_info(opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Advanced Content Disarm and Reconstruction on a File with PDFA Output Processes the input file via CDR to produce a secured PDF/A output file with advanced scan options and response headers containing scan metadata.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (EXE, DLL, etc.)

  • :allow_invalid_files (BOOLEAN)

    Set to false to block files that are not valid for their detected type

  • :allow_scripts (BOOLEAN)

    Set to false to block script files. PDF and Office macro sanitization still runs regardless.

  • :allow_password_protected_files (BOOLEAN)

    Set to false to block password-protected files

  • :allow_macros (BOOLEAN)

    Set to false to block files containing macros. Office macro removal still runs regardless.

  • :allow_xml_external_entities (BOOLEAN)

    Set to false to block XML files with external entity references (XXE)

  • :allow_insecure_deserialization (BOOLEAN)

    Set to false to block files with insecure deserialization patterns

  • :allow_html (BOOLEAN)

    Set to false to block HTML files

  • :allow_unsafe_archives (BOOLEAN)

    Set to false to block archive files flagged as unsafe (e.g., zip bombs)

  • :allow_ole_embedded_object (BOOLEAN)

    Set to false to block files with embedded OLE objects

  • :allow_unwanted_action (BOOLEAN)

    Set to false to block files with unwanted actions

  • :restrict_file_types (String)

    Comma-separated list of allowed file extensions (e.g., \&quot;.pdf,.docx,.xlsx\&quot;). Files not matching will be blocked.

  • :input_file (File)

    Input document to CDR process

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 250

def file_to_pdf_advanced_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSanitizationApi.file_to_pdf_advanced ...'
  end
  # resource path
  local_var_path = '/cdr/sanitization/file/to/pdf/advanced'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
  header_params[:'allowExecutables'] = opts[:'allow_executables'] if !opts[:'allow_executables'].nil?
  header_params[:'allowInvalidFiles'] = opts[:'allow_invalid_files'] if !opts[:'allow_invalid_files'].nil?
  header_params[:'allowScripts'] = opts[:'allow_scripts'] if !opts[:'allow_scripts'].nil?
  header_params[:'allowPasswordProtectedFiles'] = opts[:'allow_password_protected_files'] if !opts[:'allow_password_protected_files'].nil?
  header_params[:'allowMacros'] = opts[:'allow_macros'] if !opts[:'allow_macros'].nil?
  header_params[:'allowXmlExternalEntities'] = opts[:'allow_xml_external_entities'] if !opts[:'allow_xml_external_entities'].nil?
  header_params[:'allowInsecureDeserialization'] = opts[:'allow_insecure_deserialization'] if !opts[:'allow_insecure_deserialization'].nil?
  header_params[:'allowHtml'] = opts[:'allow_html'] if !opts[:'allow_html'].nil?
  header_params[:'allowUnsafeArchives'] = opts[:'allow_unsafe_archives'] if !opts[:'allow_unsafe_archives'].nil?
  header_params[:'allowOleEmbeddedObject'] = opts[:'allow_ole_embedded_object'] if !opts[:'allow_ole_embedded_object'].nil?
  header_params[:'allowUnwantedAction'] = opts[:'allow_unwanted_action'] if !opts[:'allow_unwanted_action'].nil?
  header_params[:'restrictFileTypes'] = opts[:'restrict_file_types'] if !opts[:'restrict_file_types'].nil?

  # form parameters
  form_params = {}
  form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSanitizationApi#file_to_pdf_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_to_pdf_with_http_info(opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Content Disarm and Reconstruction on a File with PDFA Output Processes the input file via CDR to produce a secured PDF/A output file. Input content is parsed, disarmed, and then reconstructed into a new PDF/A output file.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :input_file (File)

    Input document, or photos of a document, to extract data from

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 175

def file_to_pdf_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSanitizationApi.file_to_pdf ...'
  end
  # resource path
  local_var_path = '/cdr/sanitization/file/to/pdf'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSanitizationApi#file_to_pdf\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#file_with_http_info(opts = {}) ⇒ Array<(String, Fixnum, Hash)>

Content Disarm and Reconstruction on a File Processes the input file via CDR to produce a secured output file. Input content is parsed, disarmed, and then reconstructed into a new output file with the same file format as the input.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :input_file (File)

    Input document, or photos of a document, to extract data from

Returns:

  • (Array<(String, Fixnum, Hash)>)

    String data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cloudmersive-cdr-api-client/api/file_sanitization_api.rb', line 37

def file_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FileSanitizationApi.file ...'
  end
  # resource path
  local_var_path = '/cdr/sanitization/file'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params['InputFile'] = opts[:'input_file'] if !opts[:'input_file'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['Apikey']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'String')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FileSanitizationApi#file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end