cloudmersive-validate-api-client 2.1.5 → 2.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 checking a URL for SSRF threats
17
+ class UrlSsrfResponseFull
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 = 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
@@ -21,11 +21,15 @@ module CloudmersiveValidateApiClient
21
21
  # Well-formed version of the URL
22
22
  attr_accessor :well_formed_url
23
23
 
24
+ # The top-level domain name of the URL, e.g. mydomain.com
25
+ attr_accessor :top_level_domain_name
26
+
24
27
  # Attribute mapping from ruby-style variable name to JSON key.
25
28
  def self.attribute_map
26
29
  {
27
30
  :'valid_url' => :'ValidURL',
28
- :'well_formed_url' => :'WellFormedURL'
31
+ :'well_formed_url' => :'WellFormedURL',
32
+ :'top_level_domain_name' => :'TopLevelDomainName'
29
33
  }
30
34
  end
31
35
 
@@ -33,7 +37,8 @@ module CloudmersiveValidateApiClient
33
37
  def self.swagger_types
34
38
  {
35
39
  :'valid_url' => :'BOOLEAN',
36
- :'well_formed_url' => :'String'
40
+ :'well_formed_url' => :'String',
41
+ :'top_level_domain_name' => :'String'
37
42
  }
38
43
  end
39
44
 
@@ -52,6 +57,10 @@ module CloudmersiveValidateApiClient
52
57
  if attributes.has_key?(:'WellFormedURL')
53
58
  self.well_formed_url = attributes[:'WellFormedURL']
54
59
  end
60
+
61
+ if attributes.has_key?(:'TopLevelDomainName')
62
+ self.top_level_domain_name = attributes[:'TopLevelDomainName']
63
+ end
55
64
  end
56
65
 
57
66
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -73,7 +82,8 @@ module CloudmersiveValidateApiClient
73
82
  return true if self.equal?(o)
74
83
  self.class == o.class &&
75
84
  valid_url == o.valid_url &&
76
- well_formed_url == o.well_formed_url
85
+ well_formed_url == o.well_formed_url &&
86
+ top_level_domain_name == o.top_level_domain_name
77
87
  end
78
88
 
79
89
  # @see the `==` method
@@ -85,7 +95,7 @@ module CloudmersiveValidateApiClient
85
95
  # Calculates hash code according to all attributes.
86
96
  # @return [Fixnum] Hash code
87
97
  def hash
88
- [valid_url, well_formed_url].hash
98
+ [valid_url, well_formed_url, top_level_domain_name].hash
89
99
  end
90
100
 
91
101
  # Builds the object from hash
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.14
11
11
  =end
12
12
 
13
13
  module CloudmersiveValidateApiClient
14
- VERSION = '2.1.5'
14
+ VERSION = '2.1.6'
15
15
  end
@@ -44,6 +44,18 @@ describe 'DomainApi' do
44
44
  end
45
45
  end
46
46
 
47
+ # unit tests for domain_get_top_level_domain_from_url
48
+ # Get top-level domain name from URL
49
+ # Gets the top-level domain name from a URL, such as mydomain.com.
50
+ # @param request Input URL information
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [ValidateUrlResponseSyntaxOnly]
53
+ describe 'domain_get_top_level_domain_from_url 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
  # unit tests for domain_post
48
60
  # Get WHOIS information for a domain
49
61
  # 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.
@@ -68,6 +80,30 @@ describe 'DomainApi' do
68
80
  end
69
81
  end
70
82
 
83
+ # unit tests for domain_ssrf_check
84
+ # Check a URL for SSRF threats
85
+ # Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack.
86
+ # @param request Input URL request
87
+ # @param [Hash] opts the optional parameters
88
+ # @return [UrlSsrfResponseFull]
89
+ describe 'domain_ssrf_check 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
+ # unit tests for domain_ssrf_check_batch
96
+ # Check a URL for SSRF threats in batches
97
+ # Batch-checks if input URLs are at risk of being an SSRF (Server-side request forgery) threat or attack.
98
+ # @param request Input URL request as a batch of multiple URLs
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [UrlSsrfResponseBatch]
101
+ describe 'domain_ssrf_check_batch test' do
102
+ it 'should work' do
103
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
104
+ end
105
+ end
106
+
71
107
  # unit tests for domain_url_full
72
108
  # Validate a URL fully
73
109
  # Validate whether a URL is syntactically valid (does not check endpoint for validity), whether it exists, and whether the endpoint is up and passes virus scan checks. Accepts various types of input and produces a well-formed URL as output.
@@ -0,0 +1,41 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveValidateApiClient::UrlSsrfRequestBatch
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'UrlSsrfRequestBatch' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::UrlSsrfRequestBatch.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of UrlSsrfRequestBatch' do
31
+ it 'should create an instance of UrlSsrfRequestBatch' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::UrlSsrfRequestBatch)
33
+ end
34
+ end
35
+ describe 'test attribute "input_items"' 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
@@ -0,0 +1,47 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveValidateApiClient::UrlSsrfRequestFull
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'UrlSsrfRequestFull' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::UrlSsrfRequestFull.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of UrlSsrfRequestFull' do
31
+ it 'should create an instance of UrlSsrfRequestFull' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::UrlSsrfRequestFull)
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
+ describe 'test attribute "blocked_domains"' 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
+ end
@@ -0,0 +1,41 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveValidateApiClient::UrlSsrfResponseBatch
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'UrlSsrfResponseBatch' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::UrlSsrfResponseBatch.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of UrlSsrfResponseBatch' do
31
+ it 'should create an instance of UrlSsrfResponseBatch' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::UrlSsrfResponseBatch)
33
+ end
34
+ end
35
+ describe 'test attribute "output_items"' 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
@@ -0,0 +1,47 @@
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 'spec_helper'
14
+ require 'json'
15
+ require 'date'
16
+
17
+ # Unit tests for CloudmersiveValidateApiClient::UrlSsrfResponseFull
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'UrlSsrfResponseFull' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::UrlSsrfResponseFull.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of UrlSsrfResponseFull' do
31
+ it 'should create an instance of UrlSsrfResponseFull' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::UrlSsrfResponseFull)
33
+ end
34
+ end
35
+ describe 'test attribute "clean_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
+ describe 'test attribute "threat_level"' 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
+ end