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

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,189 +0,0 @@
1
- =begin
2
- #virusapi
3
-
4
- #Virus 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: unset
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveVirusScanApiClient
16
- # Request to scan a website for malicious content
17
- class WebsiteScanRequest
18
- # URL of the website to scan; should begin with http:// or https://
19
- attr_accessor :url
20
-
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'url' => :'Url'
26
- }
27
- end
28
-
29
- # Attribute type mapping.
30
- def self.swagger_types
31
- {
32
- :'url' => :'String'
33
- }
34
- end
35
-
36
- # Initializes the object
37
- # @param [Hash] attributes Model attributes in the form of hash
38
- def initialize(attributes = {})
39
- return unless attributes.is_a?(Hash)
40
-
41
- # convert string to symbol for hash key
42
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
-
44
- if attributes.has_key?(:'Url')
45
- self.url = attributes[:'Url']
46
- end
47
-
48
- end
49
-
50
- # Show invalid properties with the reasons. Usually used together with valid?
51
- # @return Array for valid properties with the reasons
52
- def list_invalid_properties
53
- invalid_properties = Array.new
54
- return invalid_properties
55
- end
56
-
57
- # Check to see if the all the properties in the model are valid
58
- # @return true if the model is valid
59
- def valid?
60
- return true
61
- end
62
-
63
- # Checks equality by comparing each attribute.
64
- # @param [Object] Object to be compared
65
- def ==(o)
66
- return true if self.equal?(o)
67
- self.class == o.class &&
68
- url == o.url
69
- end
70
-
71
- # @see the `==` method
72
- # @param [Object] Object to be compared
73
- def eql?(o)
74
- self == o
75
- end
76
-
77
- # Calculates hash code according to all attributes.
78
- # @return [Fixnum] Hash code
79
- def hash
80
- [url].hash
81
- end
82
-
83
- # Builds the object from hash
84
- # @param [Hash] attributes Model attributes in the form of hash
85
- # @return [Object] Returns the model itself
86
- def build_from_hash(attributes)
87
- return nil unless attributes.is_a?(Hash)
88
- self.class.swagger_types.each_pair do |key, type|
89
- if type =~ /\AArray<(.*)>/i
90
- # check to ensure the input is an array given that the the attribute
91
- # is documented as an array but the input is not
92
- if attributes[self.class.attribute_map[key]].is_a?(Array)
93
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
94
- end
95
- elsif !attributes[self.class.attribute_map[key]].nil?
96
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
97
- end # or else data not found in attributes(hash), not an issue as the data can be optional
98
- end
99
-
100
- self
101
- end
102
-
103
- # Deserializes the data based on type
104
- # @param string type Data type
105
- # @param string value Value to be deserialized
106
- # @return [Object] Deserialized data
107
- def _deserialize(type, value)
108
- case type.to_sym
109
- when :DateTime
110
- DateTime.parse(value)
111
- when :Date
112
- Date.parse(value)
113
- when :String
114
- value.to_s
115
- when :Integer
116
- value.to_i
117
- when :Float
118
- value.to_f
119
- when :BOOLEAN
120
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
121
- true
122
- else
123
- false
124
- end
125
- when :Object
126
- # generic object (usually a Hash), return directly
127
- value
128
- when /\AArray<(?<inner_type>.+)>\z/
129
- inner_type = Regexp.last_match[:inner_type]
130
- value.map { |v| _deserialize(inner_type, v) }
131
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
132
- k_type = Regexp.last_match[:k_type]
133
- v_type = Regexp.last_match[:v_type]
134
- {}.tap do |hash|
135
- value.each do |k, v|
136
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
137
- end
138
- end
139
- else # model
140
- temp_model = CloudmersiveVirusScanApiClient.const_get(type).new
141
- temp_model.build_from_hash(value)
142
- end
143
- end
144
-
145
- # Returns the string representation of the object
146
- # @return [String] String presentation of the object
147
- def to_s
148
- to_hash.to_s
149
- end
150
-
151
- # to_body is an alias to to_hash (backward compatibility)
152
- # @return [Hash] Returns the object in the form of hash
153
- def to_body
154
- to_hash
155
- end
156
-
157
- # Returns the object in the form of hash
158
- # @return [Hash] Returns the object in the form of hash
159
- def to_hash
160
- hash = {}
161
- self.class.attribute_map.each_pair do |attr, param|
162
- value = self.send(attr)
163
- next if value.nil?
164
- hash[param] = _to_hash(value)
165
- end
166
- hash
167
- end
168
-
169
- # Outputs non-array value in the form of hash
170
- # For object, use to_hash. Otherwise, just return the value
171
- # @param [Object] value Any valid value
172
- # @return [Hash] Returns the value in the form of hash
173
- def _to_hash(value)
174
- if value.is_a?(Array)
175
- value.compact.map{ |v| _to_hash(v) }
176
- elsif value.is_a?(Hash)
177
- {}.tap do |hash|
178
- value.each { |k, v| hash[k] = _to_hash(v) }
179
- end
180
- elsif value.respond_to? :to_hash
181
- value.to_hash
182
- else
183
- value
184
- end
185
- end
186
-
187
- end
188
-
189
- end
@@ -1,232 +0,0 @@
1
- =begin
2
- #virusapi
3
-
4
- #Virus 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: unset
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CloudmersiveVirusScanApiClient
16
- # Result of running a website scan
17
- class WebsiteScanResult
18
- # True if the scan contained no threats, false otherwise
19
- attr_accessor :clean_result
20
-
21
- # Type of threat returned; can be None, Malware, ForcedDownload or Phishing
22
- attr_accessor :website_threat_type
23
-
24
- class EnumAttributeValidator
25
- attr_reader :datatype
26
- attr_reader :allowable_values
27
-
28
- def initialize(datatype, allowable_values)
29
- @allowable_values = allowable_values.map do |value|
30
- case datatype.to_s
31
- when /Integer/i
32
- value.to_i
33
- when /Float/i
34
- value.to_f
35
- else
36
- value
37
- end
38
- end
39
- end
40
-
41
- def valid?(value)
42
- !value || allowable_values.include?(value)
43
- end
44
- end
45
-
46
- # Attribute mapping from ruby-style variable name to JSON key.
47
- def self.attribute_map
48
- {
49
- :'clean_result' => :'CleanResult',
50
- :'website_threat_type' => :'WebsiteThreatType'
51
- }
52
- end
53
-
54
- # Attribute type mapping.
55
- def self.swagger_types
56
- {
57
- :'clean_result' => :'BOOLEAN',
58
- :'website_threat_type' => :'String'
59
- }
60
- end
61
-
62
- # Initializes the object
63
- # @param [Hash] attributes Model attributes in the form of hash
64
- def initialize(attributes = {})
65
- return unless attributes.is_a?(Hash)
66
-
67
- # convert string to symbol for hash key
68
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
69
-
70
- if attributes.has_key?(:'CleanResult')
71
- self.clean_result = attributes[:'CleanResult']
72
- end
73
-
74
- if attributes.has_key?(:'WebsiteThreatType')
75
- self.website_threat_type = attributes[:'WebsiteThreatType']
76
- end
77
-
78
- end
79
-
80
- # Show invalid properties with the reasons. Usually used together with valid?
81
- # @return Array for valid properties with the reasons
82
- def list_invalid_properties
83
- invalid_properties = Array.new
84
- return invalid_properties
85
- end
86
-
87
- # Check to see if the all the properties in the model are valid
88
- # @return true if the model is valid
89
- def valid?
90
- website_threat_type_validator = EnumAttributeValidator.new('String', ["None", "Malware", "Phishing", "ForcedDownload"])
91
- return false unless website_threat_type_validator.valid?(@website_threat_type)
92
- return true
93
- end
94
-
95
- # Custom attribute writer method checking allowed values (enum).
96
- # @param [Object] website_threat_type Object to be assigned
97
- def website_threat_type=(website_threat_type)
98
- validator = EnumAttributeValidator.new('String', ["None", "Malware", "Phishing", "ForcedDownload"])
99
- unless validator.valid?(website_threat_type)
100
- fail ArgumentError, "invalid value for 'website_threat_type', must be one of #{validator.allowable_values}."
101
- end
102
- @website_threat_type = website_threat_type
103
- end
104
-
105
- # Checks equality by comparing each attribute.
106
- # @param [Object] Object to be compared
107
- def ==(o)
108
- return true if self.equal?(o)
109
- self.class == o.class &&
110
- clean_result == o.clean_result &&
111
- website_threat_type == o.website_threat_type
112
- end
113
-
114
- # @see the `==` method
115
- # @param [Object] Object to be compared
116
- def eql?(o)
117
- self == o
118
- end
119
-
120
- # Calculates hash code according to all attributes.
121
- # @return [Fixnum] Hash code
122
- def hash
123
- [clean_result, website_threat_type].hash
124
- end
125
-
126
- # Builds the object from hash
127
- # @param [Hash] attributes Model attributes in the form of hash
128
- # @return [Object] Returns the model itself
129
- def build_from_hash(attributes)
130
- return nil unless attributes.is_a?(Hash)
131
- self.class.swagger_types.each_pair do |key, type|
132
- if type =~ /\AArray<(.*)>/i
133
- # check to ensure the input is an array given that the the attribute
134
- # is documented as an array but the input is not
135
- if attributes[self.class.attribute_map[key]].is_a?(Array)
136
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
137
- end
138
- elsif !attributes[self.class.attribute_map[key]].nil?
139
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
- end # or else data not found in attributes(hash), not an issue as the data can be optional
141
- end
142
-
143
- self
144
- end
145
-
146
- # Deserializes the data based on type
147
- # @param string type Data type
148
- # @param string value Value to be deserialized
149
- # @return [Object] Deserialized data
150
- def _deserialize(type, value)
151
- case type.to_sym
152
- when :DateTime
153
- DateTime.parse(value)
154
- when :Date
155
- Date.parse(value)
156
- when :String
157
- value.to_s
158
- when :Integer
159
- value.to_i
160
- when :Float
161
- value.to_f
162
- when :BOOLEAN
163
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
- true
165
- else
166
- false
167
- end
168
- when :Object
169
- # generic object (usually a Hash), return directly
170
- value
171
- when /\AArray<(?<inner_type>.+)>\z/
172
- inner_type = Regexp.last_match[:inner_type]
173
- value.map { |v| _deserialize(inner_type, v) }
174
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
- k_type = Regexp.last_match[:k_type]
176
- v_type = Regexp.last_match[:v_type]
177
- {}.tap do |hash|
178
- value.each do |k, v|
179
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
- end
181
- end
182
- else # model
183
- temp_model = CloudmersiveVirusScanApiClient.const_get(type).new
184
- temp_model.build_from_hash(value)
185
- end
186
- end
187
-
188
- # Returns the string representation of the object
189
- # @return [String] String presentation of the object
190
- def to_s
191
- to_hash.to_s
192
- end
193
-
194
- # to_body is an alias to to_hash (backward compatibility)
195
- # @return [Hash] Returns the object in the form of hash
196
- def to_body
197
- to_hash
198
- end
199
-
200
- # Returns the object in the form of hash
201
- # @return [Hash] Returns the object in the form of hash
202
- def to_hash
203
- hash = {}
204
- self.class.attribute_map.each_pair do |attr, param|
205
- value = self.send(attr)
206
- next if value.nil?
207
- hash[param] = _to_hash(value)
208
- end
209
- hash
210
- end
211
-
212
- # Outputs non-array value in the form of hash
213
- # For object, use to_hash. Otherwise, just return the value
214
- # @param [Object] value Any valid value
215
- # @return [Hash] Returns the value in the form of hash
216
- def _to_hash(value)
217
- if value.is_a?(Array)
218
- value.compact.map{ |v| _to_hash(v) }
219
- elsif value.is_a?(Hash)
220
- {}.tap do |hash|
221
- value.each { |k, v| hash[k] = _to_hash(v) }
222
- end
223
- elsif value.respond_to? :to_hash
224
- value.to_hash
225
- else
226
- value
227
- end
228
- end
229
-
230
- end
231
-
232
- end
@@ -1,15 +0,0 @@
1
- =begin
2
- #virusapi
3
-
4
- #Virus 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: unset
10
-
11
- =end
12
-
13
- module CloudmersiveVirusScanApiClient
14
- VERSION = "1.3.0"
15
- end
@@ -1,59 +0,0 @@
1
- =begin
2
- #virusapi
3
-
4
- #Virus 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: unset
10
-
11
- =end
12
-
13
- require 'spec_helper'
14
- require 'json'
15
-
16
- # Unit tests for CloudmersiveVirusScanApiClient::ScanApi
17
- # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
- # Please update as you see appropriate
19
- describe 'ScanApi' do
20
- before do
21
- # run before each test
22
- @instance = CloudmersiveVirusScanApiClient::ScanApi.new
23
- end
24
-
25
- after do
26
- # run after each test
27
- end
28
-
29
- describe 'test an instance of ScanApi' do
30
- it 'should create an instance of ScanApi' do
31
- expect(@instance).to be_instance_of(CloudmersiveVirusScanApiClient::ScanApi)
32
- end
33
- end
34
-
35
- # unit tests for scan_file
36
- # Scan a file for viruses
37
- #
38
- # @param input_file Input file to perform the operation on.
39
- # @param [Hash] opts the optional parameters
40
- # @return [VirusScanResult]
41
- describe 'scan_file test' do
42
- it "should work" do
43
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
- end
45
- end
46
-
47
- # unit tests for scan_website
48
- # Scan a website for malicious content including viruses and threats (including Phishing)
49
- #
50
- # @param input
51
- # @param [Hash] opts the optional parameters
52
- # @return [WebsiteScanResult]
53
- describe 'scan_website test' do
54
- it "should work" do
55
- # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
56
- end
57
- end
58
-
59
- end