cloudmersive-validate-api-client 2.1.2 → 2.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 580343d1f2610163655fb867547c08b843993d3c68f01cd59479e40e78d80341
4
- data.tar.gz: 5f9844a43674a566b61c5564c1685fd81322293e4aa5394d219e5faf3111e5a4
3
+ metadata.gz: ea21271bbb80d772aa6167447440a6482272bcd8a77e02df6426eae8ed34c6bd
4
+ data.tar.gz: 8317982dc38803183a782896e8b349b4aedf903636ba48b9f74fb17cce0cad4a
5
5
  SHA512:
6
- metadata.gz: a2c34afc7f80fea8724806691dc82b381dc6b33ec2253ffcad3675fbf96bb9c58602f8be6673c0414052c983e9c0f268b9c55cee582d7a2461f4a499be834ecd
7
- data.tar.gz: a72610132b934a0d25d1c691a7fbf37fbab351afc53b8f8620658bf3fb47e12e6e51655c29885fbe98e8bbf88e90f0dd0521c092594ac3d4afce774c5d4b9d47
6
+ metadata.gz: d7b4973c7cc82a5cd2b1e21851e8a022ea14bfeab5872b7e88799438a2d3b66e4d89023678879c8ca8bda42edd9927eeae28d432a64fec1a0eb5e5464ebd12fe
7
+ data.tar.gz: 57fc9799989dafd8df5b974f4460f582189a44a69d7430bd676ba41813a63b220bf98db4403b8802646991985204659e0ab87cd498cb17c6986a11a2a7730f29
data/README.md CHANGED
@@ -7,7 +7,7 @@ The validation APIs help you validate data. Check if an E-mail address is real.
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: 2.1.2
10
+ - Package version: 2.1.3
11
11
  - Build package: io.swagger.codegen.languages.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -23,15 +23,15 @@ gem build cloudmersive-validate-api-client.gemspec
23
23
  Then either install the gem locally:
24
24
 
