cloudmersive-virus-scan-api-client 1.3.2 → 2.0.3

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 (37) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +10 -5
  4. data/cloudmersive-virus-scan-api-client.gemspec +3 -3
  5. data/docs/CloudStorageVirusFound.md +9 -0
  6. data/docs/CloudStorageVirusScanResult.md +12 -0
  7. data/docs/ScanApi.md +7 -5
  8. data/docs/ScanCloudStorageApi.md +197 -0
  9. data/docs/VirusScanAdvancedResult.md +1 -0
  10. data/docs/WebsiteScanResult.md +1 -0
  11. data/lib/cloudmersive-virus-scan-api-client.rb +4 -1
  12. data/lib/cloudmersive-virus-scan-api-client/api/scan_api.rb +18 -18
  13. data/lib/cloudmersive-virus-scan-api-client/api/scan_cloud_storage_api.rb +244 -0
  14. data/lib/cloudmersive-virus-scan-api-client/api_client.rb +11 -9
  15. data/lib/cloudmersive-virus-scan-api-client/api_error.rb +1 -1
  16. data/lib/cloudmersive-virus-scan-api-client/configuration.rb +2 -2
  17. data/lib/cloudmersive-virus-scan-api-client/models/cloud_storage_virus_found.rb +196 -0
  18. data/lib/cloudmersive-virus-scan-api-client/models/cloud_storage_virus_scan_result.rb +228 -0
  19. data/lib/cloudmersive-virus-scan-api-client/models/virus_found.rb +7 -10
  20. data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_advanced_result.rb +18 -11
  21. data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_result.rb +7 -10
  22. data/lib/cloudmersive-virus-scan-api-client/models/website_scan_request.rb +7 -10
  23. data/lib/cloudmersive-virus-scan-api-client/models/website_scan_result.rb +23 -15
  24. data/lib/cloudmersive-virus-scan-api-client/version.rb +2 -2
  25. data/spec/api/scan_api_spec.rb +6 -5
  26. data/spec/api/scan_cloud_storage_api_spec.rb +79 -0
  27. data/spec/api_client_spec.rb +52 -35
  28. data/spec/configuration_spec.rb +9 -9
  29. data/spec/models/cloud_storage_virus_found_spec.rb +47 -0
  30. data/spec/models/cloud_storage_virus_scan_result_spec.rb +65 -0
  31. data/spec/models/virus_found_spec.rb +3 -4
  32. data/spec/models/virus_scan_advanced_result_spec.rb +14 -9
  33. data/spec/models/virus_scan_result_spec.rb +3 -4
  34. data/spec/models/website_scan_request_spec.rb +2 -3
  35. data/spec/models/website_scan_result_spec.rb +14 -9
  36. data/spec/spec_helper.rb +1 -1
  37. metadata +11 -2
