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