cloudmersive-validate-api-client 2.1.7 → 2.1.9

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: 4efb7c1b214896dcd9bf6aba9314f75a4d05b90b8d8f1563401ccc1aa6086657
4
- data.tar.gz: ef7cb76a16710e47a88e4b438c25fcb5d65957160ec4655587fc7f23e3c974b1
3
+ metadata.gz: b14865010ef033e3b2eb06a1ead269e3e1282f68298cc426469d6b05308f5101
4
+ data.tar.gz: 2cebdb3e846f47bb3fa2e8d5c9c346271d3418c82d79507a622ea74e9cbdeb71
5
5
  SHA512:
6
- metadata.gz: 9d84a9600887dde17dd1446cb558698ddc4a91c44a39c909537c54940531279b51f6bc93f7e67058dcf0c56f169e39c0b3e858e795b66b9aa69686441e75a082
7
- data.tar.gz: e7a718999f87d3c8d70c4da49eb610f09b8154286b070b36755599003ba84ca27600d8a3d3cca5ca83b10ad2f5c6010defdb7b5bf0d4d2406cb2a7130792182f
6
+ metadata.gz: 7aa827e35f6d854d22b9b50d2276f0ccc51ca5f2446a2ff0e5fd0e50d6837ea57ef1dc4beb4e2f8cafeda2a3bb5f40a24b2a55d6af01e86bbe851b0061319f09
7
+ data.tar.gz: 76cec04103d7d4818c83bcc518daa22c8ba71fb3bc33ac9c19806d82a1aee4e12985d80ed720b8847da27a623fa5dc36d60252219cac5761e95f23f21c5122c8
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.7
10
+ - Package version: 2.1.9
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.7.gem
26
+ gem install ./cloudmersive-validate-api-client-2.1.9.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.7.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.9.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.7'
34
+ gem 'cloudmersive-validate-api-client', '~> 2.1.9'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -128,6 +128,8 @@ Class | Method | HTTP request | Description
128
128
  *CloudmersiveValidateApiClient::NameApi* | [**name_validate_full_name**](docs/NameApi.md#name_validate_full_name) | **POST** /validate/name/full-name | Parse and validate a full name
129
129
  *CloudmersiveValidateApiClient::NameApi* | [**name_validate_last_name**](docs/NameApi.md#name_validate_last_name) | **POST** /validate/name/last | Validate a last name
130
130
  *CloudmersiveValidateApiClient::PhoneNumberApi* | [**phone_number_syntax_only**](docs/PhoneNumberApi.md#phone_number_syntax_only) | **POST** /validate/phonenumber/basic | Validate phone number (basic)
131
+ *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_sql_injection**](docs/TextInputApi.md#text_input_check_sql_injection) | **POST** /validate/text-input/check/sql-injection | Check text input for SQL Injection (SQLI) attacks
132
+ *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_sql_injection_batch**](docs/TextInputApi.md#text_input_check_sql_injection_batch) | **POST** /validate/text-input/check/sql-injection/batch | Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
131
133
  *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
132
134
  *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
133
135
  *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
@@ -178,6 +180,10 @@ Class | Method | HTTP request | Description
178
180
  - [CloudmersiveValidateApiClient::PublicHolidaysResponse](docs/PublicHolidaysResponse.md)
179
181
  - [CloudmersiveValidateApiClient::ReverseGeocodeAddressRequest](docs/ReverseGeocodeAddressRequest.md)
180
182
  - [CloudmersiveValidateApiClient::ReverseGeocodeAddressResponse](docs/ReverseGeocodeAddressResponse.md)
183
+ - [CloudmersiveValidateApiClient::SqlInjectionCheckBatchRequest](docs/SqlInjectionCheckBatchRequest.md)
184
+ - [CloudmersiveValidateApiClient::SqlInjectionCheckBatchResponse](docs/SqlInjectionCheckBatchResponse.md)
185
+ - [CloudmersiveValidateApiClient::SqlInjectionCheckRequestItem](docs/SqlInjectionCheckRequestItem.md)
186
+ - [CloudmersiveValidateApiClient::SqlInjectionDetectionResult](docs/SqlInjectionDetectionResult.md)
181
187
  - [CloudmersiveValidateApiClient::Timezone](docs/Timezone.md)
182
188
  - [CloudmersiveValidateApiClient::TorNodeResponse](docs/TorNodeResponse.md)
183
189
  - [CloudmersiveValidateApiClient::UrlSafetyCheckRequestFull](docs/UrlSafetyCheckRequestFull.md)
@@ -0,0 +1,9 @@
1
+ # CloudmersiveValidateApiClient::SqlInjectionCheckBatchRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **request_items** | [**Array<SqlInjectionCheckRequestItem>**](SqlInjectionCheckRequestItem.md) | Multiple items to detect for SQL Injection | [optional]
7
+ **detection_level** | **String** | Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). | [optional]
8
+
9
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::SqlInjectionCheckBatchResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **result_items** | [**Array<SqlInjectionDetectionResult>**](SqlInjectionDetectionResult.md) | Results from performing a batch SQL Injection detection operation; order is preserved from input data | [optional]
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::SqlInjectionCheckRequestItem
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **input_text** | **String** | Individual input text item to check for SQL Injection | [optional]
7
+
8
+
@@ -0,0 +1,10 @@
1
+ # CloudmersiveValidateApiClient::SqlInjectionDetectionResult
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
7
+ **contained_sql_injection_attack** | **BOOLEAN** | True if the input contained SQL Injection attacks, false otherwise | [optional]
8
+ **original_input** | **String** | Original input string | [optional]
9
+
10
+
data/docs/TextInputApi.md CHANGED
@@ -4,11 +4,125 @@ All URIs are relative to *https://api.cloudmersive.com*
4
4
 
5
5
  Method | HTTP request | Description
6
6
  ------------- | ------------- | -------------
7
+ [**text_input_check_sql_injection**](TextInputApi.md#text_input_check_sql_injection) | **POST** /validate/text-input/check/sql-injection | Check text input for SQL Injection (SQLI) attacks
8
+ [**text_input_check_sql_injection_batch**](TextInputApi.md#text_input_check_sql_injection_batch) | **POST** /validate/text-input/check/sql-injection/batch | Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
7
9
  [**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
10
  [**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
9
11
  [**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
10
12
 
11
13
 
14
+ # **text_input_check_sql_injection**
15
+ > SqlInjectionDetectionResult text_input_check_sql_injection(value, opts)
16
+
17
+ Check text input for SQL Injection (SQLI) attacks
18
+
19
+ Detects SQL Injection (SQLI) attacks from text input.
20
+
21
+ ### Example
22
+ ```ruby
23
+ # load the gem
24
+ require 'cloudmersive-validate-api-client'
25
+ # setup authorization
26
+ CloudmersiveValidateApiClient.configure do |config|
27
+ # Configure API key authorization: Apikey
28
+ config.api_key['Apikey'] = 'YOUR API KEY'
29
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
30
+ #config.api_key_prefix['Apikey'] = 'Bearer'
31
+ end
32
+
33
+ api_instance = CloudmersiveValidateApiClient::TextInputApi.new
34
+
35
+ value = 'value_example' # String | User-facing text input.
36
+
37
+ opts = {
38
+ detection_level: 'detection_level_example' # String | Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
39
+ }
40
+
41
+ begin
42
+ #Check text input for SQL Injection (SQLI) attacks
43
+ result = api_instance.text_input_check_sql_injection(value, opts)
44
+ p result
45
+ rescue CloudmersiveValidateApiClient::ApiError => e
46
+ puts "Exception when calling TextInputApi->text_input_check_sql_injection: #{e}"
47
+ end
48
+ ```
49
+
50
+ ### Parameters
51
+
52
+ Name | Type | Description | Notes
53
+ ------------- | ------------- | ------------- | -------------
54
+ **value** | **String**| User-facing text input. |
55
+ **detection_level** | **String**| Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended). | [optional]
56
+
57
+ ### Return type
58
+
59
+ [**SqlInjectionDetectionResult**](SqlInjectionDetectionResult.md)
60
+
61
+ ### Authorization
62
+
63
+ [Apikey](../README.md#Apikey)
64
+
65
+ ### HTTP request headers
66
+
67
+ - **Content-Type**: application/json, text/json
68
+ - **Accept**: application/json, text/json, application/xml, text/xml
69
+
70
+
71
+
72
+ # **text_input_check_sql_injection_batch**
73
+ > SqlInjectionCheckBatchResponse text_input_check_sql_injection_batch(value)
74
+
75
+ Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
76
+
77
+ Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items.
78
+
79
+ ### Example
80
+ ```ruby
81
+ # load the gem
82
+ require 'cloudmersive-validate-api-client'
83
+ # setup authorization
84
+ CloudmersiveValidateApiClient.configure do |config|
85
+ # Configure API key authorization: Apikey
86
+ config.api_key['Apikey'] = 'YOUR API KEY'
87
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
88
+ #config.api_key_prefix['Apikey'] = 'Bearer'
89
+ end
90
+
91
+ api_instance = CloudmersiveValidateApiClient::TextInputApi.new
92
+
93
+ value = CloudmersiveValidateApiClient::SqlInjectionCheckBatchRequest.new # SqlInjectionCheckBatchRequest | User-facing text input.
94
+
95
+
96
+ begin
97
+ #Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
98
+ result = api_instance.text_input_check_sql_injection_batch(value)
99
+ p result
100
+ rescue CloudmersiveValidateApiClient::ApiError => e
101
+ puts "Exception when calling TextInputApi->text_input_check_sql_injection_batch: #{e}"
102
+ end
103
+ ```
104
+
105
+ ### Parameters
106
+
107
+ Name | Type | Description | Notes
108
+ ------------- | ------------- | ------------- | -------------
109
+ **value** | [**SqlInjectionCheckBatchRequest**](SqlInjectionCheckBatchRequest.md)| User-facing text input. |
110
+
111
+ ### Return type
112
+
113
+ [**SqlInjectionCheckBatchResponse**](SqlInjectionCheckBatchResponse.md)
114
+
115
+ ### Authorization
116
+
117
+ [Apikey](../README.md#Apikey)
118
+
119
+ ### HTTP request headers
120
+
121
+ - **Content-Type**: application/json, text/json
122
+ - **Accept**: application/json, text/json, application/xml, text/xml
123
+
124
+
125
+
12
126
  # **text_input_check_xss**
13
127
  > XssProtectionResult text_input_check_xss(value)
14
128
 
@@ -68,7 +182,7 @@ Name | Type | Description | Notes
68
182
 
69
183
  Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
70
184
 
71
- Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
185
+ Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items.
72
186
 
73
187
  ### Example
74
188
  ```ruby
@@ -58,6 +58,10 @@ require 'cloudmersive-validate-api-client/models/public_holiday_occurrence'
58
58
  require 'cloudmersive-validate-api-client/models/public_holidays_response'
59
59
  require 'cloudmersive-validate-api-client/models/reverse_geocode_address_request'
60
60
  require 'cloudmersive-validate-api-client/models/reverse_geocode_address_response'
61
+ require 'cloudmersive-validate-api-client/models/sql_injection_check_batch_request'
62
+ require 'cloudmersive-validate-api-client/models/sql_injection_check_batch_response'
63
+ require 'cloudmersive-validate-api-client/models/sql_injection_check_request_item'
64
+ require 'cloudmersive-validate-api-client/models/sql_injection_detection_result'
61
65
  require 'cloudmersive-validate-api-client/models/timezone'
62
66
  require 'cloudmersive-validate-api-client/models/tor_node_response'
63
67
  require 'cloudmersive-validate-api-client/models/url_safety_check_request_full'
@@ -19,6 +19,117 @@ module CloudmersiveValidateApiClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Check text input for SQL Injection (SQLI) attacks
23
+ # Detects SQL Injection (SQLI) attacks from text input.
24
+ # @param value User-facing text input.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
27
+ # @return [SqlInjectionDetectionResult]
28
+ def text_input_check_sql_injection(value, opts = {})
29
+ data, _status_code, _headers = text_input_check_sql_injection_with_http_info(value, opts)
30
+ data
31
+ end
32
+
33
+ # Check text input for SQL Injection (SQLI) attacks
34
+ # Detects SQL Injection (SQLI) attacks from text input.
35
+ # @param value User-facing text input.
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
38
+ # @return [Array<(SqlInjectionDetectionResult, Fixnum, Hash)>] SqlInjectionDetectionResult data, response status code and response headers
39
+ def text_input_check_sql_injection_with_http_info(value, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_sql_injection ...'
42
+ end
43
+ # verify the required parameter 'value' is set
44
+ if @api_client.config.client_side_validation && value.nil?
45
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_sql_injection"
46
+ end
47
+ # resource path
48
+ local_var_path = '/validate/text-input/check/sql-injection'
49
+
50
+ # query parameters
51
+ query_params = {}
52
+
53
+ # header parameters
54
+ header_params = {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
57
+ # HTTP header 'Content-Type'
58
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
59
+ header_params[:'detectionLevel'] = opts[:'detection_level'] if !opts[:'detection_level'].nil?
60
+
61
+ # form parameters
62
+ form_params = {}
63
+
64
+ # http body (model)
65
+ post_body = @api_client.object_to_http_body(value)
66
+ auth_names = ['Apikey']
67
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => 'SqlInjectionDetectionResult')
74
+ if @api_client.config.debugging
75
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_sql_injection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ end
77
+ return data, status_code, headers
78
+ end
79
+ # Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
80
+ # Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items.
81
+ # @param value User-facing text input.
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [SqlInjectionCheckBatchResponse]
84
+ def text_input_check_sql_injection_batch(value, opts = {})
85
+ data, _status_code, _headers = text_input_check_sql_injection_batch_with_http_info(value, opts)
86
+ data
87
+ end
88
+
89
+ # Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
90
+ # Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items.
91
+ # @param value User-facing text input.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [Array<(SqlInjectionCheckBatchResponse, Fixnum, Hash)>] SqlInjectionCheckBatchResponse data, response status code and response headers
94
+ def text_input_check_sql_injection_batch_with_http_info(value, opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_sql_injection_batch ...'
97
+ end
98
+ # verify the required parameter 'value' is set
99
+ if @api_client.config.client_side_validation && value.nil?
100
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_sql_injection_batch"
101
+ end
102
+ # resource path
103
+ local_var_path = '/validate/text-input/check/sql-injection/batch'
104
+
105
+ # query parameters
106
+ query_params = {}
107
+
108
+ # header parameters
109
+ header_params = {}
110
+ # HTTP header 'Accept' (if needed)
111
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
112
+ # HTTP header 'Content-Type'
113
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
114
+
115
+ # form parameters
116
+ form_params = {}
117
+
118
+ # http body (model)
119
+ post_body = @api_client.object_to_http_body(value)
120
+ auth_names = ['Apikey']
121
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
122
+ :header_params => header_params,
123
+ :query_params => query_params,
124
+ :form_params => form_params,
125
+ :body => post_body,
126
+ :auth_names => auth_names,
127
+ :return_type => 'SqlInjectionCheckBatchResponse')
128
+ if @api_client.config.debugging
129
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_sql_injection_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
22
133
  # Check text input for Cross-Site-Scripting (XSS) attacks
23
134
  # Detects XSS (Cross-Site-Scripting) attacks from text input.
24
135
  # @param value User-facing text input.
@@ -74,7 +185,7 @@ module CloudmersiveValidateApiClient
74
185
  return data, status_code, headers
75
186
  end
76
187
  # 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.
188
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items.
78
189
  # @param value User-facing text input.
79
190
  # @param [Hash] opts the optional parameters
80
191
  # @return [XssProtectionBatchResponse]
@@ -84,7 +195,7 @@ module CloudmersiveValidateApiClient
84
195
  end
85
196
 
86
197
  # 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.
198
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items.
88
199
  # @param value User-facing text input.
89
200
  # @param [Hash] opts the optional parameters
90
201
  # @return [Array<(XssProtectionBatchResponse, Fixnum, Hash)>] XssProtectionBatchResponse data, response status code and response headers
@@ -0,0 +1,198 @@
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 SQL Injection detection operation
17
+ class SqlInjectionCheckBatchRequest
18
+ # Multiple items to detect for SQL Injection
19
+ attr_accessor :request_items
20
+
21
+ # Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
22
+ attr_accessor :detection_level
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'request_items' => :'RequestItems',
28
+ :'detection_level' => :'DetectionLevel'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.swagger_types
34
+ {
35
+ :'request_items' => :'Array<SqlInjectionCheckRequestItem>',
36
+ :'detection_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?(:'RequestItems')
49
+ if (value = attributes[:'RequestItems']).is_a?(Array)
50
+ self.request_items = value
51
+ end
52
+ end
53
+
54
+ if attributes.has_key?(:'DetectionLevel')
55
+ self.detection_level = attributes[:'DetectionLevel']
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
+ request_items == o.request_items &&
78
+ detection_level == o.detection_level
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
+ [request_items, detection_level].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 = CloudmersiveValidateApiClient.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