cloudmersive-validate-api-client 2.1.6 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/docs/DomainApi.md +165 -0
  4. data/docs/HtmlSsrfDetectionResult.md +9 -0
  5. data/docs/IsAdminPathResponse.md +9 -0
  6. data/docs/PhishingCheckRequest.md +8 -0
  7. data/docs/PhishingCheckResponse.md +9 -0
  8. data/docs/SqlInjectionCheckBatchRequest.md +9 -0
  9. data/docs/SqlInjectionCheckBatchResponse.md +8 -0
  10. data/docs/SqlInjectionCheckRequestItem.md +8 -0
  11. data/docs/SqlInjectionDetectionResult.md +10 -0
  12. data/docs/TextInputApi.md +288 -1
  13. data/docs/UrlSafetyCheckRequestFull.md +8 -0
  14. data/docs/UrlSafetyCheckResponseFull.md +9 -0
  15. data/docs/XxeDetectionBatchRequest.md +8 -0
  16. data/docs/XxeDetectionBatchResponse.md +8 -0
  17. data/docs/XxeDetectionRequestItem.md +11 -0
  18. data/docs/XxeDetectionResult.md +9 -0
  19. data/lib/cloudmersive-validate-api-client.rb +14 -0
  20. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +162 -0
  21. data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +284 -2
  22. data/lib/cloudmersive-validate-api-client/models/html_ssrf_detection_result.rb +196 -0
  23. data/lib/cloudmersive-validate-api-client/models/is_admin_path_response.rb +196 -0
  24. data/lib/cloudmersive-validate-api-client/models/phishing_check_request.rb +186 -0
  25. data/lib/cloudmersive-validate-api-client/models/phishing_check_response.rb +196 -0
  26. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_request.rb +198 -0
  27. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_response.rb +188 -0
  28. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_request_item.rb +186 -0
  29. data/lib/cloudmersive-validate-api-client/models/sql_injection_detection_result.rb +206 -0
  30. data/lib/cloudmersive-validate-api-client/models/url_safety_check_request_full.rb +186 -0
  31. data/lib/cloudmersive-validate-api-client/models/url_safety_check_response_full.rb +196 -0
  32. data/lib/cloudmersive-validate-api-client/models/xxe_detection_batch_request.rb +188 -0
  33. data/lib/cloudmersive-validate-api-client/models/xxe_detection_batch_response.rb +188 -0
  34. data/lib/cloudmersive-validate-api-client/models/xxe_detection_request_item.rb +220 -0
  35. data/lib/cloudmersive-validate-api-client/models/xxe_detection_result.rb +196 -0
  36. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  37. data/spec/api/domain_api_spec.rb +36 -0
  38. data/spec/api/text_input_api_spec.rb +65 -1
  39. data/spec/models/html_ssrf_detection_result_spec.rb +47 -0
  40. data/spec/models/is_admin_path_response_spec.rb +47 -0
  41. data/spec/models/phishing_check_request_spec.rb +41 -0
  42. data/spec/models/phishing_check_response_spec.rb +47 -0
  43. data/spec/models/sql_injection_check_batch_request_spec.rb +47 -0
  44. data/spec/models/sql_injection_check_batch_response_spec.rb +41 -0
  45. data/spec/models/sql_injection_check_request_item_spec.rb +41 -0
  46. data/spec/models/sql_injection_detection_result_spec.rb +53 -0
  47. data/spec/models/url_safety_check_request_full_spec.rb +41 -0
  48. data/spec/models/url_safety_check_response_full_spec.rb +47 -0
  49. data/spec/models/xxe_detection_batch_request_spec.rb +41 -0
  50. data/spec/models/xxe_detection_batch_response_spec.rb +41 -0
  51. data/spec/models/xxe_detection_request_item_spec.rb +59 -0
  52. data/spec/models/xxe_detection_result_spec.rb +47 -0
  53. metadata +44 -2
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #validateapi
3
+
4
+ #The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
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 CloudmersiveValidateApiClient
16
+ # Individual item to detect for XXE
17
+ class XxeDetectionRequestItem
18
+ # Individual input text item to protect from XXE
19
+ attr_accessor :input_text
20
+
21
+ # Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
22
+ attr_accessor :allow_internet_urls
23
+
24
+ # Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
25
+ attr_accessor :known_safe_urls
26
+
27
+ # Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
28
+ attr_accessor :known_unsafe_urls
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'input_text' => :'InputText',
34
+ :'allow_internet_urls' => :'AllowInternetUrls',
35
+ :'known_safe_urls' => :'KnownSafeUrls',
36
+ :'known_unsafe_urls' => :'KnownUnsafeUrls'
37
+ }
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.swagger_types
42
+ {
43
+ :'input_text' => :'String',
44
+ :'allow_internet_urls' => :'BOOLEAN',
45
+ :'known_safe_urls' => :'Array<String>',
46
+ :'known_unsafe_urls' => :'Array<String>'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'InputText')
59
+ self.input_text = attributes[:'InputText']
60
+ end
61
+
62
+ if attributes.has_key?(:'AllowInternetUrls')
63
+ self.allow_internet_urls = attributes[:'AllowInternetUrls']
64
+ end
65
+
66
+ if attributes.has_key?(:'KnownSafeUrls')
67
+ if (value = attributes[:'KnownSafeUrls']).is_a?(Array)
68
+ self.known_safe_urls = value
69
+ end
70
+ end
71
+
72
+ if attributes.has_key?(:'KnownUnsafeUrls')
73
+ if (value = attributes[:'KnownUnsafeUrls']).is_a?(Array)
74
+ self.known_unsafe_urls = value
75
+ end
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ input_text == o.input_text &&
98
+ allow_internet_urls == o.allow_internet_urls &&
99
+ known_safe_urls == o.known_safe_urls &&
100
+ known_unsafe_urls == o.known_unsafe_urls
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Fixnum] Hash code
111
+ def hash
112
+ [input_text, allow_internet_urls, known_safe_urls, known_unsafe_urls].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.swagger_types.each_pair do |key, type|
121
+ if type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
130
+ end
131
+
132
+ self
133
+ end
134
+
135
+ # Deserializes the data based on type
136
+ # @param string type Data type
137
+ # @param string value Value to be deserialized
138
+ # @return [Object] Deserialized data
139
+ def _deserialize(type, value)
140
+ case type.to_sym
141
+ when :DateTime
142
+ DateTime.parse(value)
143
+ when :Date
144
+ Date.parse(value)
145
+ when :String
146
+ value.to_s
147
+ when :Integer
148
+ value.to_i
149
+ when :Float
150
+ value.to_f
151
+ when :BOOLEAN
152
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
153
+ true
154
+ else
155
+ false
156
+ end
157
+ when :Object
158
+ # generic object (usually a Hash), return directly
159
+ value
160
+ when /\AArray<(?<inner_type>.+)>\z/
161
+ inner_type = Regexp.last_match[:inner_type]
162
+ value.map { |v| _deserialize(inner_type, v) }
163
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
164
+ k_type = Regexp.last_match[:k_type]
165
+ v_type = Regexp.last_match[:v_type]
166
+ {}.tap do |hash|
167
+ value.each do |k, v|
168
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
169
+ end
170
+ end
171
+ else # model
172
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
173
+ temp_model.build_from_hash(value)
174
+ end
175
+ end
176
+
177
+ # Returns the string representation of the object
178
+ # @return [String] String presentation of the object
179
+ def to_s
180
+ to_hash.to_s
181
+ end
182
+
183
+ # to_body is an alias to to_hash (backward compatibility)
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_body
186
+ to_hash
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ next if value.nil?
196
+ hash[param] = _to_hash(value)
197
+ end
198
+ hash
199
+ end
200
+
201
+ # Outputs non-array value in the form of hash
202
+ # For object, use to_hash. Otherwise, just return the value
203
+ # @param [Object] value Any valid value
204
+ # @return [Hash] Returns the value in the form of hash
205
+ def _to_hash(value)
206
+ if value.is_a?(Array)
207
+ value.compact.map { |v| _to_hash(v) }
208
+ elsif value.is_a?(Hash)
209
+ {}.tap do |hash|
210
+ value.each { |k, v| hash[k] = _to_hash(v) }
211
+ end
212
+ elsif value.respond_to? :to_hash
213
+ value.to_hash
214
+ else
215
+ value
216
+ end
217
+ end
218
+
219
+ end
220
+ end
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #validateapi
3
+
4
+ #The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
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 CloudmersiveValidateApiClient
16
+ # Result of performing an XXE threat detection operation
17
+ class XxeDetectionResult
18
+ # True if the operation was successful, false otherwise
19
+ attr_accessor :successful
20
+
21
+ # True if the input contained XXE threats, false otherwise
22
+ attr_accessor :contained_xxe
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'successful' => :'Successful',
28
+ :'contained_xxe' => :'ContainedXxe'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'successful' => :'BOOLEAN',
36
+ :'contained_xxe' => :'BOOLEAN'
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?(:'Successful')
49
+ self.successful = attributes[:'Successful']
50
+ end
51
+
52
+ if attributes.has_key?(:'ContainedXxe')
53
+ self.contained_xxe = attributes[:'ContainedXxe']
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
+ successful == o.successful &&
76
+ contained_xxe == o.contained_xxe
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
+ [successful, contained_xxe].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 = CloudmersiveValidateApiClient.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
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.14
11
11
  =end
