cloudmersive-validate-api-client 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/docs/DomainApi.md +55 -0
- data/docs/UserAgentApi.md +63 -0
- data/docs/UserAgentValidateRequest.md +8 -0
- data/docs/UserAgentValidateResponse.md +21 -0
- data/docs/ValidateUrlRequestFull.md +8 -0
- data/docs/ValidateUrlResponseFull.md +12 -0
- data/lib/cloudmersive-validate-api-client.rb +5 -0
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +55 -0
- data/lib/cloudmersive-validate-api-client/api/user_agent_api.rb +78 -0
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_request.rb +189 -0
- data/lib/cloudmersive-validate-api-client/models/user_agent_validate_response.rb +319 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_request_full.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_full.rb +229 -0
- data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +1 -1
- data/lib/cloudmersive-validate-api-client/version.rb +1 -1
- data/spec/api/domain_api_spec.rb +12 -0
- data/spec/api/user_agent_api_spec.rb +47 -0
- data/spec/models/user_agent_validate_request_spec.rb +42 -0
- data/spec/models/user_agent_validate_response_spec.rb +120 -0
- data/spec/models/validate_url_request_full_spec.rb +42 -0
- data/spec/models/validate_url_response_full_spec.rb +66 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7135177ad51c8502ae852be5bc3617dc7c2223fc72f6cf73e4f018b536ff3b89
|
4
|
+
data.tar.gz: 4e03d4a5bc7f40e648406778707abf5a24c106ab39d0c7970f6ed696eaf0a196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86c6819ed7f137ef233b5a4b0873a213f8474c780f79373d373a364e87a821bec557c91cb629cf9a05580a0a9ac4dd03595d7a748b3130d27858d45bad5cc71
|
7
|
+
data.tar.gz: c49afb5ccd636f80a7527afaa5575dfc3f257d70e33cc1e97dcbbbd544533d3f9bd0c8196120709e09af296eb8559abbf9ae3ade8047321dfbd9c8cf4cf2cab4
|
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: 1.3.
|
10
|
+
- Package version: 1.3.6
|
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-1.3.
|
26
|
+
gem install ./cloudmersive-validate-api-client-1.3.6.gem
|
27
27
|
```
|
28
|
-
(for development, run `gem install --dev ./cloudmersive-validate-api-client-1.3.
|
28
|
+
(for development, run `gem install --dev ./cloudmersive-validate-api-client-1.3.6.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', '~> 1.3.
|
34
|
+
gem 'cloudmersive-validate-api-client', '~> 1.3.6'
|
35
35
|
|
36
36
|
### Install from Git
|
37
37
|
|
@@ -86,6 +86,7 @@ Class | Method | HTTP request | Description
|
|
86
86
|
*CloudmersiveValidateApiClient::AddressApi* | [**address_parse_string**](docs/AddressApi.md#address_parse_string) | **POST** /validate/address/parse | Parse an unstructured input text string into an international, formatted address
|
87
87
|
*CloudmersiveValidateApiClient::DomainApi* | [**domain_check**](docs/DomainApi.md#domain_check) | **POST** /validate/domain/check | Validate a domain name
|
88
88
|
*CloudmersiveValidateApiClient::DomainApi* | [**domain_post**](docs/DomainApi.md#domain_post) | **POST** /validate/domain/whois | Get WHOIS information for a domain
|
89
|
+
*CloudmersiveValidateApiClient::DomainApi* | [**domain_url_full**](docs/DomainApi.md#domain_url_full) | **POST** /validate/domain/url/full | Validate a URL fully
|
89
90
|
*CloudmersiveValidateApiClient::DomainApi* | [**domain_url_syntax_only**](docs/DomainApi.md#domain_url_syntax_only) | **POST** /validate/domain/url/syntax-only | Validate a URL syntactically
|
90
91
|
*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
|
91
92
|
*CloudmersiveValidateApiClient::EmailApi* | [**email_full_validation**](docs/EmailApi.md#email_full_validation) | **POST** /validate/email/address/full | Fully validate an email address
|
@@ -96,6 +97,7 @@ Class | Method | HTTP request | Description
|
|
96
97
|
*CloudmersiveValidateApiClient::NameApi* | [**name_validate_full_name**](docs/NameApi.md#name_validate_full_name) | **POST** /validate/name/full-name | Parse and validate a full name
|
97
98
|
*CloudmersiveValidateApiClient::NameApi* | [**name_validate_last_name**](docs/NameApi.md#name_validate_last_name) | **POST** /validate/name/last | Validate a last name
|
98
99
|
*CloudmersiveValidateApiClient::PhoneNumberApi* | [**phone_number_syntax_only**](docs/PhoneNumberApi.md#phone_number_syntax_only) | **POST** /validate/phonenumber/basic | Validate phone number (basic)
|
100
|
+
*CloudmersiveValidateApiClient::UserAgentApi* | [**user_agent_parse**](docs/UserAgentApi.md#user_agent_parse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots
|
99
101
|
*CloudmersiveValidateApiClient::VatApi* | [**vat_vat_lookup**](docs/VatApi.md#vat_vat_lookup) | **POST** /validate/vat/lookup | Lookup a VAT code
|
100
102
|
|
101
103
|
|
@@ -118,7 +120,11 @@ Class | Method | HTTP request | Description
|
|
118
120
|
- [CloudmersiveValidateApiClient::ParseAddressResponse](docs/ParseAddressResponse.md)
|
119
121
|
- [CloudmersiveValidateApiClient::PhoneNumberValidateRequest](docs/PhoneNumberValidateRequest.md)
|
120
122
|
- [CloudmersiveValidateApiClient::PhoneNumberValidationResponse](docs/PhoneNumberValidationResponse.md)
|
123
|
+
- [CloudmersiveValidateApiClient::UserAgentValidateRequest](docs/UserAgentValidateRequest.md)
|
124
|
+
- [CloudmersiveValidateApiClient::UserAgentValidateResponse](docs/UserAgentValidateResponse.md)
|
125
|
+
- [CloudmersiveValidateApiClient::ValidateUrlRequestFull](docs/ValidateUrlRequestFull.md)
|
121
126
|
- [CloudmersiveValidateApiClient::ValidateUrlRequestSyntaxOnly](docs/ValidateUrlRequestSyntaxOnly.md)
|
127
|
+
- [CloudmersiveValidateApiClient::ValidateUrlResponseFull](docs/ValidateUrlResponseFull.md)
|
122
128
|
- [CloudmersiveValidateApiClient::ValidateUrlResponseSyntaxOnly](docs/ValidateUrlResponseSyntaxOnly.md)
|
123
129
|
- [CloudmersiveValidateApiClient::VatLookupRequest](docs/VatLookupRequest.md)
|
124
130
|
- [CloudmersiveValidateApiClient::VatLookupResponse](docs/VatLookupResponse.md)
|
data/docs/DomainApi.md
CHANGED
@@ -6,6 +6,7 @@ Method | HTTP request | Description
|
|
6
6
|
------------- | ------------- | -------------
|
7
7
|
[**domain_check**](DomainApi.md#domain_check) | **POST** /validate/domain/check | Validate a domain name
|
8
8
|
[**domain_post**](DomainApi.md#domain_post) | **POST** /validate/domain/whois | Get WHOIS information for a domain
|
9
|
+
[**domain_url_full**](DomainApi.md#domain_url_full) | **POST** /validate/domain/url/full | Validate a URL fully
|
9
10
|
[**domain_url_syntax_only**](DomainApi.md#domain_url_syntax_only) | **POST** /validate/domain/url/syntax-only | Validate a URL syntactically
|
10
11
|
|
11
12
|
|
@@ -117,6 +118,60 @@ Name | Type | Description | Notes
|
|
117
118
|
|
118
119
|
|
119
120
|
|
121
|
+
# **domain_url_full**
|
122
|
+
> ValidateUrlResponseFull domain_url_full(request)
|
123
|
+
|
124
|
+
Validate a URL fully
|
125
|
+
|
126
|
+
Validate whether a URL is syntactically valid (does not check endpoint for validity), whether it exists, and whether the endpoint is up and passes virus scan checks. Accepts various types of input and produces a well-formed URL as output.
|
127
|
+
|
128
|
+
### Example
|
129
|
+
```ruby
|
130
|
+
# load the gem
|
131
|
+
require 'cloudmersive-validate-api-client'
|
132
|
+
# setup authorization
|
133
|
+
CloudmersiveValidateApiClient.configure do |config|
|
134
|
+
# Configure API key authorization: Apikey
|
135
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
136
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
137
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
138
|
+
end
|
139
|
+
|
140
|
+
api_instance = CloudmersiveValidateApiClient::DomainApi.new
|
141
|
+
|
142
|
+
request = CloudmersiveValidateApiClient::ValidateUrlRequestFull.new # ValidateUrlRequestFull |
|
143
|
+
|
144
|
+
|
145
|
+
begin
|
146
|
+
#Validate a URL fully
|
147
|
+
result = api_instance.domain_url_full(request)
|
148
|
+
p result
|
149
|
+
rescue CloudmersiveValidateApiClient::ApiError => e
|
150
|
+
puts "Exception when calling DomainApi->domain_url_full: #{e}"
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
154
|
+
### Parameters
|
155
|
+
|
156
|
+
Name | Type | Description | Notes
|
157
|
+
------------- | ------------- | ------------- | -------------
|
158
|
+
**request** | [**ValidateUrlRequestFull**](ValidateUrlRequestFull.md)| |
|
159
|
+
|
160
|
+
### Return type
|
161
|
+
|
162
|
+
[**ValidateUrlResponseFull**](ValidateUrlResponseFull.md)
|
163
|
+
|
164
|
+
### Authorization
|
165
|
+
|
166
|
+
[Apikey](../README.md#Apikey)
|
167
|
+
|
168
|
+
### HTTP request headers
|
169
|
+
|
170
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
171
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
172
|
+
|
173
|
+
|
174
|
+
|
120
175
|
# **domain_url_syntax_only**
|
121
176
|
> ValidateUrlResponseSyntaxOnly domain_url_syntax_only(request)
|
122
177
|
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::UserAgentApi
|
2
|
+
|
3
|
+
All URIs are relative to *https://api.cloudmersive.com*
|
4
|
+
|
5
|
+
Method | HTTP request | Description
|
6
|
+
------------- | ------------- | -------------
|
7
|
+
[**user_agent_parse**](UserAgentApi.md#user_agent_parse) | **POST** /validate/useragent/parse | Parse an HTTP User-Agent string, identify robots
|
8
|
+
|
9
|
+
|
10
|
+
# **user_agent_parse**
|
11
|
+
> UserAgentValidateResponse user_agent_parse(request)
|
12
|
+
|
13
|
+
Parse an HTTP User-Agent string, identify robots
|
14
|
+
|
15
|
+
Uses a parsing system and database to parse the User-Agent into its structured component parts, such as Browser, Browser Version, Browser Engine, Operating System, and importantly, Robot identification.
|
16
|
+
|
17
|
+
### Example
|
18
|
+
```ruby
|
19
|
+
# load the gem
|
20
|
+
require 'cloudmersive-validate-api-client'
|
21
|
+
# setup authorization
|
22
|
+
CloudmersiveValidateApiClient.configure do |config|
|
23
|
+
# Configure API key authorization: Apikey
|
24
|
+
config.api_key['Apikey'] = 'YOUR API KEY'
|
25
|
+
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
|
26
|
+
#config.api_key_prefix['Apikey'] = 'Bearer'
|
27
|
+
end
|
28
|
+
|
29
|
+
api_instance = CloudmersiveValidateApiClient::UserAgentApi.new
|
30
|
+
|
31
|
+
request = CloudmersiveValidateApiClient::UserAgentValidateRequest.new # UserAgentValidateRequest | Input parse request
|
32
|
+
|
33
|
+
|
34
|
+
begin
|
35
|
+
#Parse an HTTP User-Agent string, identify robots
|
36
|
+
result = api_instance.user_agent_parse(request)
|
37
|
+
p result
|
38
|
+
rescue CloudmersiveValidateApiClient::ApiError => e
|
39
|
+
puts "Exception when calling UserAgentApi->user_agent_parse: #{e}"
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
### Parameters
|
44
|
+
|
45
|
+
Name | Type | Description | Notes
|
46
|
+
------------- | ------------- | ------------- | -------------
|
47
|
+
**request** | [**UserAgentValidateRequest**](UserAgentValidateRequest.md)| Input parse request |
|
48
|
+
|
49
|
+
### Return type
|
50
|
+
|
51
|
+
[**UserAgentValidateResponse**](UserAgentValidateResponse.md)
|
52
|
+
|
53
|
+
### Authorization
|
54
|
+
|
55
|
+
[Apikey](../README.md#Apikey)
|
56
|
+
|
57
|
+
### HTTP request headers
|
58
|
+
|
59
|
+
- **Content-Type**: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
|
60
|
+
- **Accept**: application/json, text/json, application/xml, text/xml
|
61
|
+
|
62
|
+
|
63
|
+
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::UserAgentValidateRequest
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**user_agent_string** | **String** | The user agent string you wish to parse and validate | [optional]
|
7
|
+
|
8
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::UserAgentValidateResponse
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**successful** | **BOOLEAN** | True if the operation was successful, false otherwise | [optional]
|
7
|
+
**is_bot** | **BOOLEAN** | True if the request is a known robot, false otherwise | [optional]
|
8
|
+
**bot_name** | **String** | Optional; name of the robot if the request was from a known robot, otherwise null | [optional]
|
9
|
+
**bot_url** | **String** | Optional; if available, the URL to the robot | [optional]
|
10
|
+
**operating_system** | **String** | Operating System of the User-Agent (e.g. Windows) | [optional]
|
11
|
+
**operating_system_cpu_platform** | **String** | The CPU platform of the User-Agent (e.g. x64) | [optional]
|
12
|
+
**operating_system_version** | **String** | The version of the operating system of the User-Agent (e.g. \"10\" for Windows 10) | [optional]
|
13
|
+
**device_type** | **String** | Device type of the User-Agent; possible values are \"DESKTOP\", \"SMARTPHONE\", \"TABLET\" | [optional]
|
14
|
+
**device_brand_name** | **String** | Brand name of the User-Agent | [optional]
|
15
|
+
**device_model** | **String** | Model name or number of the User-Agent | [optional]
|
16
|
+
**browser_name** | **String** | Name of the Browser | [optional]
|
17
|
+
**browser_version** | **String** | Version of the Browser | [optional]
|
18
|
+
**browser_engine_name** | **String** | Name of the Browser Engine | [optional]
|
19
|
+
**browser_engine_version** | **String** | Version of the Browser Engine | [optional]
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# CloudmersiveValidateApiClient::ValidateUrlResponseFull
|
2
|
+
|
3
|
+
## Properties
|
4
|
+
Name | Type | Description | Notes
|
5
|
+
------------ | ------------- | ------------- | -------------
|
6
|
+
**valid_url** | **BOOLEAN** | True if the URL has valid syntax, a valid domain, a valid endpoint, and passes virus scan checks; false otherwise | [optional]
|
7
|
+
**valid_syntax** | **BOOLEAN** | True if the URL has valid syntax, false otherwise | [optional]
|
8
|
+
**valid_domain** | **BOOLEAN** | True if the domain name is valid and exists, false otherwise | [optional]
|
9
|
+
**valid_endpoint** | **BOOLEAN** | True if the endpoint is up and responsive and passes a virus scan check, false otherwise | [optional]
|
10
|
+
**well_formed_url** | **String** | Well-formed version of the URL | [optional]
|
11
|
+
|
12
|
+
|
@@ -34,7 +34,11 @@ require 'cloudmersive-validate-api-client/models/parse_address_request'
|
|
34
34
|
require 'cloudmersive-validate-api-client/models/parse_address_response'
|
35
35
|
require 'cloudmersive-validate-api-client/models/phone_number_validate_request'
|
36
36
|
require 'cloudmersive-validate-api-client/models/phone_number_validation_response'
|
37
|
+
require 'cloudmersive-validate-api-client/models/user_agent_validate_request'
|
38
|
+
require 'cloudmersive-validate-api-client/models/user_agent_validate_response'
|
39
|
+
require 'cloudmersive-validate-api-client/models/validate_url_request_full'
|
37
40
|
require 'cloudmersive-validate-api-client/models/validate_url_request_syntax_only'
|
41
|
+
require 'cloudmersive-validate-api-client/models/validate_url_response_full'
|
38
42
|
require 'cloudmersive-validate-api-client/models/validate_url_response_syntax_only'
|
39
43
|
require 'cloudmersive-validate-api-client/models/vat_lookup_request'
|
40
44
|
require 'cloudmersive-validate-api-client/models/vat_lookup_response'
|
@@ -47,6 +51,7 @@ require 'cloudmersive-validate-api-client/api/email_api'
|
|
47
51
|
require 'cloudmersive-validate-api-client/api/ip_address_api'
|
48
52
|
require 'cloudmersive-validate-api-client/api/name_api'
|
49
53
|
require 'cloudmersive-validate-api-client/api/phone_number_api'
|
54
|
+
require 'cloudmersive-validate-api-client/api/user_agent_api'
|
50
55
|
require 'cloudmersive-validate-api-client/api/vat_api'
|
51
56
|
|
52
57
|
module CloudmersiveValidateApiClient
|
@@ -130,6 +130,61 @@ module CloudmersiveValidateApiClient
|
|
130
130
|
return data, status_code, headers
|
131
131
|
end
|
132
132
|
|
133
|
+
# Validate a URL fully
|
134
|
+
# Validate whether a URL is syntactically valid (does not check endpoint for validity), whether it exists, and whether the endpoint is up and passes virus scan checks. Accepts various types of input and produces a well-formed URL as output.
|
135
|
+
# @param request
|
136
|
+
# @param [Hash] opts the optional parameters
|
137
|
+
# @return [ValidateUrlResponseFull]
|
138
|
+
def domain_url_full(request, opts = {})
|
139
|
+
data, _status_code, _headers = domain_url_full_with_http_info(request, opts)
|
140
|
+
return data
|
141
|
+
end
|
142
|
+
|
143
|
+
# Validate a URL fully
|
144
|
+
# Validate whether a URL is syntactically valid (does not check endpoint for validity), whether it exists, and whether the endpoint is up and passes virus scan checks. Accepts various types of input and produces a well-formed URL as output.
|
145
|
+
# @param request
|
146
|
+
# @param [Hash] opts the optional parameters
|
147
|
+
# @return [Array<(ValidateUrlResponseFull, Fixnum, Hash)>] ValidateUrlResponseFull data, response status code and response headers
|
148
|
+
def domain_url_full_with_http_info(request, opts = {})
|
149
|
+
if @api_client.config.debugging
|
150
|
+
@api_client.config.logger.debug "Calling API: DomainApi.domain_url_full ..."
|
151
|
+
end
|
152
|
+
# verify the required parameter 'request' is set
|
153
|
+
if @api_client.config.client_side_validation && request.nil?
|
154
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_url_full"
|
155
|
+
end
|
156
|
+
# resource path
|
157
|
+
local_var_path = "/validate/domain/url/full"
|
158
|
+
|
159
|
+
# query parameters
|
160
|
+
query_params = {}
|
161
|
+
|
162
|
+
# header parameters
|
163
|
+
header_params = {}
|
164
|
+
# HTTP header 'Accept' (if needed)
|
165
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
166
|
+
# HTTP header 'Content-Type'
|
167
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
168
|
+
|
169
|
+
# form parameters
|
170
|
+
form_params = {}
|
171
|
+
|
172
|
+
# http body (model)
|
173
|
+
post_body = @api_client.object_to_http_body(request)
|
174
|
+
auth_names = ['Apikey']
|
175
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
176
|
+
:header_params => header_params,
|
177
|
+
:query_params => query_params,
|
178
|
+
:form_params => form_params,
|
179
|
+
:body => post_body,
|
180
|
+
:auth_names => auth_names,
|
181
|
+
:return_type => 'ValidateUrlResponseFull')
|
182
|
+
if @api_client.config.debugging
|
183
|
+
@api_client.config.logger.debug "API called: DomainApi#domain_url_full\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
184
|
+
end
|
185
|
+
return data, status_code, headers
|
186
|
+
end
|
187
|
+
|
133
188
|
# Validate a URL syntactically
|
134
189
|
# Validate whether a URL is syntactically valid (does not check endpoint for validity). Accepts various types of input and produces a well-formed URL as output.
|
135
190
|
# @param request
|
@@ -0,0 +1,78 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require "uri"
|
14
|
+
|
15
|
+
module CloudmersiveValidateApiClient
|
16
|
+
class UserAgentApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
# Parse an HTTP User-Agent string, identify robots
|
24
|
+
# Uses a parsing system and database to parse the User-Agent into its structured component parts, such as Browser, Browser Version, Browser Engine, Operating System, and importantly, Robot identification.
|
25
|
+
# @param request Input parse request
|
26
|
+
# @param [Hash] opts the optional parameters
|
27
|
+
# @return [UserAgentValidateResponse]
|
28
|
+
def user_agent_parse(request, opts = {})
|
29
|
+
data, _status_code, _headers = user_agent_parse_with_http_info(request, opts)
|
30
|
+
return data
|
31
|
+
end
|
32
|
+
|
33
|
+
# Parse an HTTP User-Agent string, identify robots
|
34
|
+
# Uses a parsing system and database to parse the User-Agent into its structured component parts, such as Browser, Browser Version, Browser Engine, Operating System, and importantly, Robot identification.
|
35
|
+
# @param request Input parse request
|
36
|
+
# @param [Hash] opts the optional parameters
|
37
|
+
# @return [Array<(UserAgentValidateResponse, Fixnum, Hash)>] UserAgentValidateResponse data, response status code and response headers
|
38
|
+
def user_agent_parse_with_http_info(request, opts = {})
|
39
|
+
if @api_client.config.debugging
|
40
|
+
@api_client.config.logger.debug "Calling API: UserAgentApi.user_agent_parse ..."
|
41
|
+
end
|
42
|
+
# verify the required parameter 'request' is set
|
43
|
+
if @api_client.config.client_side_validation && request.nil?
|
44
|
+
fail ArgumentError, "Missing the required parameter 'request' when calling UserAgentApi.user_agent_parse"
|
45
|
+
end
|
46
|
+
# resource path
|
47
|
+
local_var_path = "/validate/useragent/parse"
|
48
|
+
|
49
|
+
# query parameters
|
50
|
+
query_params = {}
|
51
|
+
|
52
|
+
# header parameters
|
53
|
+
header_params = {}
|
54
|
+
# HTTP header 'Accept' (if needed)
|
55
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
56
|
+
# HTTP header 'Content-Type'
|
57
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json', 'application/xml', 'text/xml', 'application/x-www-form-urlencoded'])
|
58
|
+
|
59
|
+
# form parameters
|
60
|
+
form_params = {}
|
61
|
+
|
62
|
+
# http body (model)
|
63
|
+
post_body = @api_client.object_to_http_body(request)
|
64
|
+
auth_names = ['Apikey']
|
65
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
66
|
+
:header_params => header_params,
|
67
|
+
:query_params => query_params,
|
68
|
+
:form_params => form_params,
|
69
|
+
:body => post_body,
|
70
|
+
:auth_names => auth_names,
|
71
|
+
:return_type => 'UserAgentValidateResponse')
|
72
|
+
if @api_client.config.debugging
|
73
|
+
@api_client.config.logger.debug "API called: UserAgentApi#user_agent_parse\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
74
|
+
end
|
75
|
+
return data, status_code, headers
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,189 @@
|
|
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: unset
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveValidateApiClient
|
16
|
+
# User-Agent parse and validation request
|
17
|
+
class UserAgentValidateRequest
|
18
|
+
# The user agent string you wish to parse and validate
|
19
|
+
attr_accessor :user_agent_string
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'user_agent_string' => :'UserAgentString'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.swagger_types
|
31
|
+
{
|
32
|
+
:'user_agent_string' => :'String'
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
# Initializes the object
|
37
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
38
|
+
def initialize(attributes = {})
|
39
|
+
return unless attributes.is_a?(Hash)
|
40
|
+
|
41
|
+
# convert string to symbol for hash key
|
42
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
43
|
+
|
44
|
+
if attributes.has_key?(:'UserAgentString')
|
45
|
+
self.user_agent_string = attributes[:'UserAgentString']
|
46
|
+
end
|
47
|
+
|
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
|
+
return 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
|
+
return 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
|
+
user_agent_string == o.user_agent_string
|
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
|
+
[user_agent_string].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 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
|
+
|
189
|
+
end
|