cloudmersive-virus-scan-api-client 2.0.1 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -0
  3. data/README.md +117 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-virus-scan-api-client.gemspec +45 -0
  6. data/docs/CloudStorageAdvancedVirusScanResult.md +19 -0
  7. data/docs/CloudStorageVirusFound.md +9 -0
  8. data/docs/CloudStorageVirusScanResult.md +12 -0
  9. data/docs/ScanApi.md +189 -0
  10. data/docs/ScanCloudStorageApi.md +428 -0
  11. data/docs/VirusFound.md +9 -0
  12. data/docs/VirusScanAdvancedResult.md +17 -0
  13. data/docs/VirusScanResult.md +9 -0
  14. data/docs/WebsiteScanRequest.md +8 -0
  15. data/docs/WebsiteScanResult.md +11 -0
  16. data/git_push.sh +55 -0
  17. data/lib/cloudmersive-virus-scan-api-client.rb +49 -0
  18. data/lib/cloudmersive-virus-scan-api-client/api/scan_api.rb +208 -0
  19. data/lib/cloudmersive-virus-scan-api-client/api/scan_cloud_storage_api.rb +519 -0
  20. data/lib/cloudmersive-virus-scan-api-client/api_client.rb +391 -0
  21. data/lib/cloudmersive-virus-scan-api-client/api_error.rb +38 -0
  22. data/lib/cloudmersive-virus-scan-api-client/configuration.rb +209 -0
  23. data/lib/cloudmersive-virus-scan-api-client/models/cloud_storage_advanced_virus_scan_result.rb +298 -0
  24. data/lib/cloudmersive-virus-scan-api-client/models/cloud_storage_virus_found.rb +196 -0
  25. data/lib/cloudmersive-virus-scan-api-client/models/cloud_storage_virus_scan_result.rb +228 -0
  26. data/lib/cloudmersive-virus-scan-api-client/models/virus_found.rb +196 -0
  27. data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_advanced_result.rb +278 -0
  28. data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_result.rb +198 -0
  29. data/lib/cloudmersive-virus-scan-api-client/models/website_scan_request.rb +186 -0
  30. data/lib/cloudmersive-virus-scan-api-client/models/website_scan_result.rb +252 -0
  31. data/lib/cloudmersive-virus-scan-api-client/version.rb +15 -0
  32. data/spec/api/scan_api_spec.rb +78 -0
  33. data/spec/api/scan_cloud_storage_api_spec.rb +141 -0
  34. data/spec/api_client_spec.rb +243 -0
  35. data/spec/configuration_spec.rb +42 -0
  36. data/spec/models/cloud_storage_advanced_virus_scan_result_spec.rb +107 -0
  37. data/spec/models/cloud_storage_virus_found_spec.rb +47 -0
  38. data/spec/models/cloud_storage_virus_scan_result_spec.rb +65 -0
  39. data/spec/models/virus_found_spec.rb +47 -0
  40. data/spec/models/virus_scan_advanced_result_spec.rb +95 -0
  41. data/spec/models/virus_scan_result_spec.rb +47 -0
  42. data/spec/models/website_scan_request_spec.rb +41 -0
  43. data/spec/models/website_scan_result_spec.rb +63 -0
  44. data/spec/spec_helper.rb +111 -0
  45. metadata +46 -3