25
25
  ```shell
26
- gem install ./cloudmersive-validate-api-client-2.1.2.gem
26
+ gem install ./cloudmersive-validate-api-client-2.1.3.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.2.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.3.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-validate-api-client', '~> 2.1.2'
34
+ gem 'cloudmersive-validate-api-client', '~> 2.1.3'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -121,6 +121,7 @@ Class | Method | HTTP request | Description
121
121
  *CloudmersiveValidateApiClient::NameApi* | [**name_validate_last_name**](docs/NameApi.md#name_validate_last_name) | **POST** /validate/name/last | Validate a last name
122
122
  *CloudmersiveValidateApiClient::PhoneNumberApi* | [**phone_number_syntax_only**](docs/PhoneNumberApi.md#phone_number_syntax_only) | **POST** /validate/phonenumber/basic | Validate phone number (basic)
123
123
  *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_xss**](docs/TextInputApi.md#text_input_check_xss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) attacks
124
+ *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_xss_batch**](docs/TextInputApi.md#text_input_check_xss_batch) | **POST** /validate/text-input/check-and-protect/xss/batch | Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
124
125
  *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_protect_xss**](docs/TextInputApi.md#text_input_protect_xss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
125
126
  *CloudmersiveValidateApiClient::UserAgentApi* | [**user_agent_parse**](docs/UserAgentApi.md#user_agent_parse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots
126
127
  *CloudmersiveValidateApiClient::VatApi* | [**vat_vat_lookup**](docs/VatApi.md#vat_vat_lookup) | **POST** /validate/vat/lookup | Validate a VAT number
@@ -187,6 +188,9 @@ Class | Method | HTTP request | Description
187
188
  - [CloudmersiveValidateApiClient::VatLookupRequest](docs/VatLookupRequest.md)
188
189
  - [CloudmersiveValidateApiClient::VatLookupResponse](docs/VatLookupResponse.md)
189
190
  - [CloudmersiveValidateApiClient::WhoisResponse](docs/WhoisResponse.md)
191
+ - [CloudmersiveValidateApiClient::XssProtectionBatchRequest](docs/XssProtectionBatchRequest.md)
192
+ - [CloudmersiveValidateApiClient::XssProtectionBatchResponse](docs/XssProtectionBatchResponse.md)
193
+ - [CloudmersiveValidateApiClient::XssProtectionRequestItem](docs/XssProtectionRequestItem.md)
190
194
  - [CloudmersiveValidateApiClient::XssProtectionResult](docs/XssProtectionResult.md)
191
195
 
192
196
 
@@ -5,6 +5,7 @@ All URIs are relative to *https://api.cloudmersive.com*
5
5
  Method | HTTP request | Description
6
6
  ------------- | ------------- | -------------
7
7
  [**text_input_check_xss**](TextInputApi.md#text_input_check_xss) | **POST** /validate/text-input/check/xss | Check text input for Cross-Site-Scripting (XSS) attacks
8
+ [**text_input_check_xss_batch**](TextInputApi.md#text_input_check_xss_batch) | **POST** /validate/text-input/check-and-protect/xss/batch | Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
8
9
  [**text_input_protect_xss**](TextInputApi.md#text_input_protect_xss) | **POST** /validate/text-input/protect/xss | Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
9
10
 
10
11
 
@@ -62,6 +63,60 @@ Name | Type | Description | Notes
62
63
 
63
64
 
64
65
 
66
+ # **text_input_check_xss_batch**
67
+ > XssProtectionBatchResponse text_input_check_xss_batch(value)
68
+
69
+ Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
70
+
71
+ Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
72
+
73
+ ### Example
74
+ ```ruby
75
+ # load the gem
76
+ require 'cloudmersive-validate-api-client'
77
+ # setup authorization
78
+ CloudmersiveValidateApiClient.configure do |config|
79
+ # Configure API key authorization: Apikey
80
+ config.api_key['Apikey'] = 'YOUR API KEY'
81
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
82
+ #config.api_key_prefix['Apikey'] = 'Bearer'
83
+ end
84
+
85
+ api_instance = CloudmersiveValidateApiClient::TextInputApi.new
86
+
87
+ value = CloudmersiveValidateApiClient::XssProtectionBatchRequest.new # XssProtectionBatchRequest | User-facing text input.
88
+
89
+
90
+ begin
91
+ #Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
92
+ result = api_instance.text_input_check_xss_batch(value)
93
+ p result
94
+ rescue CloudmersiveValidateApiClient::ApiError => e
95
+ puts "Exception when calling TextInputApi->text_input_check_xss_batch: #{e}"
96
+ end
97
+ ```
98
+
99
+ ### Parameters
100
+
101
+ Name | Type | Description | Notes
102
+ ------------- | ------------- | ------------- | -------------
103
+ **value** | [**XssProtectionBatchRequest**](XssProtectionBatchRequest.md)| User-facing text input. |
104
+
105
+ ### Return type
106
+
107
+ [**XssProtectionBatchResponse**](XssProtectionBatchResponse.md)
108
+
109
+ ### Authorization
110
+
111
+ [Apikey](../README.md#Apikey)
112
+
113
+ ### HTTP request headers
114
+
115
+ - **Content-Type**: application/json, text/json
116
+ - **Accept**: application/json, text/json, application/xml, text/xml
117
+
118
+
119
+
65
120
  # **text_input_protect_xss**
66
121
  > XssProtectionResult text_input_protect_xss(value)
67
122
 
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::XssProtectionBatchRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **request_items** | [**Array<XssProtectionRequestItem>**](XssProtectionRequestItem.md) | Multiple items to protect for XSS | [optional]
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::XssProtectionBatchResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **result_items** | [**Array<XssProtectionResult>**](XssProtectionResult.md) | Results from performing a batch XSS protection operation | [optional]
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::XssProtectionRequestItem
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **input_text** | **String** | Individual input text item to protect from XSS | [optional]
7
+
8
+
@@ -76,6 +76,9 @@ require 'cloudmersive-validate-api-client/models/validate_url_response_syntax_on
76
76
  require 'cloudmersive-validate-api-client/models/vat_lookup_request'
77
77
  require 'cloudmersive-validate-api-client/models/vat_lookup_response'
78
78
  require 'cloudmersive-validate-api-client/models/whois_response'
79
+ require 'cloudmersive-validate-api-client/models/xss_protection_batch_request'
80
+ require 'cloudmersive-validate-api-client/models/xss_protection_batch_response'
81
+ require 'cloudmersive-validate-api-client/models/xss_protection_request_item'
79
82
  require 'cloudmersive-validate-api-client/models/xss_protection_result'
80
83
 
81
84
  # APIs
@@ -73,6 +73,60 @@ module CloudmersiveValidateApiClient
73
73
  end
74
74
  return data, status_code, headers
75
75
  end
76
+ # Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
77
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
78
+ # @param value User-facing text input.
79
+ # @param [Hash] opts the optional parameters
80
+ # @return [XssProtectionBatchResponse]
81
+ def text_input_check_xss_batch(value, opts = {})
82
+ data, _status_code, _headers = text_input_check_xss_batch_with_http_info(value, opts)
83
+ data
84
+ end
85
+
86
+ # Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
87
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
88
+ # @param value User-facing text input.
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Array<(XssProtectionBatchResponse, Fixnum, Hash)>] XssProtectionBatchResponse data, response status code and response headers
91
+ def text_input_check_xss_batch_with_http_info(value, opts = {})
92
+ if @api_client.config.debugging
93
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xss_batch ...'
94
+ end
95
+ # verify the required parameter 'value' is set
96
+ if @api_client.config.client_side_validation && value.nil?
97
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_xss_batch"
98
+ end
99
+ # resource path
100
+ local_var_path = '/validate/text-input/check-and-protect/xss/batch'
101
+
102
+ # query parameters
103
+ query_params = {}
104
+
105
+ # header parameters
106
+ header_params = {}
107
+ # HTTP header 'Accept' (if needed)
108
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
109
+ # HTTP header 'Content-Type'
110
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
111
+
112
+ # form parameters
113
+ form_params = {}
114
+
115
+ # http body (model)
116
+ post_body = @api_client.object_to_http_body(value)
117
+ auth_names = ['Apikey']
118
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
119
+ :header_params => header_params,
120
+ :query_params => query_params,
121
+ :form_params => form_params,
122
+ :body => post_body,
123
+ :auth_names => auth_names,
124
+ :return_type => 'XssProtectionBatchResponse')
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_xss_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
127
+ end
128
+ return data, status_code, headers
129
+ end
76
130
  # Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
77
131
  # 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.
78
132
  # @param value User-facing text input.
@@ -0,0 +1,188 @@
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
+ # Input to a batch XSS protection operation
17
+ class XssProtectionBatchRequest
18
+ # Multiple items to protect for XSS
19
+ attr_accessor :request_items
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'request_items' => :'RequestItems'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'request_items' => :'Array<XssProtectionRequestItem>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
42
+
43
+ if attributes.has_key?(:'RequestItems')
44
+ if (value = attributes[:'RequestItems']).is_a?(Array)
45
+ self.request_items = value
46
+ end
47
+ end
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
+ 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
+ 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
+ request_items == o.request_items
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
+ [request_items].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 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 = CloudmersiveValidateApiClient.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
+ end
@@ -0,0 +1,188 @@
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 a batch XSS protection operation
17
+ class XssProtectionBatchResponse
18
+ # Results from performing a batch XSS protection operation
19
+ attr_accessor :result_items
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'result_items' => :'ResultItems'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'result_items' => :'Array<XssProtectionResult>'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
42
+
43
+ if attributes.has_key?(:'ResultItems')
44
+ if (value = attributes[:'ResultItems']).is_a?(Array)
45
+ self.result_items = value
46
+ end
47
+ end
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
+ 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
+ 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
+ result_items == o.result_items
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
+ [result_items].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 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 = CloudmersiveValidateApiClient.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
+ end
@@ -0,0 +1,186 @@
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 protect for XSS
17
+ class XssProtectionRequestItem
18
+ # Individual input text item to protect from XSS
19
+ attr_accessor :input_text
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'input_text' => :'InputText'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'input_text' => :'String'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
42
+
43
+ if attributes.has_key?(:'InputText')
44
+ self.input_text = attributes[:'InputText']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ input_text == o.input_text
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [input_text].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = CloudmersiveValidateApiClient.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map { |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+ end
@@ -11,5 +11,5 @@ Swagger Codegen version: 2.4.14
11
11
  =end
12
12
 
13
13
  module CloudmersiveValidateApiClient
14
- VERSION = '2.1.2'
14
+ VERSION = '2.1.3'
15
15
  end
@@ -44,6 +44,18 @@ describe 'TextInputApi' do
44
44
  end
45
45
  end
46
46
 
47
+ # unit tests for text_input_check_xss_batch
48
+ # Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
49
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
50
+ # @param value User-facing text input.
51
+ # @param [Hash] opts the optional parameters
52
+ # @return [XssProtectionBatchResponse]
53
+ describe 'text_input_check_xss_batch 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 text_input_protect_xss
48
60
  # Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
49
61
  # 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.
@@ -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::XssProtectionBatchRequest
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'XssProtectionBatchRequest' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::XssProtectionBatchRequest.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of XssProtectionBatchRequest' do
31
+ it 'should create an instance of XssProtectionBatchRequest' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::XssProtectionBatchRequest)
33
+ end
34
+ end
35
+ describe 'test attribute "request_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,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::XssProtectionBatchResponse
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'XssProtectionBatchResponse' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::XssProtectionBatchResponse.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of XssProtectionBatchResponse' do
31
+ it 'should create an instance of XssProtectionBatchResponse' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::XssProtectionBatchResponse)
33
+ end
34
+ end
35
+ describe 'test attribute "result_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,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::XssProtectionRequestItem
18
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
19
+ # Please update as you see appropriate
20
+ describe 'XssProtectionRequestItem' do
21
+ before do
22
+ # run before each test
23
+ @instance = CloudmersiveValidateApiClient::XssProtectionRequestItem.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of XssProtectionRequestItem' do
31
+ it 'should create an instance of XssProtectionRequestItem' do
32
+ expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::XssProtectionRequestItem)
33
+ end
34
+ end
35
+ describe 'test attribute "input_text"' 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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudmersive-validate-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cloudmersive
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-15 00:00:00.000000000 Z
11
+ date: 2020-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -273,6 +273,9 @@ files:
273
273
  - "./docs/VatLookupRequest.md"
274
274
  - "./docs/VatLookupResponse.md"
275
275
  - "./docs/WhoisResponse.md"
276
+ - "./docs/XssProtectionBatchRequest.md"
277
+ - "./docs/XssProtectionBatchResponse.md"
278
+ - "./docs/XssProtectionRequestItem.md"
276
279
  - "./docs/XssProtectionResult.md"
277
280
  - "./git_push.sh"
278
281
  - "./lib/cloudmersive-validate-api-client.rb"
@@ -349,6 +352,9 @@ files:
349
352
  - "./lib/cloudmersive-validate-api-client/models/vat_lookup_request.rb"
350
353
  - "./lib/cloudmersive-validate-api-client/models/vat_lookup_response.rb"
351
354
  - "./lib/cloudmersive-validate-api-client/models/whois_response.rb"
355
+ - "./lib/cloudmersive-validate-api-client/models/xss_protection_batch_request.rb"
356
+ - "./lib/cloudmersive-validate-api-client/models/xss_protection_batch_response.rb"
357
+ - "./lib/cloudmersive-validate-api-client/models/xss_protection_request_item.rb"
352
358
  - "./lib/cloudmersive-validate-api-client/models/xss_protection_result.rb"
353
359
  - "./lib/cloudmersive-validate-api-client/version.rb"
354
360
  - "./spec/api/address_api_spec.rb"
@@ -423,6 +429,9 @@ files:
423
429
  - "./spec/models/vat_lookup_request_spec.rb"
424
430
  - "./spec/models/vat_lookup_response_spec.rb"
425
431
  - "./spec/models/whois_response_spec.rb"
432
+ - "./spec/models/xss_protection_batch_request_spec.rb"
433
+ - "./spec/models/xss_protection_batch_response_spec.rb"
434
+ - "./spec/models/xss_protection_request_item_spec.rb"
426
435
  - "./spec/models/xss_protection_result_spec.rb"
427
436
  - "./spec/spec_helper.rb"
428
437
  homepage: https://www.cloudmersive.com/validate-api