cloudmersive-validate-api-client 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -4
- data/docs/GeolocateStreetAddressResponse.md +13 -0
- data/docs/IPAddressApi.md +55 -0
- data/docs/TextInputApi.md +118 -0
- data/docs/XssProtectionResult.md +11 -0
- data/lib/cloudmersive-validate-api-client.rb +3 -0
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +54 -0
- data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +131 -0
- data/lib/cloudmersive-validate-api-client/models/geolocate_street_address_response.rb +236 -0
- data/lib/cloudmersive-validate-api-client/models/xss_protection_result.rb +216 -0
- data/lib/cloudmersive-validate-api-client/version.rb +1 -1
- data/spec/api/ip_address_api_spec.rb +12 -0
- data/spec/api/text_input_api_spec.rb +59 -0
- data/spec/models/geolocate_street_address_response_spec.rb +71 -0
- data/spec/models/xss_protection_result_spec.rb +59 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af976c8119e72adb285d9be4eeac657cf36266303727a89d71af599237c9030e
|
4
|
+
data.tar.gz: fa9de07603fd5982bd7936f055302926abaa5307c53995ecff1a89bff0e944f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d39dc860c9ab1c9460e7c165967c1b57b505fbace518aed79f15a71f93b323ff0d0fba9a1aee5fea8eef774a314a2d2a6e8f716773259df74b1114d4afc98dc
|
7
|
+
data.tar.gz: f2cea25c3c298c97928f5dcfb400e52d0b6d19628997e2c3c5b4896437fac8dcf767c4338224696f2bec76b0e5318151e9abed2fb52c65074b4288733586a9ca
|
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.
|
10
|
+
- Package version: 2.1.1
|
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.
|
26
|
+
gem install ./cloudmersive-validate-api-client-2.1.1.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.1.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.
|
34
|
+
gem 'cloudmersive-validate-api-client', '~> 2.1.1'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -104,6 +104,7 @@ Class | Method | HTTP request | Description
|
|
104
104
|
*CloudmersiveValidateApiClient::EmailApi* | [**email_address_get_servers**](docs/EmailApi.md#email_address_get_servers) | **POST** /validate/email/address/servers | Partially check whether an email address is valid
|
105
105
|
*CloudmersiveValidateApiClient::EmailApi* | [**email_full_validation**](docs/EmailApi.md#email_full_validation) | **POST** /validate/email/address/full | Fully validate an email address
|
106
106
|
*CloudmersiveValidateApiClient::EmailApi* | [**email_post**](docs/EmailApi.md#email_post) | **POST** /validate/email/address/syntaxOnly | Validate email adddress for syntactic correctness only
|
107
|
+
*CloudmersiveValidateApiClient::IPAddressApi* | [**i_p_address_geolocate_street_address**](docs/IPAddressApi.md#i_p_address_geolocate_street_address) | **POST** /validate/ip/geolocate/street-address | Geolocate an IP address to a street address
|
107
108
|
*CloudmersiveValidateApiClient::IPAddressApi* | [**i_p_address_is_threat**](docs/IPAddressApi.md#i_p_address_is_threat) | **POST** /validate/ip/is-threat | Check if IP address is a known threat
|
108
109
|
*CloudmersiveValidateApiClient::IPAddressApi* | [**i_p_address_is_tor_node**](docs/IPAddressApi.md#i_p_address_is_tor_node) | **POST** /validate/ip/is-tor-node | Check if IP address is a Tor node server
|
109
110
|
*CloudmersiveValidateApiClient::IPAddressApi* | [**i_p_address_post**](docs/IPAddressApi.md#i_p_address_post) | **POST** /validate/ip/geolocate | Geolocate an IP address
|
@@ -114,6 +115,8 @@ Class | Method | HTTP request | Description
|
|
114
115
|
*CloudmersiveValidateApiClient::NameApi* | [**name_validate_full_name**](docs/NameApi.md#name_validate_full_name) | **POST** /validate/name/full-name | Parse and validate a full name
|
115
116
|
*CloudmersiveValidateApiClient::NameApi* | [**name_validate_last_name**](docs/NameApi.md#name_validate_last_name) | **POST** /validate/name/last | Validate a last name
|
116
117
|
*CloudmersiveValidateApiClient::PhoneNumberApi* | [**phone_number_syntax_only**](docs/PhoneNumberApi.md#phone_number_syntax_only) | **POST** /validate/phonenumber/basic | Validate phone number (basic)
|
118
|
+
*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
|
119
|
+
*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
|
117
120
|
*CloudmersiveValidateApiClient::UserAgentApi* | [**user_agent_parse**](docs/UserAgentApi.md#user_agent_parse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots
|
118
121
|
*CloudmersiveValidateApiClient::VatApi* | [**vat_vat_lookup**](docs/VatApi.md#vat_vat_lookup) | **POST** /validate/vat/lookup | Validate a VAT number
|
119
122
|
|
@@ -132,6 +135,7 @@ Class | Method | HTTP request | Description
|
|
132
135
|
- [CloudmersiveValidateApiClient::FullNameValidationRequest](docs/FullNameValidationRequest.md)
|
133
136
|
- [CloudmersiveValidateApiClient::FullNameValidationResponse](docs/FullNameValidationResponse.md)
|
134
137
|
- [CloudmersiveValidateApiClient::GeolocateResponse](docs/GeolocateResponse.md)
|
138
|
+
- [CloudmersiveValidateApiClient::GeolocateStreetAddressResponse](docs/GeolocateStreetAddressResponse.md)
|
135
139
|
- [CloudmersiveValidateApiClient::GetGenderRequest](docs/GetGenderRequest.md)
|
136
140
|
- [CloudmersiveValidateApiClient::GetGenderResponse](docs/GetGenderResponse.md)
|
137
141
|
- [CloudmersiveValidateApiClient::GetTimezonesRequest](docs/GetTimezonesRequest.md)
|
@@ -170,6 +174,7 @@ Class | Method | HTTP request | Description
|
|
170
174
|
- [CloudmersiveValidateApiClient::VatLookupRequest](docs/VatLookupRequest.md)
|
171
175
|
- [CloudmersiveValidateApiClient::VatLookupResponse](docs/VatLookupResponse.md)
|
172
176
|
- [CloudmersiveValidateApiClient::WhoisResponse](docs/WhoisResponse.md)
|
177
|
+
- [CloudmersiveValidateApiClient::XssProtectionResult](docs/XssProtectionResult.md)
|
173
178
|
|
174
179
|
|
175
180
|
## Documentation for Authorization
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::GeolocateStreetAddressResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**country_code** | **String** | Two-letter country code of IP address | [optional]
|
7
|
+
**country_name** | **String** | Country name of IP address | [optional]
|
8
|
+
**street_address** | **String** | Street address of IP address | [optional]
|
9
|
+
**city** | **String** | City of IP address | [optional]
|
10
|
+
**region_name** | **String** | State/region of IP address | [optional]
|
11
|
+
**zip_code** | **String** | Zip or postal code of IP address | [optional]
|
12
|
+
|
13
|
+
|
data/docs/IPAddressApi.md
CHANGED
@@ -4,11 +4,66 @@ All URIs are relative to *https://api.cloudmersive.com*
|
|
4
4
|
|
5
5
|
Method | HTTP request | Description
|
6
6
|
------------- | ------------- | -------------
|
7
|
+
[**i_p_address_geolocate_street_address**](IPAddressApi.md#i_p_address_geolocate_street_address) | **POST** /validate/ip/geolocate/street-address | Geolocate an IP address to a street address
|
7
8
|
[**i_p_address_is_threat**](IPAddressApi.md#i_p_address_is_threat) | **POST** /validate/ip/is-threat | Check if IP address is a known threat
|
8
9
|
[**i_p_address_is_tor_node**](IPAddressApi.md#i_p_address_is_tor_node) | **POST** /validate/ip/is-tor-node | Check if IP address is a Tor node server
|
9
10
|
[**i_p_address_post**](IPAddressApi.md#i_p_address_post) | **POST** /validate/ip/geolocate | Geolocate an IP address
|
10
11
|
|
11
12
|
|
13
|
+
# **i_p_address_geolocate_street_address**
|
14
|
+
> GeolocateStreetAddressResponse i_p_address_geolocate_street_address(value)
|
15
|
+
|
16
|
+
Geolocate an IP address to a street address
|
17
|
+
|
18
|
+
Identify an IP address's street address. Useful for security and UX applications.
|
19
|
+
|
20
|
+
### Example
|
21
|
+
```ruby
|
22
|
+
# load the gem
|
23
|
+
require 'cloudmersive-validate-api-client'
|
24
|
+
# setup authorization
|
25
|
+
CloudmersiveValidateApiClient.configure do |config|
|
26
|
+
# Configure API key authorization: Apikey
|
27
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
28
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
29
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
30
|
+
end
|
31
|
+
|
32
|
+
api_instance = CloudmersiveValidateApiClient::IPAddressApi.new
|
33
|
+
|
34
|
+
value = 'value_example' # String | IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
35
|
+
|
36
|
+
|
37
|
+
begin
|
38
|
+
#Geolocate an IP address to a street address
|
39
|
+
result = api_instance.i_p_address_geolocate_street_address(value)
|
40
|
+
p result
|
41
|
+
rescue CloudmersiveValidateApiClient::ApiError => e
|
42
|
+
puts "Exception when calling IPAddressApi->i_p_address_geolocate_street_address: #{e}"
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
### Parameters
|
47
|
+
|
48
|
+
Name | Type | Description | Notes
|
49
|
+
------------- | ------------- | ------------- | -------------
|
50
|
+
**value** | **String**| IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes. |
|
51
|
+
|
52
|
+
### Return type
|
53
|
+
|
54
|
+
[**GeolocateStreetAddressResponse**](GeolocateStreetAddressResponse.md)
|
55
|
+
|
56
|
+
### Authorization
|
57
|
+
|
58
|
+
[Apikey](../README.md#Apikey)
|
59
|
+
|
60
|
+
### HTTP request headers
|
61
|
+
|
62
|
+
- **Content-Type**: text/javascript, application/json, text/json
|
63
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
64
|
+
|
65
|
+
|
66
|
+
|
12
67
|
# **i_p_address_is_threat**
|
13
68
|
> IPThreatResponse i_p_address_is_threat(value)
|
14
69
|
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::TextInputApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
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_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
|
+
|
11
|
+
# **text_input_check_xss**
|
12
|
+
> XssProtectionResult text_input_check_xss(value)
|
13
|
+
|
14
|
+
Check text input for Cross-Site-Scripting (XSS) attacks
|
15
|
+
|
16
|
+
Detects XSS (Cross-Site-Scripting) attacks from text input.
|
17
|
+
|
18
|
+
### Example
|
19
|
+
```ruby
|
20
|
+
# load the gem
|
21
|
+
require 'cloudmersive-validate-api-client'
|
22
|
+
# setup authorization
|
23
|
+
CloudmersiveValidateApiClient.configure do |config|
|
24
|
+
# Configure API key authorization: Apikey
|
25
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
26
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
27
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
28
|
+
end
|
29
|
+
|
30
|
+
api_instance = CloudmersiveValidateApiClient::TextInputApi.new
|
31
|
+
|
32
|
+
value = 'value_example' # String | User-facing text input.
|
33
|
+
|
34
|
+
|
35
|
+
begin
|
36
|
+
#Check text input for Cross-Site-Scripting (XSS) attacks
|
37
|
+
result = api_instance.text_input_check_xss(value)
|
38
|
+
p result
|
39
|
+
rescue CloudmersiveValidateApiClient::ApiError => e
|
40
|
+
puts "Exception when calling TextInputApi->text_input_check_xss: #{e}"
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
### Parameters
|
45
|
+
|
46
|
+
Name | Type | Description | Notes
|
47
|
+
------------- | ------------- | ------------- | -------------
|
48
|
+
**value** | **String**| User-facing text input. |
|
49
|
+
|
50
|
+
### Return type
|
51
|
+
|
52
|
+
[**XssProtectionResult**](XssProtectionResult.md)
|
53
|
+
|
54
|
+
### Authorization
|
55
|
+
|
56
|
+
[Apikey](../README.md#Apikey)
|
57
|
+
|
58
|
+
### HTTP request headers
|
59
|
+
|
60
|
+
- **Content-Type**: text/javascript, application/json, text/json
|
61
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# **text_input_protect_xss**
|
66
|
+
> XssProtectionResult text_input_protect_xss(value)
|
67
|
+
|
68
|
+
Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
69
|
+
|
70
|
+
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.
|
71
|
+
|
72
|
+
### Example
|
73
|
+
```ruby
|
74
|
+
# load the gem
|
75
|
+
require 'cloudmersive-validate-api-client'
|
76
|
+
# setup authorization
|
77
|
+
CloudmersiveValidateApiClient.configure do |config|
|
78
|
+
# Configure API key authorization: Apikey
|
79
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
80
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
81
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
82
|
+
end
|
83
|
+
|
84
|
+
api_instance = CloudmersiveValidateApiClient::TextInputApi.new
|
85
|
+
|
86
|
+
value = 'value_example' # String | User-facing text input.
|
87
|
+
|
88
|
+
|
89
|
+
begin
|
90
|
+
#Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
91
|
+
result = api_instance.text_input_protect_xss(value)
|
92
|
+
p result
|
93
|
+
rescue CloudmersiveValidateApiClient::ApiError => e
|
94
|
+
puts "Exception when calling TextInputApi->text_input_protect_xss: #{e}"
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
### Parameters
|
99
|
+
|
100
|
+
Name | Type | Description | Notes
|
101
|
+
------------- | ------------- | ------------- | -------------
|
102
|
+
**value** | **String**| User-facing text input. |
|
103
|
+
|
104
|
+
### Return type
|
105
|
+
|
106
|
+
[**XssProtectionResult**](XssProtectionResult.md)
|
107
|
+
|
108
|
+
### Authorization
|
109
|
+
|
110
|
+
[Apikey](../README.md#Apikey)
|
111
|
+
|
112
|
+
### HTTP request headers
|
113
|
+
|
114
|
+
- **Content-Type**: text/javascript, application/json, text/json
|
115
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
116
|
+
|
117
|
+
|
118
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::XssProtectionResult
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**contained_xss** | **BOOLEAN** | True if the input contained XSS scripting, false otherwise | [optional]
|
8
|
+
**original_input** | **String** | Original input string | [optional]
|
9
|
+
**normalized_result** | **String** | Normalized string result, with XSS removed | [optional]
|
10
|
+
|
11
|
+
|
@@ -29,6 +29,7 @@ require 'cloudmersive-validate-api-client/models/full_email_validation_response'
|
|
29
29
|
require 'cloudmersive-validate-api-client/models/full_name_validation_request'
|
30
30
|
require 'cloudmersive-validate-api-client/models/full_name_validation_response'
|
31
31
|
require 'cloudmersive-validate-api-client/models/geolocate_response'
|
32
|
+
require 'cloudmersive-validate-api-client/models/geolocate_street_address_response'
|
32
33
|
require 'cloudmersive-validate-api-client/models/get_gender_request'
|
33
34
|
require 'cloudmersive-validate-api-client/models/get_gender_response'
|
34
35
|
require 'cloudmersive-validate-api-client/models/get_timezones_request'
|
@@ -67,6 +68,7 @@ require 'cloudmersive-validate-api-client/models/validate_url_response_syntax_on
|
|
67
68
|
require 'cloudmersive-validate-api-client/models/vat_lookup_request'
|
68
69
|
require 'cloudmersive-validate-api-client/models/vat_lookup_response'
|
69
70
|
require 'cloudmersive-validate-api-client/models/whois_response'
|
71
|
+
require 'cloudmersive-validate-api-client/models/xss_protection_result'
|
70
72
|
|
71
73
|
# APIs
|
72
74
|
require 'cloudmersive-validate-api-client/api/address_api'
|
@@ -76,6 +78,7 @@ require 'cloudmersive-validate-api-client/api/ip_address_api'
|
|
76
78
|
require 'cloudmersive-validate-api-client/api/lead_enrichment_api'
|
77
79
|
require 'cloudmersive-validate-api-client/api/name_api'
|
78
80
|
require 'cloudmersive-validate-api-client/api/phone_number_api'
|
81
|
+
require 'cloudmersive-validate-api-client/api/text_input_api'
|
79
82
|
require 'cloudmersive-validate-api-client/api/user_agent_api'
|
80
83
|
require 'cloudmersive-validate-api-client/api/vat_api'
|
81
84
|
|
@@ -19,6 +19,60 @@ module CloudmersiveValidateApiClient
|
|
19
19
|
def initialize(api_client = ApiClient.default)
|
20
20
|
@api_client = api_client
|
21
21
|
end
|
22
|
+
# Geolocate an IP address to a street address
|
23
|
+
# Identify an IP address's street address. Useful for security and UX applications.
|
24
|
+
# @param value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [GeolocateStreetAddressResponse]
|
27
|
+
def i_p_address_geolocate_street_address(value, opts = {})
|
28
|
+
data, _status_code, _headers = i_p_address_geolocate_street_address_with_http_info(value, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Geolocate an IP address to a street address
|
33
|
+
# Identify an IP address's street address. Useful for security and UX applications.
|
34
|
+
# @param value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(GeolocateStreetAddressResponse, Fixnum, Hash)>] GeolocateStreetAddressResponse data, response status code and response headers
|
37
|
+
def i_p_address_geolocate_street_address_with_http_info(value, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: IPAddressApi.i_p_address_geolocate_street_address ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'value' is set
|
42
|
+
if @api_client.config.client_side_validation && value.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling IPAddressApi.i_p_address_geolocate_street_address"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/validate/ip/geolocate/street-address'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['text/javascript', 'application/json', 'text/json'])
|
57
|
+
|
58
|
+
# form parameters
|
59
|
+
form_params = {}
|
60
|
+
|
61
|
+
# http body (model)
|
62
|
+
post_body = @api_client.object_to_http_body(value)
|
63
|
+
auth_names = ['Apikey']
|
64
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
65
|
+
:header_params => header_params,
|
66
|
+
:query_params => query_params,
|
67
|
+
:form_params => form_params,
|
68
|
+
:body => post_body,
|
69
|
+
:auth_names => auth_names,
|
70
|
+
:return_type => 'GeolocateStreetAddressResponse')
|
71
|
+
if @api_client.config.debugging
|
72
|
+
@api_client.config.logger.debug "API called: IPAddressApi#i_p_address_geolocate_street_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
73
|
+
end
|
74
|
+
return data, status_code, headers
|
75
|
+
end
|
22
76
|
# Check if IP address is a known threat
|
23
77
|
# Check if the input IP address is a known threat IP address. Checks against known bad IPs, botnets, compromised servers, and other lists of threats.
|
24
78
|
# @param value IP address to check, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
@@ -0,0 +1,131 @@
|
|
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 'uri'
|
14
|
+
|
15
|
+
module CloudmersiveValidateApiClient
|
16
|
+
class TextInputApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Check text input for Cross-Site-Scripting (XSS) attacks
|
23
|
+
# Detects XSS (Cross-Site-Scripting) attacks from text input.
|
24
|
+
# @param value User-facing text input.
|
25
|
+
# @param [Hash] opts the optional parameters
|
26
|
+
# @return [XssProtectionResult]
|
27
|
+
def text_input_check_xss(value, opts = {})
|
28
|
+
data, _status_code, _headers = text_input_check_xss_with_http_info(value, opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Check text input for Cross-Site-Scripting (XSS) attacks
|
33
|
+
# Detects XSS (Cross-Site-Scripting) attacks from text input.
|
34
|
+
# @param value User-facing text input.
|
35
|
+
# @param [Hash] opts the optional parameters
|
36
|
+
# @return [Array<(XssProtectionResult, Fixnum, Hash)>] XssProtectionResult data, response status code and response headers
|
37
|
+
def text_input_check_xss_with_http_info(value, opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xss ...'
|
40
|
+
end
|
41
|
+
# verify the required parameter 'value' is set
|
42
|
+
if @api_client.config.client_side_validation && value.nil?
|
43
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_xss"
|
44
|
+
end
|
45
|
+
# resource path
|
46
|
+
local_var_path = '/validate/text-input/check/xss'
|
47
|
+
|
48
|
+
# query parameters
|
49
|
+
query_params = {}
|
50
|
+
|
51
|
+
# header parameters
|
52
|
+
header_params = {}
|
53
|
+
# HTTP header 'Accept' (if needed)
|
54
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
55
|
+
# HTTP header 'Content-Type'
|
56
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['text/javascript', 'application/json', 'text/json'])
|
57
|
+
|
58
|
+
# form parameters
|
59
|
+
form_params = {}
|
60
|
+
|
61
|
+
# http body (model)
|
62
|
+
post_body = @api_client.object_to_http_body(value)
|
63
|
+
auth_names = ['Apikey']
|
64
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
65
|
+
:header_params => header_params,
|
66
|
+
:query_params => query_params,
|
67
|
+
:form_params => form_params,
|
68
|
+
:body => post_body,
|
69
|
+
:auth_names => auth_names,
|
70
|
+
:return_type => 'XssProtectionResult')
|
71
|
+
if @api_client.config.debugging
|
72
|
+
@api_client.config.logger.debug "API called: TextInputApi#text_input_check_xss\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
73
|
+
end
|
74
|
+
return data, status_code, headers
|
75
|
+
end
|
76
|
+
# Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
77
|
+
# 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
|
+
# @param value User-facing text input.
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [XssProtectionResult]
|
81
|
+
def text_input_protect_xss(value, opts = {})
|
82
|
+
data, _status_code, _headers = text_input_protect_xss_with_http_info(value, opts)
|
83
|
+
data
|
84
|
+
end
|
85
|
+
|
86
|
+
# Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
87
|
+
# 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.
|
88
|
+
# @param value User-facing text input.
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(XssProtectionResult, Fixnum, Hash)>] XssProtectionResult data, response status code and response headers
|
91
|
+
def text_input_protect_xss_with_http_info(value, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: TextInputApi.text_input_protect_xss ...'
|
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_protect_xss"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/validate/text-input/protect/xss'
|
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(['text/javascript', '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 => 'XssProtectionResult')
|
125
|
+
if @api_client.config.debugging
|
126
|
+
@api_client.config.logger.debug "API called: TextInputApi#text_input_protect_xss\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
127
|
+
end
|
128
|
+
return data, status_code, headers
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
@@ -0,0 +1,236 @@
|
|
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
|
+
# Geolocation street address result
|
17
|
+
class GeolocateStreetAddressResponse
|
18
|
+
# Two-letter country code of IP address
|
19
|
+
attr_accessor :country_code
|
20
|
+
|
21
|
+
# Country name of IP address
|
22
|
+
attr_accessor :country_name
|
23
|
+
|
24
|
+
# Street address of IP address
|
25
|
+
attr_accessor :street_address
|
26
|
+
|
27
|
+
# City of IP address
|
28
|
+
attr_accessor :city
|
29
|
+
|
30
|
+
# State/region of IP address
|
31
|
+
attr_accessor :region_name
|
32
|
+
|
33
|
+
# Zip or postal code of IP address
|
34
|
+
attr_accessor :zip_code
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'country_code' => :'CountryCode',
|
40
|
+
:'country_name' => :'CountryName',
|
41
|
+
:'street_address' => :'StreetAddress',
|
42
|
+
:'city' => :'City',
|
43
|
+
:'region_name' => :'RegionName',
|
44
|
+
:'zip_code' => :'ZipCode'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Attribute type mapping.
|
49
|
+
def self.swagger_types
|
50
|
+
{
|
51
|
+
:'country_code' => :'String',
|
52
|
+
:'country_name' => :'String',
|
53
|
+
:'street_address' => :'String',
|
54
|
+
:'city' => :'String',
|
55
|
+
:'region_name' => :'String',
|
56
|
+
:'zip_code' => :'String'
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
# Initializes the object
|
61
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
62
|
+
def initialize(attributes = {})
|
63
|
+
return unless attributes.is_a?(Hash)
|
64
|
+
|
65
|
+
# convert string to symbol for hash key
|
66
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
67
|
+
|
68
|
+
if attributes.has_key?(:'CountryCode')
|
69
|
+
self.country_code = attributes[:'CountryCode']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'CountryName')
|
73
|
+
self.country_name = attributes[:'CountryName']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'StreetAddress')
|
77
|
+
self.street_address = attributes[:'StreetAddress']
|
78
|
+
end
|
79
|
+
|
80
|
+
if attributes.has_key?(:'City')
|
81
|
+
self.city = attributes[:'City']
|
82
|
+
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'RegionName')
|
85
|
+
self.region_name = attributes[:'RegionName']
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes.has_key?(:'ZipCode')
|
89
|
+
self.zip_code = attributes[:'ZipCode']
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
94
|
+
# @return Array for valid properties with the reasons
|
95
|
+
def list_invalid_properties
|
96
|
+
invalid_properties = Array.new
|
97
|
+
invalid_properties
|
98
|
+
end
|
99
|
+
|
100
|
+
# Check to see if the all the properties in the model are valid
|
101
|
+
# @return true if the model is valid
|
102
|
+
def valid?
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
106
|
+
# Checks equality by comparing each attribute.
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def ==(o)
|
109
|
+
return true if self.equal?(o)
|
110
|
+
self.class == o.class &&
|
111
|
+
country_code == o.country_code &&
|
112
|
+
country_name == o.country_name &&
|
113
|
+
street_address == o.street_address &&
|
114
|
+
city == o.city &&
|
115
|
+
region_name == o.region_name &&
|
116
|
+
zip_code == o.zip_code
|
117
|
+
end
|
118
|
+
|
119
|
+
# @see the `==` method
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def eql?(o)
|
122
|
+
self == o
|
123
|
+
end
|
124
|
+
|
125
|
+
# Calculates hash code according to all attributes.
|
126
|
+
# @return [Fixnum] Hash code
|
127
|
+
def hash
|
128
|
+
[country_code, country_name, street_address, city, region_name, zip_code].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def build_from_hash(attributes)
|
135
|
+
return nil unless attributes.is_a?(Hash)
|
136
|
+
self.class.swagger_types.each_pair do |key, type|
|
137
|
+
if type =~ /\AArray<(.*)>/i
|
138
|
+
# check to ensure the input is an array given that the attribute
|
139
|
+
# is documented as an array but the input is not
|
140
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
|
+
end
|
143
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
145
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
146
|
+
end
|
147
|
+
|
148
|
+
self
|
149
|
+
end
|
150
|
+
|
151
|
+
# Deserializes the data based on type
|
152
|
+
# @param string type Data type
|
153
|
+
# @param string value Value to be deserialized
|
154
|
+
# @return [Object] Deserialized data
|
155
|
+
def _deserialize(type, value)
|
156
|
+
case type.to_sym
|
157
|
+
when :DateTime
|
158
|
+
DateTime.parse(value)
|
159
|
+
when :Date
|
160
|
+
Date.parse(value)
|
161
|
+
when :String
|
162
|
+
value.to_s
|
163
|
+
when :Integer
|
164
|
+
value.to_i
|
165
|
+
when :Float
|
166
|
+
value.to_f
|
167
|
+
when :BOOLEAN
|
168
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
|
+
true
|
170
|
+
else
|
171
|
+
false
|
172
|
+
end
|
173
|
+
when :Object
|
174
|
+
# generic object (usually a Hash), return directly
|
175
|
+
value
|
176
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
177
|
+
inner_type = Regexp.last_match[:inner_type]
|
178
|
+
value.map { |v| _deserialize(inner_type, v) }
|
179
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
180
|
+
k_type = Regexp.last_match[:k_type]
|
181
|
+
v_type = Regexp.last_match[:v_type]
|
182
|
+
{}.tap do |hash|
|
183
|
+
value.each do |k, v|
|
184
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
185
|
+
end
|
186
|
+
end
|
187
|
+
else # model
|
188
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
189
|
+
temp_model.build_from_hash(value)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the string representation of the object
|
194
|
+
# @return [String] String presentation of the object
|
195
|
+
def to_s
|
196
|
+
to_hash.to_s
|
197
|
+
end
|
198
|
+
|
199
|
+
# to_body is an alias to to_hash (backward compatibility)
|
200
|
+
# @return [Hash] Returns the object in the form of hash
|
201
|
+
def to_body
|
202
|
+
to_hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Returns the object in the form of hash
|
206
|
+
# @return [Hash] Returns the object in the form of hash
|
207
|
+
def to_hash
|
208
|
+
hash = {}
|
209
|
+
self.class.attribute_map.each_pair do |attr, param|
|
210
|
+
value = self.send(attr)
|
211
|
+
next if value.nil?
|
212
|
+
hash[param] = _to_hash(value)
|
213
|
+
end
|
214
|
+
hash
|
215
|
+
end
|
216
|
+
|
217
|
+
# Outputs non-array value in the form of hash
|
218
|
+
# For object, use to_hash. Otherwise, just return the value
|
219
|
+
# @param [Object] value Any valid value
|
220
|
+
# @return [Hash] Returns the value in the form of hash
|
221
|
+
def _to_hash(value)
|
222
|
+
if value.is_a?(Array)
|
223
|
+
value.compact.map { |v| _to_hash(v) }
|
224
|
+
elsif value.is_a?(Hash)
|
225
|
+
{}.tap do |hash|
|
226
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
227
|
+
end
|
228
|
+
elsif value.respond_to? :to_hash
|
229
|
+
value.to_hash
|
230
|
+
else
|
231
|
+
value
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,216 @@
|
|
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 an XSS protection operation
|
17
|
+
class XssProtectionResult
|
18
|
+
# True if the operation was successful, false otherwise
|
19
|
+
attr_accessor :successful
|
20
|
+
|
21
|
+
# True if the input contained XSS scripting, false otherwise
|
22
|
+
attr_accessor :contained_xss
|
23
|
+
|
24
|
+
# Original input string
|
25
|
+
attr_accessor :original_input
|
26
|
+
|
27
|
+
# Normalized string result, with XSS removed
|
28
|
+
attr_accessor :normalized_result
|
29
|
+
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
31
|
+
def self.attribute_map
|
32
|
+
{
|
33
|
+
:'successful' => :'Successful',
|
34
|
+
:'contained_xss' => :'ContainedXss',
|
35
|
+
:'original_input' => :'OriginalInput',
|
36
|
+
:'normalized_result' => :'NormalizedResult'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'successful' => :'BOOLEAN',
|
44
|
+
:'contained_xss' => :'BOOLEAN',
|
45
|
+
:'original_input' => :'String',
|
46
|
+
:'normalized_result' => :'String'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'Successful')
|
59
|
+
self.successful = attributes[:'Successful']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'ContainedXss')
|
63
|
+
self.contained_xss = attributes[:'ContainedXss']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'OriginalInput')
|
67
|
+
self.original_input = attributes[:'OriginalInput']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'NormalizedResult')
|
71
|
+
self.normalized_result = attributes[:'NormalizedResult']
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
successful == o.successful &&
|
94
|
+
contained_xss == o.contained_xss &&
|
95
|
+
original_input == o.original_input &&
|
96
|
+
normalized_result == o.normalized_result
|
97
|
+
end
|
98
|
+
|
99
|
+
# @see the `==` method
|
100
|
+
# @param [Object] Object to be compared
|
101
|
+
def eql?(o)
|
102
|
+
self == o
|
103
|
+
end
|
104
|
+
|
105
|
+
# Calculates hash code according to all attributes.
|
106
|
+
# @return [Fixnum] Hash code
|
107
|
+
def hash
|
108
|
+
[successful, contained_xss, original_input, normalized_result].hash
|
109
|
+
end
|
110
|
+
|
111
|
+
# Builds the object from hash
|
112
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
113
|
+
# @return [Object] Returns the model itself
|
114
|
+
def build_from_hash(attributes)
|
115
|
+
return nil unless attributes.is_a?(Hash)
|
116
|
+
self.class.swagger_types.each_pair do |key, type|
|
117
|
+
if type =~ /\AArray<(.*)>/i
|
118
|
+
# check to ensure the input is an array given that the attribute
|
119
|
+
# is documented as an array but the input is not
|
120
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
121
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
122
|
+
end
|
123
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
124
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
125
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
126
|
+
end
|
127
|
+
|
128
|
+
self
|
129
|
+
end
|
130
|
+
|
131
|
+
# Deserializes the data based on type
|
132
|
+
# @param string type Data type
|
133
|
+
# @param string value Value to be deserialized
|
134
|
+
# @return [Object] Deserialized data
|
135
|
+
def _deserialize(type, value)
|
136
|
+
case type.to_sym
|
137
|
+
when :DateTime
|
138
|
+
DateTime.parse(value)
|
139
|
+
when :Date
|
140
|
+
Date.parse(value)
|
141
|
+
when :String
|
142
|
+
value.to_s
|
143
|
+
when :Integer
|
144
|
+
value.to_i
|
145
|
+
when :Float
|
146
|
+
value.to_f
|
147
|
+
when :BOOLEAN
|
148
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
when :Object
|
154
|
+
# generic object (usually a Hash), return directly
|
155
|
+
value
|
156
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
157
|
+
inner_type = Regexp.last_match[:inner_type]
|
158
|
+
value.map { |v| _deserialize(inner_type, v) }
|
159
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
160
|
+
k_type = Regexp.last_match[:k_type]
|
161
|
+
v_type = Regexp.last_match[:v_type]
|
162
|
+
{}.tap do |hash|
|
163
|
+
value.each do |k, v|
|
164
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else # model
|
168
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
169
|
+
temp_model.build_from_hash(value)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the string representation of the object
|
174
|
+
# @return [String] String presentation of the object
|
175
|
+
def to_s
|
176
|
+
to_hash.to_s
|
177
|
+
end
|
178
|
+
|
179
|
+
# to_body is an alias to to_hash (backward compatibility)
|
180
|
+
# @return [Hash] Returns the object in the form of hash
|
181
|
+
def to_body
|
182
|
+
to_hash
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the object in the form of hash
|
186
|
+
# @return [Hash] Returns the object in the form of hash
|
187
|
+
def to_hash
|
188
|
+
hash = {}
|
189
|
+
self.class.attribute_map.each_pair do |attr, param|
|
190
|
+
value = self.send(attr)
|
191
|
+
next if value.nil?
|
192
|
+
hash[param] = _to_hash(value)
|
193
|
+
end
|
194
|
+
hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Outputs non-array value in the form of hash
|
198
|
+
# For object, use to_hash. Otherwise, just return the value
|
199
|
+
# @param [Object] value Any valid value
|
200
|
+
# @return [Hash] Returns the value in the form of hash
|
201
|
+
def _to_hash(value)
|
202
|
+
if value.is_a?(Array)
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
204
|
+
elsif value.is_a?(Hash)
|
205
|
+
{}.tap do |hash|
|
206
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
207
|
+
end
|
208
|
+
elsif value.respond_to? :to_hash
|
209
|
+
value.to_hash
|
210
|
+
else
|
211
|
+
value
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
end
|
@@ -32,6 +32,18 @@ describe 'IPAddressApi' do
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
# unit tests for i_p_address_geolocate_street_address
|
36
|
+
# Geolocate an IP address to a street address
|
37
|
+
# Identify an IP address's street address. Useful for security and UX applications.
|
38
|
+
# @param value IP address to geolocate, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [GeolocateStreetAddressResponse]
|
41
|
+
describe 'i_p_address_geolocate_street_address test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
35
47
|
# unit tests for i_p_address_is_threat
|
36
48
|
# Check if IP address is a known threat
|
37
49
|
# Check if the input IP address is a known threat IP address. Checks against known bad IPs, botnets, compromised servers, and other lists of threats.
|
@@ -0,0 +1,59 @@
|
|
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
|
+
|
16
|
+
# Unit tests for CloudmersiveValidateApiClient::TextInputApi
|
17
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'TextInputApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@instance = CloudmersiveValidateApiClient::TextInputApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of TextInputApi' do
|
30
|
+
it 'should create an instance of TextInputApi' do
|
31
|
+
expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::TextInputApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for text_input_check_xss
|
36
|
+
# Check text input for Cross-Site-Scripting (XSS) attacks
|
37
|
+
# Detects XSS (Cross-Site-Scripting) attacks from text input.
|
38
|
+
# @param value User-facing text input.
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [XssProtectionResult]
|
41
|
+
describe 'text_input_check_xss test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for text_input_protect_xss
|
48
|
+
# Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
49
|
+
# 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.
|
50
|
+
# @param value User-facing text input.
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [XssProtectionResult]
|
53
|
+
describe 'text_input_protect_xss test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,71 @@
|
|
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::GeolocateStreetAddressResponse
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'GeolocateStreetAddressResponse' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveValidateApiClient::GeolocateStreetAddressResponse.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of GeolocateStreetAddressResponse' do
|
31
|
+
it 'should create an instance of GeolocateStreetAddressResponse' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::GeolocateStreetAddressResponse)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "country_code"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "country_name"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "street_address"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "city"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe 'test attribute "region_name"' do
|
60
|
+
it 'should work' do
|
61
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe 'test attribute "zip_code"' do
|
66
|
+
it 'should work' do
|
67
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,59 @@
|
|
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::XssProtectionResult
|
18
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
19
|
+
# Please update as you see appropriate
|
20
|
+
describe 'XssProtectionResult' do
|
21
|
+
before do
|
22
|
+
# run before each test
|
23
|
+
@instance = CloudmersiveValidateApiClient::XssProtectionResult.new
|
24
|
+
end
|
25
|
+
|
26
|
+
after do
|
27
|
+
# run after each test
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'test an instance of XssProtectionResult' do
|
31
|
+
it 'should create an instance of XssProtectionResult' do
|
32
|
+
expect(@instance).to be_instance_of(CloudmersiveValidateApiClient::XssProtectionResult)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'test attribute "successful"' do
|
36
|
+
it 'should work' do
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'test attribute "contained_xss"' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'test attribute "original_input"' do
|
48
|
+
it 'should work' do
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'test attribute "normalized_result"' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
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.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloudmersive
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -218,6 +218,7 @@ files:
|
|
218
218
|
- "./docs/FullNameValidationRequest.md"
|
219
219
|
- "./docs/FullNameValidationResponse.md"
|
220
220
|
- "./docs/GeolocateResponse.md"
|
221
|
+
- "./docs/GeolocateStreetAddressResponse.md"
|
221
222
|
- "./docs/GetGenderRequest.md"
|
222
223
|
- "./docs/GetGenderResponse.md"
|
223
224
|
- "./docs/GetTimezonesRequest.md"
|
@@ -237,6 +238,7 @@ files:
|
|
237
238
|
- "./docs/PhoneNumberValidationResponse.md"
|
238
239
|
- "./docs/ReverseGeocodeAddressRequest.md"
|
239
240
|
- "./docs/ReverseGeocodeAddressResponse.md"
|
241
|
+
- "./docs/TextInputApi.md"
|
240
242
|
- "./docs/Timezone.md"
|
241
243
|
- "./docs/TorNodeResponse.md"
|
242
244
|
- "./docs/UserAgentApi.md"
|
@@ -262,6 +264,7 @@ files:
|
|
262
264
|
- "./docs/VatLookupRequest.md"
|
263
265
|
- "./docs/VatLookupResponse.md"
|
264
266
|
- "./docs/WhoisResponse.md"
|
267
|
+
- "./docs/XssProtectionResult.md"
|
265
268
|
- "./git_push.sh"
|
266
269
|
- "./lib/cloudmersive-validate-api-client.rb"
|
267
270
|
- "./lib/cloudmersive-validate-api-client/api/address_api.rb"
|
@@ -271,6 +274,7 @@ files:
|
|
271
274
|
- "./lib/cloudmersive-validate-api-client/api/lead_enrichment_api.rb"
|
272
275
|
- "./lib/cloudmersive-validate-api-client/api/name_api.rb"
|
273
276
|
- "./lib/cloudmersive-validate-api-client/api/phone_number_api.rb"
|
277
|
+
- "./lib/cloudmersive-validate-api-client/api/text_input_api.rb"
|
274
278
|
- "./lib/cloudmersive-validate-api-client/api/user_agent_api.rb"
|
275
279
|
- "./lib/cloudmersive-validate-api-client/api/vat_api.rb"
|
276
280
|
- "./lib/cloudmersive-validate-api-client/api_client.rb"
|
@@ -288,6 +292,7 @@ files:
|
|
288
292
|
- "./lib/cloudmersive-validate-api-client/models/full_name_validation_request.rb"
|
289
293
|
- "./lib/cloudmersive-validate-api-client/models/full_name_validation_response.rb"
|
290
294
|
- "./lib/cloudmersive-validate-api-client/models/geolocate_response.rb"
|
295
|
+
- "./lib/cloudmersive-validate-api-client/models/geolocate_street_address_response.rb"
|
291
296
|
- "./lib/cloudmersive-validate-api-client/models/get_gender_request.rb"
|
292
297
|
- "./lib/cloudmersive-validate-api-client/models/get_gender_response.rb"
|
293
298
|
- "./lib/cloudmersive-validate-api-client/models/get_timezones_request.rb"
|
@@ -326,6 +331,7 @@ files:
|
|
326
331
|
- "./lib/cloudmersive-validate-api-client/models/vat_lookup_request.rb"
|
327
332
|
- "./lib/cloudmersive-validate-api-client/models/vat_lookup_response.rb"
|
328
333
|
- "./lib/cloudmersive-validate-api-client/models/whois_response.rb"
|
334
|
+
- "./lib/cloudmersive-validate-api-client/models/xss_protection_result.rb"
|
329
335
|
- "./lib/cloudmersive-validate-api-client/version.rb"
|
330
336
|
- "./spec/api/address_api_spec.rb"
|
331
337
|
- "./spec/api/domain_api_spec.rb"
|
@@ -334,6 +340,7 @@ files:
|
|
334
340
|
- "./spec/api/lead_enrichment_api_spec.rb"
|
335
341
|
- "./spec/api/name_api_spec.rb"
|
336
342
|
- "./spec/api/phone_number_api_spec.rb"
|
343
|
+
- "./spec/api/text_input_api_spec.rb"
|
337
344
|
- "./spec/api/user_agent_api_spec.rb"
|
338
345
|
- "./spec/api/vat_api_spec.rb"
|
339
346
|
- "./spec/api_client_spec.rb"
|
@@ -350,6 +357,7 @@ files:
|
|
350
357
|
- "./spec/models/full_name_validation_request_spec.rb"
|
351
358
|
- "./spec/models/full_name_validation_response_spec.rb"
|
352
359
|
- "./spec/models/geolocate_response_spec.rb"
|
360
|
+
- "./spec/models/geolocate_street_address_response_spec.rb"
|
353
361
|
- "./spec/models/get_gender_request_spec.rb"
|
354
362
|
- "./spec/models/get_gender_response_spec.rb"
|
355
363
|
- "./spec/models/get_timezones_request_spec.rb"
|
@@ -388,6 +396,7 @@ files:
|
|
388
396
|
- "./spec/models/vat_lookup_request_spec.rb"
|
389
397
|
- "./spec/models/vat_lookup_response_spec.rb"
|
390
398
|
- "./spec/models/whois_response_spec.rb"
|
399
|
+
- "./spec/models/xss_protection_result_spec.rb"
|
391
400
|
- "./spec/spec_helper.rb"
|
392
401
|
homepage: https://www.cloudmersive.com/validate-api
|
393
402
|
licenses:
|