cloudmersive-virus-scan-api-client 2.0.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 +7 -0
- data/README.md +108 -0
- data/Rakefile +8 -0
- data/cloudmersive-virus-scan-api-client.gemspec +45 -0
- data/docs/ScanApi.md +185 -0
- data/docs/VirusFound.md +9 -0
- data/docs/VirusScanAdvancedResult.md +15 -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 +45 -0
- data/lib/cloudmersive-virus-scan-api-client/api/scan_api.rb +202 -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/virus_found.rb +196 -0
- data/lib/cloudmersive-virus-scan-api-client/models/virus_scan_advanced_result.rb +258 -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 +76 -0
- data/spec/api_client_spec.rb +243 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/virus_found_spec.rb +47 -0
- data/spec/models/virus_scan_advanced_result_spec.rb +83 -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 +34 -3
@@ -0,0 +1,38 @@
|
|
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
|
+
module CloudmersiveVirusScanApiClient
|
14
|
+
class ApiError < StandardError
|
15
|
+
attr_reader :code, :response_headers, :response_body
|
16
|
+
|
17
|
+
# Usage examples:
|
18
|
+
# ApiError.new
|
19
|
+
# ApiError.new("message")
|
20
|
+
# ApiError.new(:code => 500, :response_headers => {}, :response_body => "")
|
21
|
+
# ApiError.new(:code => 404, :message => "Not Found")
|
22
|
+
def initialize(arg = nil)
|
23
|
+
if arg.is_a? Hash
|
24
|
+
if arg.key?(:message) || arg.key?('message')
|
25
|
+
super(arg[:message] || arg['message'])
|
26
|
+
else
|
27
|
+
super arg
|
28
|
+
end
|
29
|
+
|
30
|
+
arg.each do |k, v|
|
31
|
+
instance_variable_set "@#{k}", v
|
32
|
+
end
|
33
|
+
else
|
34
|
+
super arg
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,209 @@
|
|
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 Configuration
|
17
|
+
# Defines url scheme
|
18
|
+
attr_accessor :scheme
|
19
|
+
|
20
|
+
# Defines url host
|
21
|
+
attr_accessor :host
|
22
|
+
|
23
|
+
# Defines url base path
|
24
|
+
attr_accessor :base_path
|
25
|
+
|
26
|
+
# Defines API keys used with API Key authentications.
|
27
|
+
#
|
28
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
29
|
+
#
|
30
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
31
|
+
# config.api_key['api_key'] = 'xxx'
|
32
|
+
attr_accessor :api_key
|
33
|
+
|
34
|
+
# Defines API key prefixes used with API Key authentications.
|
35
|
+
#
|
36
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
37
|
+
#
|
38
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
39
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
40
|
+
attr_accessor :api_key_prefix
|
41
|
+
|
42
|
+
# Defines the username used with HTTP basic authentication.
|
43
|
+
#
|
44
|
+
# @return [String]
|
45
|
+
attr_accessor :username
|
46
|
+
|
47
|
+
# Defines the password used with HTTP basic authentication.
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
attr_accessor :password
|
51
|
+
|
52
|
+
# Defines the access token (Bearer) used with OAuth2.
|
53
|
+
attr_accessor :access_token
|
54
|
+
|
55
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
56
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
57
|
+
# Default to false.
|
58
|
+
#
|
59
|
+
# @return [true, false]
|
60
|
+
attr_accessor :debugging
|
61
|
+
|
62
|
+
# Defines the logger used for debugging.
|
63
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
64
|
+
#
|
65
|
+
# @return [#debug]
|
66
|
+
attr_accessor :logger
|
67
|
+
|
68
|
+
# Defines the temporary folder to store downloaded files
|
69
|
+
# (for API endpoints that have file response).
|
70
|
+
# Default to use `Tempfile`.
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
attr_accessor :temp_folder_path
|
74
|
+
|
75
|
+
# The time limit for HTTP request in seconds.
|
76
|
+
# Default to 0 (never times out).
|
77
|
+
attr_accessor :timeout
|
78
|
+
|
79
|
+
# Set this to false to skip client side validation in the operation.
|
80
|
+
# Default to true.
|
81
|
+
# @return [true, false]
|
82
|
+
attr_accessor :client_side_validation
|
83
|
+
|
84
|
+
### TLS/SSL setting
|
85
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
86
|
+
# Default to true.
|
87
|
+
#
|
88
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
89
|
+
#
|
90
|
+
# @return [true, false]
|
91
|
+
attr_accessor :verify_ssl
|
92
|
+
|
93
|
+
### TLS/SSL setting
|
94
|
+
# Set this to false to skip verifying SSL host name
|
95
|
+
# Default to true.
|
96
|
+
#
|
97
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
98
|
+
#
|
99
|
+
# @return [true, false]
|
100
|
+
attr_accessor :verify_ssl_host
|
101
|
+
|
102
|
+
### TLS/SSL setting
|
103
|
+
# Set this to customize the certificate file to verify the peer.
|
104
|
+
#
|
105
|
+
# @return [String] the path to the certificate file
|
106
|
+
#
|
107
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
108
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
109
|
+
attr_accessor :ssl_ca_cert
|
110
|
+
|
111
|
+
### TLS/SSL setting
|
112
|
+
# Client certificate file (for client certificate)
|
113
|
+
attr_accessor :cert_file
|
114
|
+
|
115
|
+
### TLS/SSL setting
|
116
|
+
# Client private key file (for client certificate)
|
117
|
+
attr_accessor :key_file
|
118
|
+
|
119
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
120
|
+
# Default to nil.
|
121
|
+
#
|
122
|
+
# @see The params_encoding option of Ethon. Related source code:
|
123
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
124
|
+
attr_accessor :params_encoding
|
125
|
+
|
126
|
+
attr_accessor :inject_format
|
127
|
+
|
128
|
+
attr_accessor :force_ending_format
|
129
|
+
|
130
|
+
def initialize
|
131
|
+
@scheme = 'https'
|
132
|
+
@host = 'api.cloudmersive.com'
|
133
|
+
@base_path = ''
|
134
|
+
@api_key = {}
|
135
|
+
@api_key_prefix = {}
|
136
|
+
@timeout = 0
|
137
|
+
@client_side_validation = true
|
138
|
+
@verify_ssl = true
|
139
|
+
@verify_ssl_host = true
|
140
|
+
@params_encoding = nil
|
141
|
+
@cert_file = nil
|
142
|
+
@key_file = nil
|
143
|
+
@debugging = false
|
144
|
+
@inject_format = false
|
145
|
+
@force_ending_format = false
|
146
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
147
|
+
|
148
|
+
yield(self) if block_given?
|
149
|
+
end
|
150
|
+
|
151
|
+
# The default Configuration object.
|
152
|
+
def self.default
|
153
|
+
@@default ||= Configuration.new
|
154
|
+
end
|
155
|
+
|
156
|
+
def configure
|
157
|
+
yield(self) if block_given?
|
158
|
+
end
|
159
|
+
|
160
|
+
def scheme=(scheme)
|
161
|
+
# remove :// from scheme
|
162
|
+
@scheme = scheme.sub(/:\/\//, '')
|
163
|
+
end
|
164
|
+
|
165
|
+
def host=(host)
|
166
|
+
# remove http(s):// and anything after a slash
|
167
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
168
|
+
end
|
169
|
+
|
170
|
+
def base_path=(base_path)
|
171
|
+
# Add leading and trailing slashes to base_path
|
172
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
173
|
+
@base_path = '' if @base_path == '/'
|
174
|
+
end
|
175
|
+
|
176
|
+
def base_url
|
177
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
178
|
+
URI.encode(url)
|
179
|
+
end
|
180
|
+
|
181
|
+
# Gets API key (with prefix if set).
|
182
|
+
# @param [String] param_name the parameter name of API key auth
|
183
|
+
def api_key_with_prefix(param_name)
|
184
|
+
if @api_key_prefix[param_name]
|
185
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
186
|
+
else
|
187
|
+
@api_key[param_name]
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
# Gets Basic Auth token string
|
192
|
+
def basic_auth_token
|
193
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
194
|
+
end
|
195
|
+
|
196
|
+
# Returns Auth Settings hash for api client.
|
197
|
+
def auth_settings
|
198
|
+
{
|
199
|
+
'Apikey' =>
|
200
|
+
{
|
201
|
+
type: 'api_key',
|
202
|
+
in: 'header',
|
203
|
+
key: 'Apikey',
|
204
|
+
value: api_key_with_prefix('Apikey')
|
205
|
+
},
|
206
|
+
}
|
207
|
+
end
|
208
|
+
end
|
209
|
+
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,258 @@
|
|
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
|
+
# 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.
|
37
|
+
attr_accessor :verified_file_format
|
38
|
+
|
39
|
+
# Array of viruses found, if any
|
40
|
+
attr_accessor :found_viruses
|
41
|
+
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
43
|
+
def self.attribute_map
|
44
|
+
{
|
45
|
+
:'clean_result' => :'CleanResult',
|
46
|
+
:'contains_executable' => :'ContainsExecutable',
|
47
|
+
:'contains_invalid_file' => :'ContainsInvalidFile',
|
48
|
+
:'contains_script' => :'ContainsScript',
|
49
|
+
:'contains_password_protected_file' => :'ContainsPasswordProtectedFile',
|
50
|
+
:'contains_restricted_file_format' => :'ContainsRestrictedFileFormat',
|
51
|
+
:'verified_file_format' => :'VerifiedFileFormat',
|
52
|
+
:'found_viruses' => :'FoundViruses'
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.swagger_types
|
58
|
+
{
|
59
|
+
:'clean_result' => :'BOOLEAN',
|
60
|
+
:'contains_executable' => :'BOOLEAN',
|
61
|
+
:'contains_invalid_file' => :'BOOLEAN',
|
62
|
+
:'contains_script' => :'BOOLEAN',
|
63
|
+
:'contains_password_protected_file' => :'BOOLEAN',
|
64
|
+
:'contains_restricted_file_format' => :'BOOLEAN',
|
65
|
+
:'verified_file_format' => :'String',
|
66
|
+
:'found_viruses' => :'Array<VirusFound>'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
# Initializes the object
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
72
|
+
def initialize(attributes = {})
|
73
|
+
return unless attributes.is_a?(Hash)
|
74
|
+
|
75
|
+
# convert string to symbol for hash key
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
77
|
+
|
78
|
+
if attributes.has_key?(:'CleanResult')
|
79
|
+
self.clean_result = attributes[:'CleanResult']
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes.has_key?(:'ContainsExecutable')
|
83
|
+
self.contains_executable = attributes[:'ContainsExecutable']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'ContainsInvalidFile')
|
87
|
+
self.contains_invalid_file = attributes[:'ContainsInvalidFile']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'ContainsScript')
|
91
|
+
self.contains_script = attributes[:'ContainsScript']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'ContainsPasswordProtectedFile')
|
95
|
+
self.contains_password_protected_file = attributes[:'ContainsPasswordProtectedFile']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'ContainsRestrictedFileFormat')
|
99
|
+
self.contains_restricted_file_format = attributes[:'ContainsRestrictedFileFormat']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'VerifiedFileFormat')
|
103
|
+
self.verified_file_format = attributes[:'VerifiedFileFormat']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'FoundViruses')
|
107
|
+
if (value = attributes[:'FoundViruses']).is_a?(Array)
|
108
|
+
self.found_viruses = value
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
114
|
+
# @return Array for valid properties with the reasons
|
115
|
+
def list_invalid_properties
|
116
|
+
invalid_properties = Array.new
|
117
|
+
invalid_properties
|
118
|
+
end
|
119
|
+
|
120
|
+
# Check to see if the all the properties in the model are valid
|
121
|
+
# @return true if the model is valid
|
122
|
+
def valid?
|
123
|
+
true
|
124
|
+
end
|
125
|
+
|
126
|
+
# Checks equality by comparing each attribute.
|
127
|
+
# @param [Object] Object to be compared
|
128
|
+
def ==(o)
|
129
|
+
return true if self.equal?(o)
|
130
|
+
self.class == o.class &&
|
131
|
+
clean_result == o.clean_result &&
|
132
|
+
contains_executable == o.contains_executable &&
|
133
|
+
contains_invalid_file == o.contains_invalid_file &&
|
134
|
+
contains_script == o.contains_script &&
|
135
|
+
contains_password_protected_file == o.contains_password_protected_file &&
|
136
|
+
contains_restricted_file_format == o.contains_restricted_file_format &&
|
137
|
+
verified_file_format == o.verified_file_format &&
|
138
|
+
found_viruses == o.found_viruses
|
139
|
+
end
|
140
|
+
|
141
|
+
# @see the `==` method
|
142
|
+
# @param [Object] Object to be compared
|
143
|
+
def eql?(o)
|
144
|
+
self == o
|
145
|
+
end
|
146
|
+
|
147
|
+
# Calculates hash code according to all attributes.
|
148
|
+
# @return [Fixnum] Hash code
|
149
|
+
def hash
|
150
|
+
[clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, verified_file_format, found_viruses].hash
|
151
|
+
end
|
152
|
+
|
153
|
+
# Builds the object from hash
|
154
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
155
|
+
# @return [Object] Returns the model itself
|
156
|
+
def build_from_hash(attributes)
|
157
|
+
return nil unless attributes.is_a?(Hash)
|
158
|
+
self.class.swagger_types.each_pair do |key, type|
|
159
|
+
if type =~ /\AArray<(.*)>/i
|
160
|
+
# check to ensure the input is an array given that the attribute
|
161
|
+
# is documented as an array but the input is not
|
162
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
163
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
164
|
+
end
|
165
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
166
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
167
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
168
|
+
end
|
169
|
+
|
170
|
+
self
|
171
|
+
end
|
172
|
+
|
173
|
+
# Deserializes the data based on type
|
174
|
+
# @param string type Data type
|
175
|
+
# @param string value Value to be deserialized
|
176
|
+
# @return [Object] Deserialized data
|
177
|
+
def _deserialize(type, value)
|
178
|
+
case type.to_sym
|
179
|
+
when :DateTime
|
180
|
+
DateTime.parse(value)
|
181
|
+
when :Date
|
182
|
+
Date.parse(value)
|
183
|
+
when :String
|
184
|
+
value.to_s
|
185
|
+
when :Integer
|
186
|
+
value.to_i
|
187
|
+
when :Float
|
188
|
+
value.to_f
|
189
|
+
when :BOOLEAN
|
190
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
191
|
+
true
|
192
|
+
else
|
193
|
+
false
|
194
|
+
end
|
195
|
+
when :Object
|
196
|
+
# generic object (usually a Hash), return directly
|
197
|
+
value
|
198
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
199
|
+
inner_type = Regexp.last_match[:inner_type]
|
200
|
+
value.map { |v| _deserialize(inner_type, v) }
|
201
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
202
|
+
k_type = Regexp.last_match[:k_type]
|
203
|
+
v_type = Regexp.last_match[:v_type]
|
204
|
+
{}.tap do |hash|
|
205
|
+
value.each do |k, v|
|
206
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
else # model
|
210
|
+
temp_model = CloudmersiveVirusScanApiClient.const_get(type).new
|
211
|
+
temp_model.build_from_hash(value)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
# Returns the string representation of the object
|
216
|
+
# @return [String] String presentation of the object
|
217
|
+
def to_s
|
218
|
+
to_hash.to_s
|
219
|
+
end
|
220
|
+
|
221
|
+
# to_body is an alias to to_hash (backward compatibility)
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
223
|
+
def to_body
|
224
|
+
to_hash
|
225
|
+
end
|
226
|
+
|
227
|
+
# Returns the object in the form of hash
|
228
|
+
# @return [Hash] Returns the object in the form of hash
|
229
|
+
def to_hash
|
230
|
+
hash = {}
|
231
|
+
self.class.attribute_map.each_pair do |attr, param|
|
232
|
+
value = self.send(attr)
|
233
|
+
next if value.nil?
|
234
|
+
hash[param] = _to_hash(value)
|
235
|
+
end
|
236
|
+
hash
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
end
|