cloudmersive-validate-api-client 2.1.9 → 2.2.0

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: b14865010ef033e3b2eb06a1ead269e3e1282f68298cc426469d6b05308f5101
4
- data.tar.gz: 2cebdb3e846f47bb3fa2e8d5c9c346271d3418c82d79507a622ea74e9cbdeb71
3
+ metadata.gz: b718b14d76475a079bd8b6170efa4b446eeb1f72f1dc675e668fc7df317702f7
4
+ data.tar.gz: 743e6ffadb3143a39d6b1396cbbb49451253474f210997ae1cb96cf8570f9e27
5
5
  SHA512:
6
- metadata.gz: 7aa827e35f6d854d22b9b50d2276f0ccc51ca5f2446a2ff0e5fd0e50d6837ea57ef1dc4beb4e2f8cafeda2a3bb5f40a24b2a55d6af01e86bbe851b0061319f09
7
- data.tar.gz: 76cec04103d7d4818c83bcc518daa22c8ba71fb3bc33ac9c19806d82a1aee4e12985d80ed720b8847da27a623fa5dc36d60252219cac5761e95f23f21c5122c8
6
+ metadata.gz: 5b4cef8c87f1a63adb8f30eaf38b655004ab274da06d27379b3368f5d47742c1853ca6ec945fc27b11b0a5f79790b11d660d56e0cb558769dc94cfed5379474d
7
+ data.tar.gz: 7f3be0521871024a35d9e8d802727f61475ecfc1761ccb7bcdadaf844708b34fc8ebf2e04e68bfc41b6bac778907dda92c090b7b800b97277407c98e0d657671
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.9
10
+ - Package version: 2.2.0
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.9.gem
26
+ gem install ./cloudmersive-validate-api-client-2.2.0.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.9.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.2.0.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.9'
34
+ gem 'cloudmersive-validate-api-client', '~> 2.2.0'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -132,6 +132,8 @@ Class | Method | HTTP request | Description
132
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
133
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
134
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
135
+ *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_xxe**](docs/TextInputApi.md#text_input_check_xxe) | **POST** /validate/text-input/check/xxe | Protect text input from XML External Entity (XXE) attacks
136
+ *CloudmersiveValidateApiClient::TextInputApi* | [**text_input_check_xxe_batch**](docs/TextInputApi.md#text_input_check_xxe_batch) | **POST** /validate/text-input/check/xxe/batch | Protect text input from XML External Entity (XXE) attacks
135
137
  *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
136
138
  *CloudmersiveValidateApiClient::UserAgentApi* | [**user_agent_parse**](docs/UserAgentApi.md#user_agent_parse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots
137
139
  *CloudmersiveValidateApiClient::VatApi* | [**vat_vat_lookup**](docs/VatApi.md#vat_vat_lookup) | **POST** /validate/vat/lookup | Validate a VAT number
@@ -217,6 +219,10 @@ Class | Method | HTTP request | Description
217
219
  - [CloudmersiveValidateApiClient::XssProtectionBatchResponse](docs/XssProtectionBatchResponse.md)
218
220
  - [CloudmersiveValidateApiClient::XssProtectionRequestItem](docs/XssProtectionRequestItem.md)
219
221
  - [CloudmersiveValidateApiClient::XssProtectionResult](docs/XssProtectionResult.md)
222
+ - [CloudmersiveValidateApiClient::XxeDetectionBatchRequest](docs/XxeDetectionBatchRequest.md)
223
+ - [CloudmersiveValidateApiClient::XxeDetectionBatchResponse](docs/XxeDetectionBatchResponse.md)
224
+ - [CloudmersiveValidateApiClient::XxeDetectionRequestItem](docs/XxeDetectionRequestItem.md)
225
+ - [CloudmersiveValidateApiClient::XxeDetectionResult](docs/XxeDetectionResult.md)
220
226
 
221
227
 
222
228
  ## Documentation for Authorization
data/docs/TextInputApi.md CHANGED
@@ -8,6 +8,8 @@ Method | HTTP request | Description
8
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
9
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
10
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
11
+ [**text_input_check_xxe**](TextInputApi.md#text_input_check_xxe) | **POST** /validate/text-input/check/xxe | Protect text input from XML External Entity (XXE) attacks
12
+ [**text_input_check_xxe_batch**](TextInputApi.md#text_input_check_xxe_batch) | **POST** /validate/text-input/check/xxe/batch | Protect text input from XML External Entity (XXE) attacks
11
13
  [**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
12
14
 
13
15
 
@@ -231,6 +233,122 @@ Name | Type | Description | Notes
231
233
 
232
234
 
233
235
 
236
+ # **text_input_check_xxe**
237
+ > XxeDetectionResult text_input_check_xxe(value, opts)
238
+
239
+ Protect text input from XML External Entity (XXE) attacks
240
+
241
+ Detects XXE (XML External Entity) attacks from text input.
242
+
243
+ ### Example
244
+ ```ruby
245
+ # load the gem
246
+ require 'cloudmersive-validate-api-client'
247
+ # setup authorization
248
+ CloudmersiveValidateApiClient.configure do |config|
249
+ # Configure API key authorization: Apikey
250
+ config.api_key['Apikey'] = 'YOUR API KEY'
251
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
252
+ #config.api_key_prefix['Apikey'] = 'Bearer'
253
+ end
254
+
255
+ api_instance = CloudmersiveValidateApiClient::TextInputApi.new
256
+
257
+ value = 'value_example' # String | User-facing text input.
258
+
259
+ opts = {
260
+ allow_internet_urls: true, # BOOLEAN | Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
261
+ known_safe_urls: 'known_safe_urls_example', # String | Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
262
+ known_unsafe_urls: 'known_unsafe_urls_example' # String | Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
263
+ }
264
+
265
+ begin
266
+ #Protect text input from XML External Entity (XXE) attacks
267
+ result = api_instance.text_input_check_xxe(value, opts)
268
+ p result
269
+ rescue CloudmersiveValidateApiClient::ApiError => e
270
+ puts "Exception when calling TextInputApi->text_input_check_xxe: #{e}"
271
+ end
272
+ ```
273
+
274
+ ### Parameters
275
+
276
+ Name | Type | Description | Notes
277
+ ------------- | ------------- | ------------- | -------------
278
+ **value** | **String**| User-facing text input. |
279
+ **allow_internet_urls** | **BOOLEAN**| Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. | [optional]
280
+ **known_safe_urls** | **String**| Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. | [optional]
281
+ **known_unsafe_urls** | **String**| Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. | [optional]
282
+
283
+ ### Return type
284
+
285
+ [**XxeDetectionResult**](XxeDetectionResult.md)
286
+
287
+ ### Authorization
288
+
289
+ [Apikey](../README.md#Apikey)
290
+
291
+ ### HTTP request headers
292
+
293
+ - **Content-Type**: application/json, text/json
294
+ - **Accept**: application/json, text/json, application/xml, text/xml
295
+
296
+
297
+
298
+ # **text_input_check_xxe_batch**
299
+ > XxeDetectionBatchResponse text_input_check_xxe_batch(request)
300
+
301
+ Protect text input from XML External Entity (XXE) attacks
302
+
303
+ Detects XXE (XML External Entity) attacks from text input.
304
+
305
+ ### Example
306
+ ```ruby
307
+ # load the gem
308
+ require 'cloudmersive-validate-api-client'
309
+ # setup authorization
310
+ CloudmersiveValidateApiClient.configure do |config|
311
+ # Configure API key authorization: Apikey
312
+ config.api_key['Apikey'] = 'YOUR API KEY'
313
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
314
+ #config.api_key_prefix['Apikey'] = 'Bearer'
315
+ end
316
+
317
+ api_instance = CloudmersiveValidateApiClient::TextInputApi.new
318
+
319
+ request = CloudmersiveValidateApiClient::XxeDetectionBatchRequest.new # XxeDetectionBatchRequest |
320
+
321
+
322
+ begin
323
+ #Protect text input from XML External Entity (XXE) attacks
324
+ result = api_instance.text_input_check_xxe_batch(request)
325
+ p result
326
+ rescue CloudmersiveValidateApiClient::ApiError => e
327
+ puts "Exception when calling TextInputApi->text_input_check_xxe_batch: #{e}"
328
+ end
329
+ ```
330
+
331
+ ### Parameters
332
+
333
+ Name | Type | Description | Notes
334
+ ------------- | ------------- | ------------- | -------------
335
+ **request** | [**XxeDetectionBatchRequest**](XxeDetectionBatchRequest.md)| |
336
+
337
+ ### Return type
338
+
339
+ [**XxeDetectionBatchResponse**](XxeDetectionBatchResponse.md)
340
+
341
+ ### Authorization
342
+
343
+ [Apikey](../README.md#Apikey)
344
+
345
+ ### HTTP request headers
346
+
347
+ - **Content-Type**: application/json, text/json
348
+ - **Accept**: application/json, text/json, application/xml, text/xml
349
+
350
+
351
+
234
352
  # **text_input_protect_xss**
235
353
  > XssProtectionResult text_input_protect_xss(value)
236
354
 
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::XxeDetectionBatchRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **request_items** | [**Array<XxeDetectionRequestItem>**](XxeDetectionRequestItem.md) | Multiple items to protect for XXE | [optional]
7
+
8
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::XxeDetectionBatchResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **result_items** | [**Array<XxeDetectionResult>**](XxeDetectionResult.md) | Results from performing a batch XSS protection operation | [optional]
7
+
8
+
@@ -0,0 +1,11 @@
1
+ # CloudmersiveValidateApiClient::XxeDetectionRequestItem
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **input_text** | **String** | Individual input text item to protect from XXE | [optional]
7
+ **allow_internet_urls** | **BOOLEAN** | Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false. | [optional]
8
+ **known_safe_urls** | **Array<String>** | Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe. | [optional]
9
+ **known_unsafe_urls** | **Array<String>** | Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe. | [optional]
10
+
11
+
@@ -0,0 +1,9 @@
1
+ # CloudmersiveValidateApiClient::XxeDetectionResult
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
7
+ **contained_xxe** | **BOOLEAN** | True if the input contained XXE threats, false otherwise | [optional]
8
+
9
+
@@ -95,6 +95,10 @@ require 'cloudmersive-validate-api-client/models/xss_protection_batch_request'
95
95
  require 'cloudmersive-validate-api-client/models/xss_protection_batch_response'
96
96
  require 'cloudmersive-validate-api-client/models/xss_protection_request_item'
97
97
  require 'cloudmersive-validate-api-client/models/xss_protection_result'
98
+ require 'cloudmersive-validate-api-client/models/xxe_detection_batch_request'
99
+ require 'cloudmersive-validate-api-client/models/xxe_detection_batch_response'
100
+ require 'cloudmersive-validate-api-client/models/xxe_detection_request_item'
101
+ require 'cloudmersive-validate-api-client/models/xxe_detection_result'
98
102
 
99
103
  # APIs
100
104
  require 'cloudmersive-validate-api-client/api/address_api'
@@ -238,6 +238,123 @@ module CloudmersiveValidateApiClient
238
238
  end
239
239
  return data, status_code, headers
240
240
  end
241
+ # Protect text input from XML External Entity (XXE) attacks
242
+ # Detects XXE (XML External Entity) attacks from text input.
243
+ # @param value User-facing text input.
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [BOOLEAN] :allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
246
+ # @option opts [String] :known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
247
+ # @option opts [String] :known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
248
+ # @return [XxeDetectionResult]
249
+ def text_input_check_xxe(value, opts = {})
250
+ data, _status_code, _headers = text_input_check_xxe_with_http_info(value, opts)
251
+ data
252
+ end
253
+
254
+ # Protect text input from XML External Entity (XXE) attacks
255
+ # Detects XXE (XML External Entity) attacks from text input.
256
+ # @param value User-facing text input.
257
+ # @param [Hash] opts the optional parameters
258
+ # @option opts [BOOLEAN] :allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
259
+ # @option opts [String] :known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
260
+ # @option opts [String] :known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
261
+ # @return [Array<(XxeDetectionResult, Fixnum, Hash)>] XxeDetectionResult data, response status code and response headers
262
+ def text_input_check_xxe_with_http_info(value, opts = {})
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xxe ...'
265
+ end
266
+ # verify the required parameter 'value' is set
267
+ if @api_client.config.client_side_validation && value.nil?
268
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_xxe"
269
+ end
270
+ # resource path
271
+ local_var_path = '/validate/text-input/check/xxe'
272
+
273
+ # query parameters
274
+ query_params = {}
275
+
276
+ # header parameters
277
+ header_params = {}
278
+ # HTTP header 'Accept' (if needed)
279
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
280
+ # HTTP header 'Content-Type'
281
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
282
+ header_params[:'allowInternetUrls'] = opts[:'allow_internet_urls'] if !opts[:'allow_internet_urls'].nil?
283
+ header_params[:'knownSafeUrls'] = opts[:'known_safe_urls'] if !opts[:'known_safe_urls'].nil?
284
+ header_params[:'knownUnsafeUrls'] = opts[:'known_unsafe_urls'] if !opts[:'known_unsafe_urls'].nil?
285
+
286
+ # form parameters
287
+ form_params = {}
288
+
289
+ # http body (model)
290
+ post_body = @api_client.object_to_http_body(value)
291
+ auth_names = ['Apikey']
292
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
293
+ :header_params => header_params,
294
+ :query_params => query_params,
295
+ :form_params => form_params,
296
+ :body => post_body,
297
+ :auth_names => auth_names,
298
+ :return_type => 'XxeDetectionResult')
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_xxe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
301
+ end
302
+ return data, status_code, headers
303
+ end
304
+ # Protect text input from XML External Entity (XXE) attacks
305
+ # Detects XXE (XML External Entity) attacks from text input.
306
+ # @param request
307
+ # @param [Hash] opts the optional parameters
308
+ # @return [XxeDetectionBatchResponse]
309
+ def text_input_check_xxe_batch(request, opts = {})
310
+ data, _status_code, _headers = text_input_check_xxe_batch_with_http_info(request, opts)
311
+ data
312
+ end
313
+
314
+ # Protect text input from XML External Entity (XXE) attacks
315
+ # Detects XXE (XML External Entity) attacks from text input.
316
+ # @param request
317
+ # @param [Hash] opts the optional parameters
318
+ # @return [Array<(XxeDetectionBatchResponse, Fixnum, Hash)>] XxeDetectionBatchResponse data, response status code and response headers
319
+ def text_input_check_xxe_batch_with_http_info(request, opts = {})
320
+ if @api_client.config.debugging
321
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xxe_batch ...'
322
+ end
323
+ # verify the required parameter 'request' is set
324
+ if @api_client.config.client_side_validation && request.nil?
325
+ fail ArgumentError, "Missing the required parameter 'request' when calling TextInputApi.text_input_check_xxe_batch"
326
+ end
327
+ # resource path
328
+ local_var_path = '/validate/text-input/check/xxe/batch'
329
+
330
+ # query parameters
331
+ query_params = {}
332
+
333
+ # header parameters
334
+ header_params = {}
335
+ # HTTP header 'Accept' (if needed)
336
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
337
+ # HTTP header 'Content-Type'
338
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
339
+
340
+ # form parameters
341
+ form_params = {}
342
+
343
+ # http body (model)
344
+ post_body = @api_client.object_to_http_body(request)
345
+ auth_names = ['Apikey']
346
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
347
+ :header_params => header_params,
348
+ :query_params => query_params,
349
+ :form_params => form_params,
350
+ :body => post_body,
351
+ :auth_names => auth_names,
352
+ :return_type => 'XxeDetectionBatchResponse')
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_xxe_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
241
358
  # Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
242
359
  # 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.
243
360
  # @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 XXE detection operation
17
+ class XxeDetectionBatchRequest
18
+ # Multiple items to protect for XXE
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<XxeDetectionRequestItem>'
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