cloudmersive-security-api-client 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +119 -0
  4. data/Rakefile +8 -0
  5. data/cloudmersive-security-api-client.gemspec +45 -0
  6. data/docs/ContentThreatDetectionApi.md +283 -0
  7. data/docs/IPThreatDetectionResponse.md +9 -0
  8. data/docs/NetworkThreatDetectionApi.md +228 -0
  9. data/docs/StringAutomaticThreatDetection.md +18 -0
  10. data/docs/StringInsecureDeserializationJsonDetection.md +10 -0
  11. data/docs/StringSqlInjectionDetectionResult.md +10 -0
  12. data/docs/StringXssProtectionResult.md +11 -0
  13. data/docs/StringXxeDetectionResult.md +9 -0
  14. data/docs/ThreatDetectionBotCheckResponse.md +8 -0
  15. data/docs/ThreatDetectionTorNodeResponse.md +8 -0
  16. data/docs/UrlSsrfThreatDetectionRequestFull.md +9 -0
  17. data/docs/UrlSsrfThreatDetectionResponseFull.md +9 -0
  18. data/git_push.sh +55 -0
  19. data/lib/cloudmersive-security-api-client.rb +51 -0
  20. data/lib/cloudmersive-security-api-client/api/content_threat_detection_api.rb +293 -0
  21. data/lib/cloudmersive-security-api-client/api/network_threat_detection_api.rb +239 -0
  22. data/lib/cloudmersive-security-api-client/api_client.rb +391 -0
  23. data/lib/cloudmersive-security-api-client/api_error.rb +38 -0
  24. data/lib/cloudmersive-security-api-client/configuration.rb +209 -0
  25. data/lib/cloudmersive-security-api-client/models/ip_threat_detection_response.rb +196 -0
  26. data/lib/cloudmersive-security-api-client/models/string_automatic_threat_detection.rb +285 -0
  27. data/lib/cloudmersive-security-api-client/models/string_insecure_deserialization_json_detection.rb +206 -0
  28. data/lib/cloudmersive-security-api-client/models/string_sql_injection_detection_result.rb +206 -0
  29. data/lib/cloudmersive-security-api-client/models/string_xss_protection_result.rb +216 -0
  30. data/lib/cloudmersive-security-api-client/models/string_xxe_detection_result.rb +196 -0
  31. data/lib/cloudmersive-security-api-client/models/threat_detection_bot_check_response.rb +186 -0
  32. data/lib/cloudmersive-security-api-client/models/threat_detection_tor_node_response.rb +186 -0
  33. data/lib/cloudmersive-security-api-client/models/url_ssrf_threat_detection_request_full.rb +198 -0
  34. data/lib/cloudmersive-security-api-client/models/url_ssrf_threat_detection_response_full.rb +196 -0
  35. data/lib/cloudmersive-security-api-client/version.rb +15 -0
  36. data/spec/api/content_threat_detection_api_spec.rb +95 -0
  37. data/spec/api/network_threat_detection_api_spec.rb +83 -0
  38. data/spec/api_client_spec.rb +243 -0
  39. data/spec/configuration_spec.rb +42 -0
  40. data/spec/models/ip_threat_detection_response_spec.rb +47 -0
  41. data/spec/models/string_automatic_threat_detection_spec.rb +101 -0
  42. data/spec/models/string_insecure_deserialization_json_detection_spec.rb +53 -0
  43. data/spec/models/string_sql_injection_detection_result_spec.rb +53 -0
  44. data/spec/models/string_xss_protection_result_spec.rb +59 -0
  45. data/spec/models/string_xxe_detection_result_spec.rb +47 -0
  46. data/spec/models/threat_detection_bot_check_response_spec.rb +41 -0
  47. data/spec/models/threat_detection_tor_node_response_spec.rb +41 -0
  48. data/spec/models/url_ssrf_threat_detection_request_full_spec.rb +47 -0
  49. data/spec/models/url_ssrf_threat_detection_response_full_spec.rb +47 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +273 -0
