Class: CloudmersiveVirusScanApiClient::ScanApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudmersive-virus-scan-api-client/api/scan_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ScanApi

Returns a new instance of ScanApi.



19
20
21
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_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-virus-scan-api-client/api/scan_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#scan_file(input_file, opts = {}) ⇒ VirusScanResult

Scan a file for viruses Scan files and content for viruses. Leverage continuously updated signatures for millions of threats, and advanced high-performance scanning capabilities. Over 17 million virus and malware signatures. Continuous cloud-based updates. Wide file format support including Office, PDF, HTML, Flash. Zip support including .Zip, .Rar, .DMG, .Tar, and other archive formats. Multi-threat scanning across viruses, malware, trojans, ransomware, and spyware. High-speed in-memory scanning delivers subsecond typical response time.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 28

def scan_file(input_file, opts = {})
  data, _status_code, _headers = scan_file_with_http_info(input_file, opts)
  return data
end

#scan_file_advanced(input_file, opts = {}) ⇒ VirusScanAdvancedResult

Advanced Scan a file for viruses Advanced Scan files with 360-degree Content Protection across Viruses and Malware, executables, invalid files, scripts, and even restrictions on accepted file types with complete content verification. Customize threat rules to your needs. Leverage continuously updated signatures for millions of threats, and advanced high-performance scanning capabilities. Over 17 million virus and malware signatures. Continuous cloud-based updates. Block threats beyond viruses including executables, scripts, invalid files, and more. Optionally limit input files to a specific set of file types (e.g. PDF and Word Documents only). Wide file format support including Office, PDF, HTML, Flash. Zip support including .Zip, .Rar, .DMG, .Tar, and other archive formats. Multi-threat scanning across viruses, malware, trojans, ransomware, and spyware. High-speed in-memory scanning delivers subsecond typical response time.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended).

  • :allow_invalid_files (BOOLEAN)

    Set to false to block invalid files, such as a PDF file that is not really a valid PDF file, or a Word Document that is not a valid Word Document. Default is false (recommended).

  • :allow_scripts (BOOLEAN)

    Set to false to block script files, such as a PHP files, Pythong scripts, and other malicious content or security threats that can be embedded in the file. Set to true to allow these file types. Default is false (recommended).

  • :restrict_file_types (String)

    Specify a restricted set of file formats to allow as clean as a comma-separated list of file formats, such as .pdf,.docx,.png would allow only PDF, PNG and Word document files. All files must pass content verification against this list of file formats, if they do not, then the result will be returned as CleanResult=false. Set restrictFileTypes parameter to null or empty string to disable; default is disabled.

Returns:



88
89
90
91
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 88

def scan_file_advanced(input_file, opts = {})
  data, _status_code, _headers = scan_file_advanced_with_http_info(input_file, opts)
  return data
end

#scan_file_advanced_with_http_info(input_file, opts = {}) ⇒ Array<(VirusScanAdvancedResult, Fixnum, Hash)>

Advanced Scan a file for viruses Advanced Scan files with 360-degree Content Protection across Viruses and Malware, executables, invalid files, scripts, and even restrictions on accepted file types with complete content verification. Customize threat rules to your needs. Leverage continuously updated signatures for millions of threats, and advanced high-performance scanning capabilities. Over 17 million virus and malware signatures. Continuous cloud-based updates. Block threats beyond viruses including executables, scripts, invalid files, and more. Optionally limit input files to a specific set of file types (e.g. PDF and Word Documents only). Wide file format support including Office, PDF, HTML, Flash. Zip support including .Zip, .Rar, .DMG, .Tar, and other archive formats. Multi-threat scanning across viruses, malware, trojans, ransomware, and spyware. High-speed in-memory scanning delivers subsecond typical response time.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Options Hash (opts):

  • :allow_executables (BOOLEAN)

    Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended).

  • :allow_invalid_files (BOOLEAN)

    Set to false to block invalid files, such as a PDF file that is not really a valid PDF file, or a Word Document that is not a valid Word Document. Default is false (recommended).

  • :allow_scripts (BOOLEAN)

    Set to false to block script files, such as a PHP files, Pythong scripts, and other malicious content or security threats that can be embedded in the file. Set to true to allow these file types. Default is false (recommended).

  • :restrict_file_types (String)

    Specify a restricted set of file formats to allow as clean as a comma-separated list of file formats, such as .pdf,.docx,.png would allow only PDF, PNG and Word document files. All files must pass content verification against this list of file formats, if they do not, then the result will be returned as CleanResult&#x3D;false. Set restrictFileTypes parameter to null or empty string to disable; default is disabled.