12
12
 
13
13
  module CloudmersiveValidateApiClient
14
- VERSION = '2.1.6'
14
+ VERSION = '2.2.3'
15
15
  end
@@ -56,6 +56,30 @@ describe 'DomainApi' do
56
56
  end
57
57
  end
58
58
 
59
+ # unit tests for domain_is_admin_path
60
+ # Check if path is a high-risk or vulnerable server administration path
61
+ # Check if the input URL or relative path is a server Administration Path, and therefore a risk or vulnerability for remote access.
62
+ # @param value URL or relative path to check, e.g. \&quot;/admin/login\&quot;. The input is a string so be sure to enclose it in double-quotes.
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [IsAdminPathResponse]
65
+ describe 'domain_is_admin_path test' do
66
+ it 'should work' do
67
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
68
+ end
69
+ end
70
+
71
+ # unit tests for domain_phishing_check
72
+ # Check a URL for Phishing threats
73
+ # Checks if an input URL is at risk of being an Phishing (fake login page, or other page designed to collect information via social engineering) threat or attack.
74
+ # @param request Input URL request
75
+ # @param [Hash] opts the optional parameters
76
+ # @return [PhishingCheckResponse]
77
+ describe 'domain_phishing_check test' do
78
+ it 'should work' do
79
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
80
+ end
81
+ end
82
+
59
83
  # unit tests for domain_post
60
84
  # Get WHOIS information for a domain
61
85
  # Validate whether a domain name exists, and also return the full WHOIS record for that domain name. WHOIS records include all the registration details of the domain name, such as information about the domain&#39;s owners.
@@ -80,6 +104,18 @@ describe 'DomainApi' do
80
104
  end
81
105
  end
82
106
 
107
+ # unit tests for domain_safety_check
108
+ # Check a URL for safety threats
109
+ # Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats.
110
+ # @param request Input URL request
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [UrlSafetyCheckResponseFull]
113
+ describe 'domain_safety_check test' do
114
+ it 'should work' do
115
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
116
+ end
117
+ end
118
+
83
119
  # unit tests for domain_ssrf_check
84
120
  # Check a URL for SSRF threats
85
121
  # Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack.