cloudmersive-virus-scan-api-client 1.2.9 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/docs/ScanApi.md +53 -0
- data/docs/WebsiteScanRequest.md +8 -0
- data/docs/WebsiteScanResult.md +9 -0
- data/lib/cloudmersive-virus-scan-api-client.rb +2 -0
- data/lib/cloudmersive-virus-scan-api-client/api/scan_api.rb +55 -0
- data/lib/cloudmersive-virus-scan-api-client/models/website_scan_request.rb +189 -0
- data/lib/cloudmersive-virus-scan-api-client/models/website_scan_result.rb +232 -0
- data/lib/cloudmersive-virus-scan-api-client/version.rb +1 -1
- data/spec/api/scan_api_spec.rb +12 -0
- data/spec/models/website_scan_request_spec.rb +42 -0
- data/spec/models/website_scan_result_spec.rb +52 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ab657198529a457e44b7cd0fe9f000ba92157fcf5c3b877e611f3fc9e3e3b14
|
4
|
+
data.tar.gz: dbbaf7736d944a5aa34c9c06334b339a309fecc8cd9ecd1146c5406ee282af24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6f5cf69ab63b1631d9edeb516ac8349df8099a753a137af88edc435a142cdfade582c7cea669b8e7ef37aba41434543a9a1391f31108edae41beb2bfca1fd01
|
7
|
+
data.tar.gz: 640d17746bc5445339a1c26a2bd3a5e006eaa0109a29f349a686fc8174e1ff2143ef60e4c1744a5162609b397be85d0600b3a528fd3a899ec752bcf0563532d6
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Virus API lets you scan files and content for viruses and identify security issu
|
|
7
7
|
This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
8
8
|
|
9
9
|
- API version: v1
|
10
|
-
- Package version: 1.
|
10
|
+
- Package version: 1.3.0
|
11
11
|
- Build package: io.swagger.codegen.languages.RubyClientCodegen
|
12
12
|
|
13
13
|
## Installation
|
@@ -23,15 +23,15 @@ gem build cloudmersive-virus-scan-api-client.gemspec
|
|
23
23
|
Then either install the gem locally:
|
24
24
|
|
25
25
|
```shell
|
26
|
-
gem install ./cloudmersive-virus-scan-api-client-1.
|
26
|
+
gem install ./cloudmersive-virus-scan-api-client-1.3.0.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-virus-scan-api-client-1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-virus-scan-api-client-1.3.0.gem` to install the development dependencies)
|
29
29
|
|
30
30
|
or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
|
31
31
|
|
32
32
|
Finally add this to the Gemfile:
|
33
33
|
|
34
|
-
gem 'cloudmersive-virus-scan-api-client', '~> 1.
|
34
|
+
gem 'cloudmersive-virus-scan-api-client', '~> 1.3.0'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -84,12 +84,15 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
84
84
|
Class | Method | HTTP request | Description
|
85
85
|
------------ | ------------- | ------------- | -------------
|
86
86
|
*CloudmersiveVirusScanApiClient::ScanApi* | [**scan_file**](docs/ScanApi.md#scan_file) | **POST** /virus/scan/file | Scan a file for viruses
|
87
|
+
*CloudmersiveVirusScanApiClient::ScanApi* | [**scan_website**](docs/ScanApi.md#scan_website) | **POST** /virus/scan/website | Scan a website for malicious content including viruses and threats (including Phishing)
|
87
88
|
|
88
89
|
|
89
90
|
## Documentation for Models
|
90
91
|
|
91
92
|
- [CloudmersiveVirusScanApiClient::VirusFound](docs/VirusFound.md)
|
92
93
|
- [CloudmersiveVirusScanApiClient::VirusScanResult](docs/VirusScanResult.md)
|
94
|
+
- [CloudmersiveVirusScanApiClient::WebsiteScanRequest](docs/WebsiteScanRequest.md)
|
95
|
+
- [CloudmersiveVirusScanApiClient::WebsiteScanResult](docs/WebsiteScanResult.md)
|
93
96
|
|
94
97
|
|
95
98
|
## Documentation for Authorization
|
data/docs/ScanApi.md
CHANGED
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
7
|
[**scan_file**](ScanApi.md#scan_file) | **POST** /virus/scan/file | Scan a file for viruses
|
8
|
+
[**scan_website**](ScanApi.md#scan_website) | **POST** /virus/scan/website | Scan a website for malicious content including viruses and threats (including Phishing)
|
8
9
|
|
9
10
|
|
10
11
|
# **scan_file**
|
@@ -59,3 +60,55 @@ Name | Type | Description | Notes
|
|
59
60
|
|
60
61
|
|
61
62
|
|
63
|
+
# **scan_website**
|
64
|
+
> WebsiteScanResult scan_website(input)
|
65
|
+
|
66
|
+
Scan a website for malicious content including viruses and threats (including Phishing)
|
67
|
+
|
68
|
+
### Example
|
69
|
+
```ruby
|
70
|
+
# load the gem
|
71
|
+
require 'cloudmersive-virus-scan-api-client'
|
72
|
+
# setup authorization
|
73
|
+
CloudmersiveVirusScanApiClient.configure do |config|
|
74
|
+
# Configure API key authorization: Apikey
|
75
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
76
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
77
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
78
|
+
end
|
79
|
+
|
80
|
+
api_instance = CloudmersiveVirusScanApiClient::ScanApi.new
|
81
|
+
|
82
|
+
input = CloudmersiveVirusScanApiClient::WebsiteScanRequest.new # WebsiteScanRequest |
|
83
|
+
|
84
|
+
|
85
|
+
begin
|
86
|
+
#Scan a website for malicious content including viruses and threats (including Phishing)
|
87
|
+
result = api_instance.scan_website(input)
|
88
|
+
p result
|
89
|
+
rescue CloudmersiveVirusScanApiClient::ApiError => e
|
90
|
+
puts "Exception when calling ScanApi->scan_website: #{e}"
|
91
|
+
end
|
92
|
+
```
|
93
|
+
|
94
|
+
### Parameters
|
95
|
+
|
96
|
+
Name | Type | Description | Notes
|
97
|
+
------------- | ------------- | ------------- | -------------
|
98
|
+
**input** | [**WebsiteScanRequest**](WebsiteScanRequest.md)| |
|
99
|
+
|
100
|
+
### Return type
|
101
|
+
|
102
|
+
[**WebsiteScanResult**](WebsiteScanResult.md)
|
103
|
+
|
104
|
+
### Authorization
|
105
|
+
|
106
|
+
[Apikey](../README.md#Apikey)
|
107
|
+
|
108
|
+
### HTTP request headers
|
109
|
+
|
110
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
111
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
112
|
+
|
113
|
+
|
114
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# CloudmersiveVirusScanApiClient::WebsiteScanRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**url** | **String** | URL of the website to scan; should begin with http:// or https:// | [optional]
|
7
|
+
|
8
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# CloudmersiveVirusScanApiClient::WebsiteScanResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**clean_result** | **BOOLEAN** | True if the scan contained no threats, false otherwise | [optional]
|
7
|
+
**website_threat_type** | **String** | Type of threat returned; can be None, Malware, ForcedDownload or Phishing | [optional]
|
8
|
+
|
9
|
+
|
@@ -19,6 +19,8 @@ require 'cloudmersive-virus-scan-api-client/configuration'
|
|
19
19
|
# Models
|
20
20
|
require 'cloudmersive-virus-scan-api-client/models/virus_found'
|
21
21
|
require 'cloudmersive-virus-scan-api-client/models/virus_scan_result'
|
22
|
+
require 'cloudmersive-virus-scan-api-client/models/website_scan_request'
|
23
|
+
require 'cloudmersive-virus-scan-api-client/models/website_scan_result'
|
22
24
|
|
23
25
|
# APIs
|
24
26
|
require 'cloudmersive-virus-scan-api-client/api/scan_api'
|
@@ -75,5 +75,60 @@ module CloudmersiveVirusScanApiClient
|
|
75
75
|
end
|
76
76
|
return data, status_code, headers
|
77
77
|
end
|
78
|
+
|
79
|
+
# Scan a website for malicious content including viruses and threats (including Phishing)
|
80
|
+
#
|
81
|
+
# @param input
|
82
|
+
# @param [Hash] opts the optional parameters
|
83
|
+
# @return [WebsiteScanResult]
|
84
|
+
def scan_website(input, opts = {})
|
85
|
+
data, _status_code, _headers = scan_website_with_http_info(input, opts)
|
86
|
+
return data
|
87
|
+
end
|
88
|
+
|
89
|
+
# Scan a website for malicious content including viruses and threats (including Phishing)
|
90
|
+
#
|
91
|
+
# @param input
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @return [Array<(WebsiteScanResult, Fixnum, Hash)>] WebsiteScanResult data, response status code and response headers
|
94
|
+
def scan_website_with_http_info(input, opts = {})
|
95
|
+
if @api_client.config.debugging
|
96
|
+
@api_client.config.logger.debug "Calling API: ScanApi.scan_website ..."
|
97
|
+
end
|
98
|
+
# verify the required parameter 'input' is set
|
99
|
+
if @api_client.config.client_side_validation && input.nil?
|
100
|
+
fail ArgumentError, "Missing the required parameter 'input' when calling ScanApi.scan_website"
|
101
|
+
end
|
102
|
+
# resource path
|
103
|
+
local_var_path = "/virus/scan/website"
|
104
|
+
|
105
|
+
# query parameters
|
106
|
+
query_params = {}
|
107
|
+
|
108
|
+
# header parameters
|
109
|
+
header_params = {}
|
110
|
+
# HTTP header 'Accept' (if needed)
|
111
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
112
|
+
# HTTP header 'Content-Type'
|
113
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
114
|
+
|
115
|
+
# form parameters
|
116
|
+
form_params = {}
|
117
|
+
|
118
|
+
# http body (model)
|
119
|
+
post_body = @api_client.object_to_http_body(input)
|
120
|
+
auth_names = ['Apikey']
|
121
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
122
|
+
:header_params => header_params,
|
123
|
+
:query_params => query_params,
|
124
|
+
:form_params => form_params,
|
125
|
+
:body => post_body,
|
126
|
+
:auth_names => auth_names,
|
127
|
+
:return_type => 'WebsiteScanResult')
|
128
|
+
if @api_client.config.debugging
|
129
|
+
@api_client.config.logger.debug "API called: ScanApi#scan_website\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
130
|
+
end
|
131
|
+
return data, status_code, headers
|
132
|
+
end
|
78
133
|
end
|
79
134
|
end
|
@@ -0,0 +1,189 @@
|
|
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
|
@@ -0,0 +1,232 @@
|
|
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
|
data/spec/api/scan_api_spec.rb
CHANGED
@@ -44,4 +44,16 @@ describe 'ScanApi' do
|
|
44
44
|
end
|
45
45
|
end
|
46
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
|
+
|
47
59
|
end
|
@@ -0,0 +1,42 @@
|
|
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
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveVirusScanApiClient::WebsiteScanRequest
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'WebsiteScanRequest' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveVirusScanApiClient::WebsiteScanRequest.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of WebsiteScanRequest' do
|
31
|
+
it 'should create an instance of WebsiteScanRequest' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveVirusScanApiClient::WebsiteScanRequest)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "url"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,52 @@
|
|
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
|
+
require 'date'
|
16
|
+
|
17
|
+
# Unit tests for CloudmersiveVirusScanApiClient::WebsiteScanResult
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'WebsiteScanResult' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveVirusScanApiClient::WebsiteScanResult.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of WebsiteScanResult' do
|
31
|
+
it 'should create an instance of WebsiteScanResult' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveVirusScanApiClient::WebsiteScanResult)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "clean_result"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "website_threat_type"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["None", "Malware", "Phishing", "ForcedDownload"])
|
45
|
+
#validator.allowable_values.each do |value|
|
46
|
+
# expect { @instance.website_threat_type = value }.not_to raise_error
|
47
|
+
#end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudmersive-virus-scan-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -205,6 +205,8 @@ files:
|
|
205
205
|
- "./docs/ScanApi.md"
|
206
206
|
- "./docs/VirusFound.md"
|
207
207
|
- "./docs/VirusScanResult.md"
|
208
|
+
- "./docs/WebsiteScanRequest.md"
|
209
|
+
- "./docs/WebsiteScanResult.md"
|
208
210
|
- "./git_push.sh"
|
209
211
|
- "./lib/cloudmersive-virus-scan-api-client.rb"
|
210
212
|
- "./lib/cloudmersive-virus-scan-api-client/api/scan_api.rb"
|
@@ -213,12 +215,16 @@ files:
|
|
213
215
|
- "./lib/cloudmersive-virus-scan-api-client/configuration.rb"
|
214
216
|
- "./lib/cloudmersive-virus-scan-api-client/models/virus_found.rb"
|
215
217
|
- "./lib/cloudmersive-virus-scan-api-client/models/virus_scan_result.rb"
|
218
|
+
- "./lib/cloudmersive-virus-scan-api-client/models/website_scan_request.rb"
|
219
|
+
- "./lib/cloudmersive-virus-scan-api-client/models/website_scan_result.rb"
|
216
220
|
- "./lib/cloudmersive-virus-scan-api-client/version.rb"
|
217
221
|
- "./spec/api/scan_api_spec.rb"
|
218
222
|
- "./spec/api_client_spec.rb"
|
219
223
|
- "./spec/configuration_spec.rb"
|
220
224
|
- "./spec/models/virus_found_spec.rb"
|
221
225
|
- "./spec/models/virus_scan_result_spec.rb"
|
226
|
+
- "./spec/models/website_scan_request_spec.rb"
|
227
|
+
- "./spec/models/website_scan_result_spec.rb"
|
222
228
|
- "./spec/spec_helper.rb"
|
223
229
|
homepage: https://www.cloudmersive.com/virus-api
|
224
230
|
licenses:
|