cloudmersive-virus-scan-api-client 1.3.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +5 -5
- data/cloudmersive-virus-scan-api-client.gemspec +3 -3
- data/docs/ScanApi.md +5 -3
- data/docs/VirusScanAdvancedResult.md +1 -0
- data/docs/WebsiteScanResult.md +2 -0
- data/lib/cloudmersive-virus-scan-api-client.rb +1 -1
- data/lib/cloudmersive-virus-scan-api-client/api/scan_api.rb +16 -16
- data/lib/cloudmersive-virus-scan-api-client/api_client.rb +11 -9
- data/lib/cloudmersive-virus-scan-api-client/api_error.rb +1 -1
- data/lib/cloudmersive-virus-scan-api-client/configuration.rb +2 -2
- data/lib/cloudmersive-virus-scan-api-client/models/virus_found.rb +7 -10
- data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_advanced_result.rb +18 -11
- data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_result.rb +7 -10
- data/lib/cloudmersive-virus-scan-api-client/models/website_scan_request.rb +7 -10
- data/lib/cloudmersive-virus-scan-api-client/models/website_scan_result.rb +35 -15
- data/lib/cloudmersive-virus-scan-api-client/version.rb +2 -2
- data/spec/api/scan_api_spec.rb +5 -4
- data/spec/api_client_spec.rb +52 -35
- data/spec/configuration_spec.rb +9 -9
- data/spec/models/virus_found_spec.rb +3 -4
- data/spec/models/virus_scan_advanced_result_spec.rb +14 -9
- data/spec/models/virus_scan_result_spec.rb +3 -4
- data/spec/models/website_scan_request_spec.rb +2 -3
- data/spec/models/website_scan_result_spec.rb +19 -8
- data/spec/spec_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79aeb7bd6275a848fd7273e8a89e2c1cdd2af0555d0a71e09a447739db7f1e93
|
4
|
+
data.tar.gz: 9cd8bdc398545b17dc569c09831cce540ff6557ecae46241793b3513c5221889
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f7a0b077fde051f1bb34149c26fd5bbd8a5bd394b075c44f506938c808f4975df31fdf841dc11c8c2ca902754fc1d50df4dd572270419462547f78459cc9399
|
7
|
+
data.tar.gz: 48d24c1a503ba6a9326c96d72937d7f37766af4939467283b7f07e13ff47847d1ff6d192bc7a3ec8d33f6aa0e3eb632205ed4953614c7fbe6ebb852aed4d63ff
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -7,7 +7,7 @@ The Cloudmersive Virus Scan API lets you scan files and content for viruses and
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version:
|
10
|
+
- Package version: 2.0.2
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-virus-scan-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-virus-scan-api-client-
|
26
|
+
gem install ./cloudmersive-virus-scan-api-client-2.0.2.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-virus-scan-api-client-
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-virus-scan-api-client-2.0.2.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-virus-scan-api-client', '~>
|
34
|
+
gem 'cloudmersive-virus-scan-api-client', '~> 2.0.2'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -64,7 +64,7 @@ end
|
|
64
64
|
|
65
65
|
api_instance = CloudmersiveVirusScanApiClient::ScanApi.new
|
66
66
|
|
67
|
-
input_file = File.new(
|
67
|
+
input_file = File.new('/path/to/file.txt') # File | Input file to perform the operation on.
|
68
68
|
|
69
69
|
|
70
70
|
begin
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
|
3
3
|
=begin
|
4
4
|
#virusapi
|
5
5
|
|
@@ -8,7 +8,7 @@
|
|
8
8
|
OpenAPI spec version: v1
|
9
9
|
|
10
10
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
11
|
-
Swagger Codegen version: 2.
|
11
|
+
Swagger Codegen version: 2.4.14
|
12
12
|
|
13
13
|
=end
|
14
14
|
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.homepage = "https://www.cloudmersive.com/virus-api"
|
25
25
|
s.summary = "Scan files and content for viruses."
|
26
26
|
s.description = "Virus API lets you scan files and content for viruses and identify security issues with content."
|
27
|
-
s.license =
|
27
|
+
s.license = 'Apache 2.0'
|
28
28
|
s.required_ruby_version = ">= 1.9"
|
29
29
|
|
30
30
|
s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
|
data/docs/ScanApi.md
CHANGED
@@ -30,7 +30,7 @@ end
|
|
30
30
|
|
31
31
|
api_instance = CloudmersiveVirusScanApiClient::ScanApi.new
|
32
32
|
|
33
|
-
input_file = File.new(
|
33
|
+
input_file = File.new('/path/to/file.txt') # File | Input file to perform the operation on.
|
34
34
|
|
35
35
|
|
36
36
|
begin
|
@@ -84,13 +84,14 @@ end
|
|
84
84
|
|
85
85
|
api_instance = CloudmersiveVirusScanApiClient::ScanApi.new
|
86
86
|
|
87
|
-
input_file = File.new(
|
87
|
+
input_file = File.new('/path/to/file.txt') # File | Input file to perform the operation on.
|
88
88
|
|
89
89
|
opts = {
|
90
90
|
allow_executables: true, # BOOLEAN | Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended).
|
91
91
|
allow_invalid_files: true, # 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).
|
92
92
|
allow_scripts: true, # 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).
|
93
|
-
|
93
|
+
allow_password_protected_files: true, # BOOLEAN | Set to false to block password protected and encrypted files, such as encrypted zip and rar files, and other files that seek to circumvent scanning through passwords. Set to true to allow these file types. Default is false (recommended).
|
94
|
+
restrict_file_types: 'restrict_file_types_example' # 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.
|
94
95
|
}
|
95
96
|
|
96
97
|
begin
|
@@ -110,6 +111,7 @@ Name | Type | Description | Notes
|
|
110
111
|
**allow_executables** | **BOOLEAN**| Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended). | [optional]
|
111
112
|
**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). | [optional]
|
112
113
|
**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). | [optional]
|
114
|
+
**allow_password_protected_files** | **BOOLEAN**| Set to false to block password protected and encrypted files, such as encrypted zip and rar files, and other files that seek to circumvent scanning through passwords. Set to true to allow these file types. Default is false (recommended). | [optional]
|
113
115
|
**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. | [optional]
|
114
116
|
|
115
117
|
### Return type
|
@@ -7,6 +7,7 @@ Name | Type | Description | Notes
|
|
7
7
|
**contains_executable** | **BOOLEAN** | True if the scan contained an executable (application code), which can be a significant risk factor | [optional]
|
8
8
|
**contains_invalid_file** | **BOOLEAN** | True if the scan contained an invalid file (such as a PDF that is not a valid PDF, Word Document that is not a valid Word Document, etc.), which can be a significant risk factor | [optional]
|
9
9
|
**contains_script** | **BOOLEAN** | True if the scan contained a script (such as a PHP script, Python script, etc.) which can be a significant risk factor | [optional]
|
10
|
+
**contains_password_protected_file** | **BOOLEAN** | True if the scan contained a password protected or encrypted file, which can be a significant risk factor | [optional]
|
10
11
|
**contains_restricted_file_format** | **BOOLEAN** | True if the uploaded file is of a type that is not allowed based on the optional restrictFileTypes parameter, false otherwise; if restrictFileTypes is not set, this will always be false | [optional]
|
11
12
|
**verified_file_format** | **String** | For file format verification-supported file formats, the contents-verified file format of the file. Null indicates that the file format is not supported for contents verification. If a Virus or Malware is found, this field will always be set to Null. | [optional]
|
12
13
|
**found_viruses** | [**Array<VirusFound>**](VirusFound.md) | Array of viruses found, if any | [optional]
|
data/docs/WebsiteScanResult.md
CHANGED
@@ -5,5 +5,7 @@ Name | Type | Description | Notes
|
|
5
5
|
------------ | ------------- | ------------- | -------------
|
6
6
|
**clean_result** | **BOOLEAN** | True if the scan contained no threats, false otherwise | [optional]
|
7
7
|
**website_threat_type** | **String** | Type of threat returned; can be None, Malware, ForcedDownload or Phishing | [optional]
|
8
|
+
**found_viruses** | [**Array<VirusFound>**](VirusFound.md) | Array of viruses found, if any | [optional]
|
9
|
+
**website_http_response_code** | **Integer** | The remote server URL HTTP reasponse code; useful for debugging issues with scanning; typically if the remote server returns a 200 or 300-series code this means a successful response, while a 400 or 500 series code would represent an error returned from the remote server for the provided URL. | [optional]
|
8
10
|
|
9
11
|
|
@@ -6,11 +6,11 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'uri'
|
14
14
|
|
15
15
|
module CloudmersiveVirusScanApiClient
|
16
16
|
class ScanApi
|
@@ -19,7 +19,6 @@ module CloudmersiveVirusScanApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
-
|
23
22
|
# Scan a file for viruses
|
24
23
|
# 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.
|
25
24
|
# @param input_file Input file to perform the operation on.
|
@@ -27,7 +26,7 @@ module CloudmersiveVirusScanApiClient
|
|
27
26
|
# @return [VirusScanResult]
|
28
27
|
def scan_file(input_file, opts = {})
|
29
28
|
data, _status_code, _headers = scan_file_with_http_info(input_file, opts)
|
30
|
-
|
29
|
+
data
|
31
30
|
end
|
32
31
|
|
33
32
|
# Scan a file for viruses
|
@@ -37,14 +36,14 @@ module CloudmersiveVirusScanApiClient
|
|
37
36
|
# @return [Array<(VirusScanResult, Fixnum, Hash)>] VirusScanResult data, response status code and response headers
|
38
37
|
def scan_file_with_http_info(input_file, opts = {})
|
39
38
|
if @api_client.config.debugging
|
40
|
-
@api_client.config.logger.debug
|
39
|
+
@api_client.config.logger.debug 'Calling API: ScanApi.scan_file ...'
|
41
40
|
end
|
42
41
|
# verify the required parameter 'input_file' is set
|
43
42
|
if @api_client.config.client_side_validation && input_file.nil?
|
44
43
|
fail ArgumentError, "Missing the required parameter 'input_file' when calling ScanApi.scan_file"
|
45
44
|
end
|
46
45
|
# resource path
|
47
|
-
local_var_path =
|
46
|
+
local_var_path = '/virus/scan/file'
|
48
47
|
|
49
48
|
# query parameters
|
50
49
|
query_params = {}
|
@@ -58,7 +57,7 @@ module CloudmersiveVirusScanApiClient
|
|
58
57
|
|
59
58
|
# form parameters
|
60
59
|
form_params = {}
|
61
|
-
form_params[
|
60
|
+
form_params['inputFile'] = input_file
|
62
61
|
|
63
62
|
# http body (model)
|
64
63
|
post_body = nil
|
@@ -75,7 +74,6 @@ module CloudmersiveVirusScanApiClient
|
|
75
74
|
end
|
76
75
|
return data, status_code, headers
|
77
76
|
end
|
78
|
-
|
79
77
|
# Advanced Scan a file for viruses
|
80
78
|
# 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.
|
81
79
|
# @param input_file Input file to perform the operation on.
|
@@ -83,11 +81,12 @@ module CloudmersiveVirusScanApiClient
|
|
83
81
|
# @option opts [BOOLEAN] :allow_executables Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended).
|
84
82
|
# @option opts [BOOLEAN] :allow_invalid_files 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).
|
85
83
|
# @option opts [BOOLEAN] :allow_scripts 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).
|
84
|
+
# @option opts [BOOLEAN] :allow_password_protected_files Set to false to block password protected and encrypted files, such as encrypted zip and rar files, and other files that seek to circumvent scanning through passwords. Set to true to allow these file types. Default is false (recommended).
|
86
85
|
# @option opts [String] :restrict_file_types 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.
|
87
86
|
# @return [VirusScanAdvancedResult]
|
88
87
|
def scan_file_advanced(input_file, opts = {})
|
89
88
|
data, _status_code, _headers = scan_file_advanced_with_http_info(input_file, opts)
|
90
|
-
|
89
|
+
data
|
91
90
|
end
|
92
91
|
|
93
92
|
# Advanced Scan a file for viruses
|
@@ -97,18 +96,19 @@ module CloudmersiveVirusScanApiClient
|
|
97
96
|
# @option opts [BOOLEAN] :allow_executables Set to false to block executable files (program code) from being allowed in the input file. Default is false (recommended).
|
98
97
|
# @option opts [BOOLEAN] :allow_invalid_files 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).
|
99
98
|
# @option opts [BOOLEAN] :allow_scripts 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).
|
99
|
+
# @option opts [BOOLEAN] :allow_password_protected_files Set to false to block password protected and encrypted files, such as encrypted zip and rar files, and other files that seek to circumvent scanning through passwords. Set to true to allow these file types. Default is false (recommended).
|
100
100
|
# @option opts [String] :restrict_file_types 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.
|
101
101
|
# @return [Array<(VirusScanAdvancedResult, Fixnum, Hash)>] VirusScanAdvancedResult data, response status code and response headers
|
102
102
|
def scan_file_advanced_with_http_info(input_file, opts = {})
|
103
103
|
if @api_client.config.debugging
|
104
|
-
@api_client.config.logger.debug
|
104
|
+
@api_client.config.logger.debug 'Calling API: ScanApi.scan_file_advanced ...'
|
105
105
|
end
|
106
106
|
# verify the required parameter 'input_file' is set
|
107
107
|
if @api_client.config.client_side_validation && input_file.nil?
|
108
108
|
fail ArgumentError, "Missing the required parameter 'input_file' when calling ScanApi.scan_file_advanced"
|
109
109
|
end
|
110
110
|
# resource path
|
111
|
-
local_var_path =
|
111
|
+
local_var_path = '/virus/scan/file/advanced'
|
112
112
|
|
113
113
|
# query parameters
|
114
114
|
query_params = {}
|
@@ -122,11 +122,12 @@ module CloudmersiveVirusScanApiClient
|
|
122
122
|
header_params[:'allowExecutables'] = opts[:'allow_executables'] if !opts[:'allow_executables'].nil?
|
123
123
|
header_params[:'allowInvalidFiles'] = opts[:'allow_invalid_files'] if !opts[:'allow_invalid_files'].nil?
|
124
124
|
header_params[:'allowScripts'] = opts[:'allow_scripts'] if !opts[:'allow_scripts'].nil?
|
125
|
+
header_params[:'allowPasswordProtectedFiles'] = opts[:'allow_password_protected_files'] if !opts[:'allow_password_protected_files'].nil?
|
125
126
|
header_params[:'restrictFileTypes'] = opts[:'restrict_file_types'] if !opts[:'restrict_file_types'].nil?
|
126
127
|
|
127
128
|
# form parameters
|
128
129
|
form_params = {}
|
129
|
-
form_params[
|
130
|
+
form_params['inputFile'] = input_file
|
130
131
|
|
131
132
|
# http body (model)
|
132
133
|
post_body = nil
|
@@ -143,7 +144,6 @@ module CloudmersiveVirusScanApiClient
|
|
143
144
|
end
|
144
145
|
return data, status_code, headers
|
145
146
|
end
|
146
|
-
|
147
147
|
# Scan a website for malicious content and threats
|
148
148
|
# Operation includes scanning the content of the URL for various types of malicious content and threats, including viruses and threats (including Phishing).
|
149
149
|
# @param input
|
@@ -151,7 +151,7 @@ module CloudmersiveVirusScanApiClient
|
|
151
151
|
# @return [WebsiteScanResult]
|
152
152
|
def scan_website(input, opts = {})
|
153
153
|
data, _status_code, _headers = scan_website_with_http_info(input, opts)
|
154
|
-
|
154
|
+
data
|
155
155
|
end
|
156
156
|
|
157
157
|
# Scan a website for malicious content and threats
|
@@ -161,14 +161,14 @@ module CloudmersiveVirusScanApiClient
|
|
161
161
|
# @return [Array<(WebsiteScanResult, Fixnum, Hash)>] WebsiteScanResult data, response status code and response headers
|
162
162
|
def scan_website_with_http_info(input, opts = {})
|
163
163
|
if @api_client.config.debugging
|
164
|
-
@api_client.config.logger.debug
|
164
|
+
@api_client.config.logger.debug 'Calling API: ScanApi.scan_website ...'
|
165
165
|
end
|
166
166
|
# verify the required parameter 'input' is set
|
167
167
|
if @api_client.config.client_side_validation && input.nil?
|
168
168
|
fail ArgumentError, "Missing the required parameter 'input' when calling ScanApi.scan_website"
|
169
169
|
end
|
170
170
|
# resource path
|
171
|
-
local_var_path =
|
171
|
+
local_var_path = '/virus/scan/website'
|
172
172
|
|
173
173
|
# query parameters
|
174
174
|
query_params = {}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -33,7 +33,7 @@ module CloudmersiveVirusScanApiClient
|
|
33
33
|
@config = config
|
34
34
|
@user_agent = "Swagger-Codegen/#{VERSION}/ruby"
|
35
35
|
@default_headers = {
|
36
|
-
'Content-Type' =>
|
36
|
+
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
38
38
|
}
|
39
39
|
end
|
@@ -112,6 +112,8 @@ module CloudmersiveVirusScanApiClient
|
|
112
112
|
:verbose => @config.debugging
|
113
113
|
}
|
114
114
|
|
115
|
+
req_opts.merge!(multipart: true) if header_params['Content-Type'].start_with? "multipart/"
|
116
|
+
|
115
117
|
# set custom cert, if provided
|
116
118
|
req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert
|
117
119
|
|
@@ -137,7 +139,7 @@ module CloudmersiveVirusScanApiClient
|
|
137
139
|
# @param [String] mime MIME
|
138
140
|
# @return [Boolean] True if the MIME is application/json
|
139
141
|
def json_mime?(mime)
|
140
|
-
|
142
|
+
(mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
|
141
143
|
end
|
142
144
|
|
143
145
|
# Deserialize the response to the given return type.
|
@@ -201,12 +203,12 @@ module CloudmersiveVirusScanApiClient
|
|
201
203
|
when /\AArray<(.+)>\z/
|
202
204
|
# e.g. Array<Pet>
|
203
205
|
sub_type = $1
|
204
|
-
data.map {|item| convert_to_type(item, sub_type) }
|
206
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
205
207
|
when /\AHash\<String, (.+)\>\z/
|
206
208
|
# e.g. Hash<String, Integer>
|
207
209
|
sub_type = $1
|
208
210
|
{}.tap do |hash|
|
209
|
-
data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
|
211
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
210
212
|
end
|
211
213
|
else
|
212
214
|
# models, e.g. Pet
|
@@ -228,7 +230,7 @@ module CloudmersiveVirusScanApiClient
|
|
228
230
|
encoding = nil
|
229
231
|
request.on_headers do |response|
|
230
232
|
content_disposition = response.headers['Content-Disposition']
|
231
|
-
if content_disposition
|
233
|
+
if content_disposition && content_disposition =~ /filename=/i
|
232
234
|
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
233
235
|
prefix = sanitize_filename(filename)
|
234
236
|
else
|
@@ -327,7 +329,7 @@ module CloudmersiveVirusScanApiClient
|
|
327
329
|
return nil if accepts.nil? || accepts.empty?
|
328
330
|
# use JSON when present, otherwise use all of the provided
|
329
331
|
json_accept = accepts.find { |s| json_mime?(s) }
|
330
|
-
|
332
|
+
json_accept || accepts.join(',')
|
331
333
|
end
|
332
334
|
|
333
335
|
# Return Content-Type header based on an array of content types provided.
|
@@ -338,7 +340,7 @@ module CloudmersiveVirusScanApiClient
|
|
338
340
|
return 'application/json' if content_types.nil? || content_types.empty?
|
339
341
|
# use JSON when present, otherwise use the first one
|
340
342
|
json_content_type = content_types.find { |s| json_mime?(s) }
|
341
|
-
|
343
|
+
json_content_type || content_types.first
|
342
344
|
end
|
343
345
|
|
344
346
|
# Convert object (array, hash, object, etc) to JSON string.
|
@@ -348,7 +350,7 @@ module CloudmersiveVirusScanApiClient
|
|
348
350
|
return model if model.nil? || model.is_a?(String)
|
349
351
|
local_body = nil
|
350
352
|
if model.is_a?(Array)
|
351
|
-
local_body = model.map{|m| object_to_hash(m) }
|
353
|
+
local_body = model.map { |m| object_to_hash(m) }
|
352
354
|
else
|
353
355
|
local_body = object_to_hash(model)
|
354
356
|
end
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -170,7 +170,7 @@ module CloudmersiveVirusScanApiClient
|
|
170
170
|
def base_path=(base_path)
|
171
171
|
# Add leading and trailing slashes to base_path
|
172
172
|
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
173
|
-
@base_path =
|
173
|
+
@base_path = '' if @base_path == '/'
|
174
174
|
end
|
175
175
|
|
176
176
|
def base_url
|
@@ -6,7 +6,7 @@
|
|
6
6
|
OpenAPI spec version: v1
|
7
7
|
|
8
8
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
10
|
|
11
11
|
=end
|
12
12
|
|
@@ -21,7 +21,6 @@ module CloudmersiveVirusScanApiClient
|
|
21
21
|
# Name of the virus that was found
|
22
22
|
attr_accessor :virus_name
|
23
23
|
|
24
|
-
|
25
24
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
25
|
def self.attribute_map
|
27
26
|
{
|
@@ -44,7 +43,7 @@ module CloudmersiveVirusScanApiClient
|
|
44
43
|
return unless attributes.is_a?(Hash)
|
45
44
|
|
46
45
|
# convert string to symbol for hash key
|
47
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
46
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
48
47
|
|
49
48
|
if attributes.has_key?(:'FileName')
|
50
49
|
self.file_name = attributes[:'FileName']
|
@@ -53,20 +52,19 @@ module CloudmersiveVirusScanApiClient
|
|
53
52
|
if attributes.has_key?(:'VirusName')
|
54
53
|
self.virus_name = attributes[:'VirusName']
|
55
54
|
end
|
56
|
-
|
57
55
|
end
|
58
56
|
|
59
57
|
# Show invalid properties with the reasons. Usually used together with valid?
|
60
58
|
# @return Array for valid properties with the reasons
|
61
59
|
def list_invalid_properties
|
62
60
|
invalid_properties = Array.new
|
63
|
-
|
61
|
+
invalid_properties
|
64
62
|
end
|
65
63
|
|
66
64
|
# Check to see if the all the properties in the model are valid
|
67
65
|
# @return true if the model is valid
|
68
66
|
def valid?
|
69
|
-
|
67
|
+
true
|
70
68
|
end
|
71
69
|
|
72
70
|
# Checks equality by comparing each attribute.
|
@@ -97,10 +95,10 @@ module CloudmersiveVirusScanApiClient
|
|
97
95
|
return nil unless attributes.is_a?(Hash)
|
98
96
|
self.class.swagger_types.each_pair do |key, type|
|
99
97
|
if type =~ /\AArray<(.*)>/i
|
100
|
-
# check to ensure the input is an array given that the
|
98
|
+
# check to ensure the input is an array given that the attribute
|
101
99
|
# is documented as an array but the input is not
|
102
100
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
103
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
101
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
104
102
|
end
|
105
103
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
106
104
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -182,7 +180,7 @@ module CloudmersiveVirusScanApiClient
|
|
182
180
|
# @return [Hash] Returns the value in the form of hash
|
183
181
|
def _to_hash(value)
|
184
182
|
if value.is_a?(Array)
|
185
|
-
value.compact.map{ |v| _to_hash(v) }
|
183
|
+
value.compact.map { |v| _to_hash(v) }
|
186
184
|
elsif value.is_a?(Hash)
|
187
185
|
{}.tap do |hash|
|
188
186
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -195,5 +193,4 @@ module CloudmersiveVirusScanApiClient
|
|
195
193
|
end
|
196
194
|
|
197
195
|
end
|
198
|
-
|
199
196
|
end
|