@@ -0,0 +1,298 @@
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
+ # Result of running an advanced virus scan on cloud storage
17
+ class CloudStorageAdvancedVirusScanResult
18
+ # True if the operation of retrieving the file, and scanning it were successfully completed, false if the file could not be downloaded from cloud storage, or if the file could not be scanned. Note that successful completion does not mean the file is clean; for the output of the virus scanning operation itself, use the CleanResult and FoundViruses parameters.
19
+ attr_accessor :successful
20
+
21
+ # True if the scan contained no viruses, false otherwise
22
+ attr_accessor :clean_result
23
+
24
+ # True if the scan contained an executable (application code), which can be a significant risk factor
25
+ attr_accessor :contains_executable
26
+
27
+ # 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
28
+ attr_accessor :contains_invalid_file
29
+
30
+ # True if the scan contained a script (such as a PHP script, Python script, etc.) which can be a significant risk factor
31
+ attr_accessor :contains_script
32
+
33
+ # True if the scan contained a password protected or encrypted file, which can be a significant risk factor
34
+ attr_accessor :contains_password_protected_file
35
+
36
+ # 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
37
+ attr_accessor :contains_restricted_file_format
38
+
39
+ # True if the uploaded file contains embedded Macros of other embedded threats within the document, which can be a significant risk factor
40
+ attr_accessor :contains_macros
41
+
42
+ # 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.
43
+ attr_accessor :verified_file_format
44
+
45
+ # Array of viruses found, if any
46
+ attr_accessor :found_viruses
47
+
48
+ # Detailed error message if the operation was not successful
49
+ attr_accessor :error_detailed_description
50
+
51
+ # Size in bytes of the file that was retrieved and scanned
52
+ attr_accessor :file_size
53
+
54
+ # Attribute mapping from ruby-style variable name to JSON key.
55
+ def self.attribute_map
56
+ {
57
+ :'successful' => :'Successful',
58
+ :'clean_result' => :'CleanResult',
59
+ :'contains_executable' => :'ContainsExecutable',
60
+ :'contains_invalid_file' => :'ContainsInvalidFile',
61
+ :'contains_script' => :'ContainsScript',
62
+ :'contains_password_protected_file' => :'ContainsPasswordProtectedFile',
63
+ :'contains_restricted_file_format' => :'ContainsRestrictedFileFormat',
64
+ :'contains_macros' => :'ContainsMacros',
65
+ :'verified_file_format' => :'VerifiedFileFormat',
66
+ :'found_viruses' => :'FoundViruses',
67
+ :'error_detailed_description' => :'ErrorDetailedDescription',
68
+ :'file_size' => :'FileSize'
69
+ }
70
+ end
71
+
72
+ # Attribute type mapping.
73
+ def self.swagger_types
74
+ {
75
+ :'successful' => :'BOOLEAN',
76
+ :'clean_result' => :'BOOLEAN',
77
+ :'contains_executable' => :'BOOLEAN',
78
+ :'contains_invalid_file' => :'BOOLEAN',
79
+ :'contains_script' => :'BOOLEAN',
80
+ :'contains_password_protected_file' => :'BOOLEAN',
81
+ :'contains_restricted_file_format' => :'BOOLEAN',
82
+ :'contains_macros' => :'BOOLEAN',
83
+ :'verified_file_format' => :'String',
84
+ :'found_viruses' => :'Array<CloudStorageVirusFound>',
85
+ :'error_detailed_description' => :'String',
86
+ :'file_size' => :'Integer'
87
+ }
88
+ end
89
+
90
+ # Initializes the object
91
+ # @param [Hash] attributes Model attributes in the form of hash
92
+ def initialize(attributes = {})
93
+ return unless attributes.is_a?(Hash)
94
+
95
+ # convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
97
+
98
+ if attributes.has_key?(:'Successful')
99
+ self.successful = attributes[:'Successful']
100
+ end
101
+
102
+ if attributes.has_key?(:'CleanResult')
103
+ self.clean_result = attributes[:'CleanResult']
104
+ end
105
+
106
+ if attributes.has_key?(:'ContainsExecutable')
107
+ self.contains_executable = attributes[:'ContainsExecutable']
108
+ end
109
+
110
+ if attributes.has_key?(:'ContainsInvalidFile')
111
+ self.contains_invalid_file = attributes[:'ContainsInvalidFile']
112
+ end
113
+
114
+ if attributes.has_key?(:'ContainsScript')
115
+ self.contains_script = attributes[:'ContainsScript']
116
+ end
117
+
118
+ if attributes.has_key?(:'ContainsPasswordProtectedFile')
119
+ self.contains_password_protected_file = attributes[:'ContainsPasswordProtectedFile']
120
+ end
121
+
122
+ if attributes.has_key?(:'ContainsRestrictedFileFormat')
123
+ self.contains_restricted_file_format = attributes[:'ContainsRestrictedFileFormat']
124
+ end
125
+
126
+ if attributes.has_key?(:'ContainsMacros')
127
+ self.contains_macros = attributes[:'ContainsMacros']
128
+ end
129
+
130
+ if attributes.has_key?(:'VerifiedFileFormat')
131
+ self.verified_file_format = attributes[:'VerifiedFileFormat']
132
+ end
133
+
134
+ if attributes.has_key?(:'FoundViruses')
135
+ if (value = attributes[:'FoundViruses']).is_a?(Array)
136
+ self.found_viruses = value
137
+ end
138
+ end
139
+
140
+ if attributes.has_key?(:'ErrorDetailedDescription')
141
+ self.error_detailed_description = attributes[:'ErrorDetailedDescription']
142
+ end
143
+
144
+ if attributes.has_key?(:'FileSize')
145
+ self.file_size = attributes[:'FileSize']
146
+ end
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties with the reasons
151
+ def list_invalid_properties
152
+ invalid_properties = Array.new
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ successful == o.successful &&
168
+ clean_result == o.clean_result &&
169
+ contains_executable == o.contains_executable &&
170
+ contains_invalid_file == o.contains_invalid_file &&
171
+ contains_script == o.contains_script &&
172
+ contains_password_protected_file == o.contains_password_protected_file &&
173
+ contains_restricted_file_format == o.contains_restricted_file_format &&
174
+ contains_macros == o.contains_macros &&
175
+ verified_file_format == o.verified_file_format &&
176
+ found_viruses == o.found_viruses &&
177
+ error_detailed_description == o.error_detailed_description &&
178
+ file_size == o.file_size
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Fixnum] Hash code
189
+ def hash
190
+ [successful, clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, verified_file_format, found_viruses, error_detailed_description, file_size].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ self.class.swagger_types.each_pair do |key, type|
199
+ if type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
203
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
204
+ end
205
+ elsif !attributes[self.class.attribute_map[key]].nil?
206
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
207
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
208
+ end
209
+
210
+ self
211
+ end
212
+
213
+ # Deserializes the data based on type
214
+ # @param string type Data type
215
+ # @param string value Value to be deserialized
216
+ # @return [Object] Deserialized data
217
+ def _deserialize(type, value)
218
+ case type.to_sym
219
+ when :DateTime
220
+ DateTime.parse(value)
221
+ when :Date
222
+ Date.parse(value)
223
+ when :String
224
+ value.to_s
225
+ when :Integer
226
+ value.to_i
227
+ when :Float
228
+ value.to_f
229
+ when :BOOLEAN
230
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
231
+ true
232
+ else
233
+ false
234
+ end
235
+ when :Object
236
+ # generic object (usually a Hash), return directly
237
+ value
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ temp_model = CloudmersiveVirusScanApiClient.const_get(type).new
251
+ temp_model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ # Returns the string representation of the object
256
+ # @return [String] String presentation of the object
257
+ def to_s
258
+ to_hash.to_s
259
+ end
260
+
261
+ # to_body is an alias to to_hash (backward compatibility)
262
+ # @return [Hash] Returns the object in the form of hash
263
+ def to_body
264
+ to_hash
265
+ end
266
+
267
+ # Returns the object in the form of hash
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_hash
270
+ hash = {}
271
+ self.class.attribute_map.each_pair do |attr, param|
272
+ value = self.send(attr)
273
+ next if value.nil?
274
+ hash[param] = _to_hash(value)
275
+ end
276
+ hash
277
+ end
278
+
279
+ # Outputs non-array value in the form of hash
280
+ # For object, use to_hash. Otherwise, just return the value
281
+ # @param [Object] value Any valid value
282
+ # @return [Hash] Returns the value in the form of hash
283
+ def _to_hash(value)
284
+ if value.is_a?(Array)
285
+ value.compact.map { |v| _to_hash(v) }
286
+ elsif value.is_a?(Hash)
287
+ {}.tap do |hash|
288
+ value.each { |k, v| hash[k] = _to_hash(v) }
289
+ end
290
+ elsif value.respond_to? :to_hash
291
+ value.to_hash
292
+ else
293
+ value
294
+ end
295
+ end
296
+
297
+ end
298
+ end
@@ -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