@@ -0,0 +1,198 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
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 CloudmersiveSecurityApiClient
16
+ # Request to determine if a URL is an SSRF threat check
17
+ class UrlSsrfThreatDetectionRequestFull
18
+ # URL to validate
19
+ attr_accessor :url
20
+
21
+ # Top level domains that you do not want to allow access to, e.g. mydomain.com - will block all subdomains as well
22
+ attr_accessor :blocked_domains
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'url' => :'URL',
28
+ :'blocked_domains' => :'BlockedDomains'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'url' => :'String',
36
+ :'blocked_domains' => :'Array<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?(:'URL')
49
+ self.url = attributes[:'URL']
50
+ end
51
+
52
+ if attributes.has_key?(:'BlockedDomains')
53
+ if (value = attributes[:'BlockedDomains']).is_a?(Array)
54
+ self.blocked_domains = value
55
+ end
56
+ end
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properties with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ invalid_properties
64
+ end
65
+
66
+ # Check to see if the all the properties in the model are valid
67
+ # @return true if the model is valid
68
+ def valid?
69
+ true
70
+ end
71
+
72
+ # Checks equality by comparing each attribute.
73
+ # @param [Object] Object to be compared
74
+ def ==(o)
75
+ return true if self.equal?(o)
76
+ self.class == o.class &&
77
+ url == o.url &&
78
+ blocked_domains == o.blocked_domains
79
+ end
80
+
81
+ # @see the `==` method
82
+ # @param [Object] Object to be compared
83
+ def eql?(o)
84
+ self == o
85
+ end
86
+
87
+ # Calculates hash code according to all attributes.
88
+ # @return [Fixnum] Hash code
89
+ def hash
90
+ [url, blocked_domains].hash
91
+ end
92
+
93
+ # Builds the object from hash
94
+ # @param [Hash] attributes Model attributes in the form of hash
95
+ # @return [Object] Returns the model itself
96
+ def build_from_hash(attributes)
97
+ return nil unless attributes.is_a?(Hash)
98
+ self.class.swagger_types.each_pair do |key, type|
99
+ if type =~ /\AArray<(.*)>/i
100
+ # check to ensure the input is an array given that the attribute
101
+ # is documented as an array but the input is not
102
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
104
+ end
105
+ elsif !attributes[self.class.attribute_map[key]].nil?
106
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
107
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+
113
+ # Deserializes the data based on type
114
+ # @param string type Data type
115
+ # @param string value Value to be deserialized
116
+ # @return [Object] Deserialized data
117
+ def _deserialize(type, value)
118
+ case type.to_sym
119
+ when :DateTime
120
+ DateTime.parse(value)
121
+ when :Date
122
+ Date.parse(value)
123
+ when :String
124
+ value.to_s
125
+ when :Integer
126
+ value.to_i
127
+ when :Float
128
+ value.to_f
129
+ when :BOOLEAN
130
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
131
+ true
132
+ else
133
+ false
134
+ end
135
+ when :Object
136
+ # generic object (usually a Hash), return directly
137
+ value
138
+ when /\AArray<(?<inner_type>.+)>\z/
139
+ inner_type = Regexp.last_match[:inner_type]
140
+ value.map { |v| _deserialize(inner_type, v) }
141
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
142
+ k_type = Regexp.last_match[:k_type]
143
+ v_type = Regexp.last_match[:v_type]
144
+ {}.tap do |hash|
145
+ value.each do |k, v|
146
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
147
+ end
148
+ end
149
+ else # model
150
+ temp_model = CloudmersiveSecurityApiClient.const_get(type).new
151
+ temp_model.build_from_hash(value)
152
+ end
153
+ end
154
+
155
+ # Returns the string representation of the object
156
+ # @return [String] String presentation of the object
157
+ def to_s
158
+ to_hash.to_s
159
+ end
160
+
161
+ # to_body is an alias to to_hash (backward compatibility)
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_body
164
+ to_hash
165
+ end
166
+
167
+ # Returns the object in the form of hash
168
+ # @return [Hash] Returns the object in the form of hash
169
+ def to_hash
170
+ hash = {}
171
+ self.class.attribute_map.each_pair do |attr, param|
172
+ value = self.send(attr)
173
+ next if value.nil?
174
+ hash[param] = _to_hash(value)
175
+ end
176
+ hash
177
+ end
178
+
179
+ # Outputs non-array value in the form of hash
180
+ # For object, use to_hash. Otherwise, just return the value
181
+ # @param [Object] value Any valid value
182
+ # @return [Hash] Returns the value in the form of hash
183
+ def _to_hash(value)
184
+ if value.is_a?(Array)
185
+ value.compact.map { |v| _to_hash(v) }
186
+ elsif value.is_a?(Hash)
187
+ {}.tap do |hash|
188
+ value.each { |k, v| hash[k] = _to_hash(v) }
189
+ end
190
+ elsif value.respond_to? :to_hash
191
+ value.to_hash
192
+ else
193
+ value
194
+ end
195
+ end
196
+
197
+ end
198
+ end
@@ -0,0 +1,196 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
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 CloudmersiveSecurityApiClient
16
+ # Result of checking a URL for SSRF threats
17
+ class UrlSsrfThreatDetectionResponseFull
18
+ # True if the URL is clean, false if it is at risk of containing an SSRF threat or attack
19
+ attr_accessor :clean_url
20
+
21
+ # Threat level of the URL; possible values are High, Medium, Low and None
22
+ attr_accessor :threat_level
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'clean_url' => :'CleanURL',
28
+ :'threat_level' => :'ThreatLevel'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'clean_url' => :'BOOLEAN',
36
+ :'threat_level' => :'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?(:'CleanURL')
49
+ self.clean_url = attributes[:'CleanURL']
50
+ end
51
+
52
+ if attributes.has_key?(:'ThreatLevel')
53
+ self.threat_level = attributes[:'ThreatLevel']
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
+ clean_url == o.clean_url &&
76
+ threat_level == o.threat_level
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
+ [clean_url, threat_level].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 = CloudmersiveSecurityApiClient.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,15 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
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 CloudmersiveSecurityApiClient
14
+ VERSION = '2.0.1'
15
+ end
@@ -0,0 +1,95 @@
1
+ =begin
2
+ #securityapi
3
+
4
+ #The security APIs help you detect and block security threats.
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 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for CloudmersiveSecurityApiClient::ContentThreatDetectionApi
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'ContentThreatDetectionApi' do
20
+ before do
21
+ # run before each test
22
+ @instance = CloudmersiveSecurityApiClient::ContentThreatDetectionApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of ContentThreatDetectionApi' do
30
+ it 'should create an instance of ContentThreatDetectionApi' do
31
+ expect(@instance).to be_instance_of(CloudmersiveSecurityApiClient::ContentThreatDetectionApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for content_threat_detection_automatic_threat_detection_string
36
+ # Automatically detect threats in an input string
37
+ # Auto-detects a wide range of threat types in input string, including Cross-Site Scripting (XSS), SQL Injection (SQLI), XML External Entitites (XXE), Server-side Request Forgeries (SSRF), and JSON Insecure Deserialization (JID).
38
+ # @param value User-facing text input.
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [StringAutomaticThreatDetection]
41
+ describe 'content_threat_detection_automatic_threat_detection_string 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 content_threat_detection_check_sql_injection_string
48
+ # Check text input for SQL Injection (SQLI) attacks
49
+ # Detects SQL Injection (SQLI) attacks from text input.
50
+ # @param value User-facing text input.
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [StringSqlInjectionDetectionResult]
53
+ describe 'content_threat_detection_check_sql_injection_string 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
+ # unit tests for content_threat_detection_check_xxe
60
+ # Protect text input from XML External Entity (XXE) attacks
61
+ # Detects XXE (XML External Entity) attacks from XML text input.
62
+ # @param value User-facing text input.
63
+ # @param [Hash] opts the optional parameters
64
+ # @return [StringXxeDetectionResult]
65
+ describe 'content_threat_detection_check_xxe 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 content_threat_detection_detect_insecure_deserialization_json_string
72
+ # Detect Insecure Deserialization JSON (JID) attacks in a string
73
+ # Detects Insecure Deserialization JSON (JID) attacks from text input.
74
+ # @param value User-facing text input.
75
+ # @param [Hash] opts the optional parameters
76
+ # @return [StringInsecureDeserializationJsonDetection]
77
+ describe 'content_threat_detection_detect_insecure_deserialization_json_string 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
+
83
+ # unit tests for content_threat_detection_protect_xss
84
+ # Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
85
+ # Detects and removes XSS (Cross-Site-Scripting) attacks from text input through normalization. Returns the normalized result, as well as information on whether the original input contained an XSS risk.
86
+ # @param value User-facing text input.
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [StringXssProtectionResult]
89
+ describe 'content_threat_detection_protect_xss test' do
90
+ it 'should work' do
91
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
92
+ end
93
+ end
94
+
95
+ end