Returns:

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

    VirusScanAdvancedResult data, response status code and response headers



102
103
104
105
106
107
108
109
110
111
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
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 102

def scan_file_advanced_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ScanApi.scan_file_advanced ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling ScanApi.scan_file_advanced"
  end
  # resource path
  local_var_path = "/virus/scan/file/advanced"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # 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[:'restrictFileTypes'] = opts[:'restrict_file_types'] if !opts[:'restrict_file_types'].nil?

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # 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 => 'VirusScanAdvancedResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#scan_file_advanced\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#scan_file_with_http_info(input_file, opts = {}) ⇒ Array<(VirusScanResult, Fixnum, Hash)>

Scan a file for viruses Scan files and content for viruses. Leverage continuously updated signatures for millions of threats, and advanced high-performance scanning capabilities. Over 17 million virus and malware signatures. Continuous cloud-based updates. Wide file format support including Office, PDF, HTML, Flash. Zip support including .Zip, .Rar, .DMG, .Tar, and other archive formats. Multi-threat scanning across viruses, malware, trojans, ransomware, and spyware. High-speed in-memory scanning delivers subsecond typical response time.

Parameters:

  • input_file

    Input file to perform the operation on.

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

    the optional parameters

Returns:

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

    VirusScanResult data, response status code and response headers



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
73
74
75
76
77
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 38

def scan_file_with_http_info(input_file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ScanApi.scan_file ..."
  end
  # verify the required parameter 'input_file' is set
  if @api_client.config.client_side_validation && input_file.nil?
    fail ArgumentError, "Missing the required parameter 'input_file' when calling ScanApi.scan_file"
  end
  # resource path
  local_var_path = "/virus/scan/file"

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}
  form_params["inputFile"] = input_file

  # 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 => 'VirusScanResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#scan_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#scan_website(input, opts = {}) ⇒ WebsiteScanResult

Scan a website for malicious content and threats Operation includes scanning the content of the URL for various types of malicious content and threats, including viruses and threats (including Phishing).

Parameters:

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

    the optional parameters

Returns:



152
153
154
155
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 152

def scan_website(input, opts = {})
  data, _status_code, _headers = scan_website_with_http_info(input, opts)
  return data
end

#scan_website_with_http_info(input, opts = {}) ⇒ Array<(WebsiteScanResult, Fixnum, Hash)>

Scan a website for malicious content and threats Operation includes scanning the content of the URL for various types of malicious content and threats, including viruses and threats (including Phishing).

Parameters:

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

    the optional parameters

Returns:

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

    WebsiteScanResult data, response status code and response headers



162
163
164
165
166
167
168
169
170
171
172
173
174
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
# File 'lib/cloudmersive-virus-scan-api-client/api/scan_api.rb', line 162

def scan_website_with_http_info(input, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: ScanApi.scan_website ..."
  end
  # verify the required parameter 'input' is set
  if @api_client.config.client_side_validation && input.nil?
    fail ArgumentError, "Missing the required parameter 'input' when calling ScanApi.scan_website"
  end
  # resource path
  local_var_path = "/virus/scan/website"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(input)
  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 => 'WebsiteScanResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ScanApi#scan_website\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end