@@ -0,0 +1,244 @@
1
+ =begin
2
+ #virusapi
3
+
4
+ #The Cloudmersive Virus Scan API lets you scan files and content for viruses and identify security issues with content.
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 CloudmersiveVirusScanApiClient
16
+ class ScanCloudStorageApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Scan an AWS S3 file for viruses
23
+ # Scan the contents of a single AWS S3 file and its 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.
24
+ # @param access_key AWS S3 access key for the S3 bucket; you can get this from My Security Credentials in the AWS console
25
+ # @param secret_key AWS S3 secret key for the S3 bucket; you can get this from My Security Credentials in the AWS console
26
+ # @param bucket_region Name of the region of the S3 bucket, such as 'US-East-1'
27
+ # @param bucket_name Name of the S3 bucket
28
+ # @param key_name Key name (also called file name) of the file in S3 that you wish to scan for viruses
29
+ # @param [Hash] opts the optional parameters
30
+ # @return [CloudStorageVirusScanResult]
31
+ def scan_cloud_storage_scan_aws_s3_file(access_key, secret_key, bucket_region, bucket_name, key_name, opts = {})
32
+ data, _status_code, _headers = scan_cloud_storage_scan_aws_s3_file_with_http_info(access_key, secret_key, bucket_region, bucket_name, key_name, opts)
33
+ data
34
+ end
35
+
36
+ # Scan an AWS S3 file for viruses
37
+ # Scan the contents of a single AWS S3 file and its 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.
38
+ # @param access_key AWS S3 access key for the S3 bucket; you can get this from My Security Credentials in the AWS console
39
+ # @param secret_key AWS S3 secret key for the S3 bucket; you can get this from My Security Credentials in the AWS console
40
+ # @param bucket_region Name of the region of the S3 bucket, such as 'US-East-1'
41
+ # @param bucket_name Name of the S3 bucket
42
+ # @param key_name Key name (also called file name) of the file in S3 that you wish to scan for viruses
43
+ # @param [Hash] opts the optional parameters
44
+ # @return [Array<(CloudStorageVirusScanResult, Fixnum, Hash)>] CloudStorageVirusScanResult data, response status code and response headers
45
+ def scan_cloud_storage_scan_aws_s3_file_with_http_info(access_key, secret_key, bucket_region, bucket_name, key_name, opts = {})
46
+ if @api_client.config.debugging
47
+ @api_client.config.logger.debug 'Calling API: ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file ...'
48
+ end
49
+ # verify the required parameter 'access_key' is set
50
+ if @api_client.config.client_side_validation && access_key.nil?
51
+ fail ArgumentError, "Missing the required parameter 'access_key' when calling ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file"
52
+ end
53
+ # verify the required parameter 'secret_key' is set
54
+ if @api_client.config.client_side_validation && secret_key.nil?
55
+ fail ArgumentError, "Missing the required parameter 'secret_key' when calling ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file"
56
+ end
57
+ # verify the required parameter 'bucket_region' is set
58
+ if @api_client.config.client_side_validation && bucket_region.nil?
59
+ fail ArgumentError, "Missing the required parameter 'bucket_region' when calling ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file"
60
+ end
61
+ # verify the required parameter 'bucket_name' is set
62
+ if @api_client.config.client_side_validation && bucket_name.nil?
63
+ fail ArgumentError, "Missing the required parameter 'bucket_name' when calling ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file"
64
+ end
65
+ # verify the required parameter 'key_name' is set
66
+ if @api_client.config.client_side_validation && key_name.nil?
67
+ fail ArgumentError, "Missing the required parameter 'key_name' when calling ScanCloudStorageApi.scan_cloud_storage_scan_aws_s3_file"
68
+ end
69
+ # resource path
70
+ local_var_path = '/virus/scan/cloud-storage/aws-s3/single'
71
+
72
+ # query parameters
73
+ query_params = {}
74
+
75
+ # header parameters
76
+ header_params = {}
77
+ # HTTP header 'Accept' (if needed)
78
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
79
+ # HTTP header 'Content-Type'
80
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
81
+ header_params[:'accessKey'] = access_key
82
+ header_params[:'secretKey'] = secret_key
83
+ header_params[:'bucketRegion'] = bucket_region
84
+ header_params[:'bucketName'] = bucket_name
85
+ header_params[:'keyName'] = key_name
86
+
87
+ # form parameters
88
+ form_params = {}
89
+
90
+ # http body (model)
91
+ post_body = nil
92
+ auth_names = ['Apikey']
93
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
94
+ :header_params => header_params,
95
+ :query_params => query_params,
96
+ :form_params => form_params,
97
+ :body => post_body,
98
+ :auth_names => auth_names,
99
+ :return_type => 'CloudStorageVirusScanResult')
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug "API called: ScanCloudStorageApi#scan_cloud_storage_scan_aws_s3_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
102
+ end
103
+ return data, status_code, headers
104
+ end
105
+ # Scan an Azure Blob for viruses
106
+ # Scan the contents of a single Azure Blob and its 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.
107
+ # @param connection_string Connection string for the Azure Blob Storage Account; you can get this connection string from the Access Keys tab of the Storage Account blade in the Azure Portal.
108
+ # @param container_name Name of the Blob container within the Azure Blob Storage account
109
+ # @param blob_path Path to the blob within the container, such as &#39;hello.pdf&#39; or &#39;/folder/subfolder/world.pdf&#39;
110
+ # @param [Hash] opts the optional parameters
111
+ # @return [CloudStorageVirusScanResult]
112
+ def scan_cloud_storage_scan_azure_blob(connection_string, container_name, blob_path, opts = {})
113
+ data, _status_code, _headers = scan_cloud_storage_scan_azure_blob_with_http_info(connection_string, container_name, blob_path, opts)
114
+ data
115
+ end
116
+
117
+ # Scan an Azure Blob for viruses
118
+ # Scan the contents of a single Azure Blob and its 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.
119
+ # @param connection_string Connection string for the Azure Blob Storage Account; you can get this connection string from the Access Keys tab of the Storage Account blade in the Azure Portal.
120
+ # @param container_name Name of the Blob container within the Azure Blob Storage account
121
+ # @param blob_path Path to the blob within the container, such as &#39;hello.pdf&#39; or &#39;/folder/subfolder/world.pdf&#39;
122
+ # @param [Hash] opts the optional parameters
123
+ # @return [Array<(CloudStorageVirusScanResult, Fixnum, Hash)>] CloudStorageVirusScanResult data, response status code and response headers
124
+ def scan_cloud_storage_scan_azure_blob_with_http_info(connection_string, container_name, blob_path, opts = {})
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug 'Calling API: ScanCloudStorageApi.scan_cloud_storage_scan_azure_blob ...'
127
+ end
128
+ # verify the required parameter 'connection_string' is set
129
+ if @api_client.config.client_side_validation && connection_string.nil?
130
+ fail ArgumentError, "Missing the required parameter 'connection_string' when calling ScanCloudStorageApi.scan_cloud_storage_scan_azure_blob"
131
+ end
132
+ # verify the required parameter 'container_name' is set
133
+ if @api_client.config.client_side_validation && container_name.nil?
134
+ fail ArgumentError, "Missing the required parameter 'container_name' when calling ScanCloudStorageApi.scan_cloud_storage_scan_azure_blob"
135
+ end
136
+ # verify the required parameter 'blob_path' is set
137
+ if @api_client.config.client_side_validation && blob_path.nil?
138
+ fail ArgumentError, "Missing the required parameter 'blob_path' when calling ScanCloudStorageApi.scan_cloud_storage_scan_azure_blob"
139
+ end
140
+ # resource path
141
+ local_var_path = '/virus/scan/cloud-storage/azure-blob/single'
142
+
143
+ # query parameters
144
+ query_params = {}
145
+
146
+ # header parameters
147
+ header_params = {}
148
+ # HTTP header 'Accept' (if needed)
149
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
150
+ # HTTP header 'Content-Type'
151
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
152
+ header_params[:'connectionString'] = connection_string
153
+ header_params[:'containerName'] = container_name
154
+ header_params[:'blobPath'] = blob_path
155
+
156
+ # form parameters
157
+ form_params = {}
158
+
159
+ # http body (model)
160
+ post_body = nil
161
+ auth_names = ['Apikey']
162
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
163
+ :header_params => header_params,
164
+ :query_params => query_params,
165
+ :form_params => form_params,
166
+ :body => post_body,
167
+ :auth_names => auth_names,
168
+ :return_type => 'CloudStorageVirusScanResult')
169
+ if @api_client.config.debugging
170
+ @api_client.config.logger.debug "API called: ScanCloudStorageApi#scan_cloud_storage_scan_azure_blob\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
171
+ end
172
+ return data, status_code, headers
173
+ end
174
+ # Scan an Google Cloud Platform (GCP) Storage file for viruses
175
+ # Scan the contents of a single Google Cloud Platform (GCP) Storage file and its 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.
176
+ # @param bucket_name Name of the bucket in Google Cloud Storage
177
+ # @param object_name Name of the object or file in Google Cloud Storage
178
+ # @param json_credential_file Service Account credential for Google Cloud stored in a JSON file.
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [CloudStorageVirusScanResult]
181
+ def scan_cloud_storage_scan_gcp_storage_file(bucket_name, object_name, json_credential_file, opts = {})
182
+ data, _status_code, _headers = scan_cloud_storage_scan_gcp_storage_file_with_http_info(bucket_name, object_name, json_credential_file, opts)
183
+ data
184
+ end
185
+
186
+ # Scan an Google Cloud Platform (GCP) Storage file for viruses
187
+ # Scan the contents of a single Google Cloud Platform (GCP) Storage file and its 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.
188
+ # @param bucket_name Name of the bucket in Google Cloud Storage
189
+ # @param object_name Name of the object or file in Google Cloud Storage
190
+ # @param json_credential_file Service Account credential for Google Cloud stored in a JSON file.
191
+ # @param [Hash] opts the optional parameters
192
+ # @return [Array<(CloudStorageVirusScanResult, Fixnum, Hash)>] CloudStorageVirusScanResult data, response status code and response headers
193
+ def scan_cloud_storage_scan_gcp_storage_file_with_http_info(bucket_name, object_name, json_credential_file, opts = {})
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug 'Calling API: ScanCloudStorageApi.scan_cloud_storage_scan_gcp_storage_file ...'
196
+ end
197
+ # verify the required parameter 'bucket_name' is set
198
+ if @api_client.config.client_side_validation && bucket_name.nil?
199
+ fail ArgumentError, "Missing the required parameter 'bucket_name' when calling ScanCloudStorageApi.scan_cloud_storage_scan_gcp_storage_file"
200
+ end
201
+ # verify the required parameter 'object_name' is set
202
+ if @api_client.config.client_side_validation && object_name.nil?
203
+ fail ArgumentError, "Missing the required parameter 'object_name' when calling ScanCloudStorageApi.scan_cloud_storage_scan_gcp_storage_file"
204
+ end
205
+ # verify the required parameter 'json_credential_file' is set
206
+ if @api_client.config.client_side_validation && json_credential_file.nil?
207
+ fail ArgumentError, "Missing the required parameter 'json_credential_file' when calling ScanCloudStorageApi.scan_cloud_storage_scan_gcp_storage_file"
208
+ end
209
+ # resource path
210
+ local_var_path = '/virus/scan/cloud-storage/gcp-storage/single'
211
+
212
+ # query parameters
213
+ query_params = {}
214
+
215
+ # header parameters
216
+ header_params = {}
217
+ # HTTP header 'Accept' (if needed)
218
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
219
+ # HTTP header 'Content-Type'
220
+ header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])
221
+ header_params[:'bucketName'] = bucket_name
222
+ header_params[:'objectName'] = object_name
223
+
224
+ # form parameters
225
+ form_params = {}
226
+ form_params['jsonCredentialFile'] = json_credential_file
227
+
228
+ # http body (model)
229
+ post_body = nil
230
+ auth_names = ['Apikey']
231
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
232
+ :header_params => header_params,
233
+ :query_params => query_params,
234
+ :form_params => form_params,
235
+ :body => post_body,
236
+ :auth_names => auth_names,
237
+ :return_type => 'CloudStorageVirusScanResult')
238
+ if @api_client.config.debugging
239
+ @api_client.config.logger.debug "API called: ScanCloudStorageApi#scan_cloud_storage_scan_gcp_storage_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
240
+ end
241
+ return data, status_code, headers
242
+ end
243
+ end
244
+ 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.3.1
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' => "application/json",
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
- (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
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 and content_disposition =~ /filename=/i
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
- return json_accept || accepts.join(',')
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
- return json_content_type || content_types.first
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.3.1
9
+ Swagger Codegen version: 2.4.14
10
10
 
11
11
  =end
12
12
 
@@ -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.3.1
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 = "" if @base_path == "/"
173
+ @base_path = '' if @base_path == '/'
174
174
  end
175
175
 
176
176
  def base_url
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #virusapi
3
+
4
+ #The Cloudmersive Virus Scan API lets you scan files and content for viruses and identify security issues with content.
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 CloudmersiveVirusScanApiClient
16
+ # Virus positively identified
17
+ class CloudStorageVirusFound
18
+ # Name of the file containing the virus
19
+ attr_accessor :file_name
20
+
21
+ # Name of the virus that was found
22
+ attr_accessor :virus_name
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'file_name' => :'FileName',
28
+ :'virus_name' => :'VirusName'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'file_name' => :'String',
36
+ :'virus_name' => :'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?(:'FileName')
49
+ self.file_name = attributes[:'FileName']
50
+ end
51
+
52
+ if attributes.has_key?(:'VirusName')
53
+ self.virus_name = attributes[:'VirusName']
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
+ file_name == o.file_name &&
76
+ virus_name == o.virus_name
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
+ [file_name, virus_name].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 = CloudmersiveVirusScanApiClient.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