cloudmersive-validate-api-client 2.1.0 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -4
- data/docs/AddressApi.md +55 -0
- data/docs/BotCheckResponse.md +8 -0
- data/docs/DateTimeApi.md +222 -0
- data/docs/DateTimeNaturalLanguageParseRequest.md +8 -0
- data/docs/DateTimeNowResult.md +10 -0
- data/docs/DateTimeStandardizedParseRequest.md +9 -0
- data/docs/DateTimeStandardizedParseResponse.md +16 -0
- data/docs/DomainApi.md +3 -3
- data/docs/EmailApi.md +3 -3
- data/docs/GeolocateStreetAddressResponse.md +13 -0
- data/docs/GetPublicHolidaysRequest.md +9 -0
- data/docs/IPAddressApi.md +223 -3
- data/docs/IPIntelligenceResponse.md +16 -0
- data/docs/IPReverseDNSLookupResponse.md +9 -0
- data/docs/NormalizeAddressResponse.md +18 -0
- data/docs/PublicHolidayOccurrence.md +12 -0
- data/docs/PublicHolidaysResponse.md +9 -0
- data/docs/TextInputApi.md +173 -0
- data/docs/XssProtectionBatchRequest.md +8 -0
- data/docs/XssProtectionBatchResponse.md +8 -0
- data/docs/XssProtectionRequestItem.md +8 -0
- data/docs/XssProtectionResult.md +11 -0
- data/lib/cloudmersive-validate-api-client.rb +18 -0
- data/lib/cloudmersive-validate-api-client/api/address_api.rb +54 -0
- data/lib/cloudmersive-validate-api-client/api/date_time_api.rb +231 -0
- data/lib/cloudmersive-validate-api-client/api/domain_api.rb +3 -3
- data/lib/cloudmersive-validate-api-client/api/email_api.rb +3 -3
- data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +219 -3
- data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +185 -0
- data/lib/cloudmersive-validate-api-client/models/bot_check_response.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_natural_language_parse_request.rb +186 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_now_result.rb +206 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/date_time_standardized_parse_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +1 -1
- data/lib/cloudmersive-validate-api-client/models/geolocate_street_address_response.rb +236 -0
- data/lib/cloudmersive-validate-api-client/models/get_public_holidays_request.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/ip_intelligence_response.rb +266 -0
- data/lib/cloudmersive-validate-api-client/models/ip_reverse_dns_lookup_response.rb +196 -0
- data/lib/cloudmersive-validate-api-client/models/normalize_address_response.rb +286 -0
- data/lib/cloudmersive-validate-api-client/models/public_holiday_occurrence.rb +226 -0
- data/lib/cloudmersive-validate-api-client/models/public_holidays_response.rb +198 -0
- data/lib/cloudmersive-validate-api-client/models/xss_protection_batch_request.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/xss_protection_batch_response.rb +188 -0
- data/lib/cloudmersive-validate-api-client/models/xss_protection_request_item.rb +186 -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/address_api_spec.rb +12 -0
- data/spec/api/date_time_api_spec.rb +82 -0
- data/spec/api/ip_address_api_spec.rb +48 -0
- data/spec/api/text_input_api_spec.rb +71 -0
- data/spec/models/bot_check_response_spec.rb +41 -0
- data/spec/models/date_time_natural_language_parse_request_spec.rb +41 -0
- data/spec/models/date_time_now_result_spec.rb +53 -0
- data/spec/models/date_time_standardized_parse_request_spec.rb +47 -0
- data/spec/models/date_time_standardized_parse_response_spec.rb +89 -0
- data/spec/models/geolocate_street_address_response_spec.rb +71 -0
- data/spec/models/get_public_holidays_request_spec.rb +47 -0
- data/spec/models/ip_intelligence_response_spec.rb +89 -0
- data/spec/models/ip_reverse_dns_lookup_response_spec.rb +47 -0
- data/spec/models/normalize_address_response_spec.rb +101 -0
- data/spec/models/public_holiday_occurrence_spec.rb +65 -0
- data/spec/models/public_holidays_response_spec.rb +47 -0
- data/spec/models/xss_protection_batch_request_spec.rb +41 -0
- data/spec/models/xss_protection_batch_response_spec.rb +41 -0
- data/spec/models/xss_protection_request_item_spec.rb +41 -0
- data/spec/models/xss_protection_result_spec.rb +59 -0
- metadata +56 -2
@@ -19,6 +19,168 @@ 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(['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
|
76
|
+
# Get intelligence on an IP address
|
77
|
+
# Identify key intelligence about an IP address, including if it is a known threat IP, known bot, Tor exit node, as well as the location of the IP address.
|
78
|
+
# @param value IP address to process, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [IPIntelligenceResponse]
|
81
|
+
def i_p_address_ip_intelligence(value, opts = {})
|
82
|
+
data, _status_code, _headers = i_p_address_ip_intelligence_with_http_info(value, opts)
|
83
|
+
data
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get intelligence on an IP address
|
87
|
+
# Identify key intelligence about an IP address, including if it is a known threat IP, known bot, Tor exit node, as well as the location of the IP address.
|
88
|
+
# @param value IP address to process, e.g. \"55.55.55.55\". The input is a string so be sure to enclose it in double-quotes.
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(IPIntelligenceResponse, Fixnum, Hash)>] IPIntelligenceResponse data, response status code and response headers
|
91
|
+
def i_p_address_ip_intelligence_with_http_info(value, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: IPAddressApi.i_p_address_ip_intelligence ...'
|
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 IPAddressApi.i_p_address_ip_intelligence"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/validate/ip/intelligence'
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = {}
|
104
|
+
|
105
|
+
# header parameters
|
106
|
+
header_params = {}
|
107
|
+
# HTTP header 'Accept' (if needed)
|
108
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
109
|
+
# HTTP header 'Content-Type'
|
110
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
111
|
+
|
112
|
+
# form parameters
|
113
|
+
form_params = {}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
post_body = @api_client.object_to_http_body(value)
|
117
|
+
auth_names = ['Apikey']
|
118
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
119
|
+
:header_params => header_params,
|
120
|
+
:query_params => query_params,
|
121
|
+
:form_params => form_params,
|
122
|
+
:body => post_body,
|
123
|
+
:auth_names => auth_names,
|
124
|
+
:return_type => 'IPIntelligenceResponse')
|
125
|
+
if @api_client.config.debugging
|
126
|
+
@api_client.config.logger.debug "API called: IPAddressApi#i_p_address_ip_intelligence\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
127
|
+
end
|
128
|
+
return data, status_code, headers
|
129
|
+
end
|
130
|
+
# Check if IP address is a Bot client
|
131
|
+
# Check if the input IP address is a Bot, robot, or otherwise a non-user entity. Leverages real-time signals to check against known high-probability bots..
|
132
|
+
# @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.
|
133
|
+
# @param [Hash] opts the optional parameters
|
134
|
+
# @return [BotCheckResponse]
|
135
|
+
def i_p_address_is_bot(value, opts = {})
|
136
|
+
data, _status_code, _headers = i_p_address_is_bot_with_http_info(value, opts)
|
137
|
+
data
|
138
|
+
end
|
139
|
+
|
140
|
+
# Check if IP address is a Bot client
|
141
|
+
# Check if the input IP address is a Bot, robot, or otherwise a non-user entity. Leverages real-time signals to check against known high-probability bots..
|
142
|
+
# @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.
|
143
|
+
# @param [Hash] opts the optional parameters
|
144
|
+
# @return [Array<(BotCheckResponse, Fixnum, Hash)>] BotCheckResponse data, response status code and response headers
|
145
|
+
def i_p_address_is_bot_with_http_info(value, opts = {})
|
146
|
+
if @api_client.config.debugging
|
147
|
+
@api_client.config.logger.debug 'Calling API: IPAddressApi.i_p_address_is_bot ...'
|
148
|
+
end
|
149
|
+
# verify the required parameter 'value' is set
|
150
|
+
if @api_client.config.client_side_validation && value.nil?
|
151
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling IPAddressApi.i_p_address_is_bot"
|
152
|
+
end
|
153
|
+
# resource path
|
154
|
+
local_var_path = '/validate/ip/is-bot'
|
155
|
+
|
156
|
+
# query parameters
|
157
|
+
query_params = {}
|
158
|
+
|
159
|
+
# header parameters
|
160
|
+
header_params = {}
|
161
|
+
# HTTP header 'Accept' (if needed)
|
162
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
163
|
+
# HTTP header 'Content-Type'
|
164
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
165
|
+
|
166
|
+
# form parameters
|
167
|
+
form_params = {}
|
168
|
+
|
169
|
+
# http body (model)
|
170
|
+
post_body = @api_client.object_to_http_body(value)
|
171
|
+
auth_names = ['Apikey']
|
172
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => 'BotCheckResponse')
|
179
|
+
if @api_client.config.debugging
|
180
|
+
@api_client.config.logger.debug "API called: IPAddressApi#i_p_address_is_bot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
181
|
+
end
|
182
|
+
return data, status_code, headers
|
183
|
+
end
|
22
184
|
# Check if IP address is a known threat
|
23
185
|
# 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
186
|
# @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.
|
@@ -53,7 +215,7 @@ module CloudmersiveValidateApiClient
|
|
53
215
|
# HTTP header 'Accept' (if needed)
|
54
216
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
55
217
|
# HTTP header 'Content-Type'
|
56
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['
|
218
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
57
219
|
|
58
220
|
# form parameters
|
59
221
|
form_params = {}
|
@@ -107,7 +269,7 @@ module CloudmersiveValidateApiClient
|
|
107
269
|
# HTTP header 'Accept' (if needed)
|
108
270
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
109
271
|
# HTTP header 'Content-Type'
|
110
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['
|
272
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
111
273
|
|
112
274
|
# form parameters
|
113
275
|
form_params = {}
|
@@ -161,7 +323,7 @@ module CloudmersiveValidateApiClient
|
|
161
323
|
# HTTP header 'Accept' (if needed)
|
162
324
|
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
163
325
|
# HTTP header 'Content-Type'
|
164
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['
|
326
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
165
327
|
|
166
328
|
# form parameters
|
167
329
|
form_params = {}
|
@@ -181,5 +343,59 @@ module CloudmersiveValidateApiClient
|
|
181
343
|
end
|
182
344
|
return data, status_code, headers
|
183
345
|
end
|
346
|
+
# Perform a reverse domain name (DNS) lookup on an IP address
|
347
|
+
# Gets the domain name, if any, associated with the IP address.
|
348
|
+
# @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.
|
349
|
+
# @param [Hash] opts the optional parameters
|
350
|
+
# @return [IPReverseDNSLookupResponse]
|
351
|
+
def i_p_address_reverse_domain_lookup(value, opts = {})
|
352
|
+
data, _status_code, _headers = i_p_address_reverse_domain_lookup_with_http_info(value, opts)
|
353
|
+
data
|
354
|
+
end
|
355
|
+
|
356
|
+
# Perform a reverse domain name (DNS) lookup on an IP address
|
357
|
+
# Gets the domain name, if any, associated with the IP address.
|
358
|
+
# @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.
|
359
|
+
# @param [Hash] opts the optional parameters
|
360
|
+
# @return [Array<(IPReverseDNSLookupResponse, Fixnum, Hash)>] IPReverseDNSLookupResponse data, response status code and response headers
|
361
|
+
def i_p_address_reverse_domain_lookup_with_http_info(value, opts = {})
|
362
|
+
if @api_client.config.debugging
|
363
|
+
@api_client.config.logger.debug 'Calling API: IPAddressApi.i_p_address_reverse_domain_lookup ...'
|
364
|
+
end
|
365
|
+
# verify the required parameter 'value' is set
|
366
|
+
if @api_client.config.client_side_validation && value.nil?
|
367
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling IPAddressApi.i_p_address_reverse_domain_lookup"
|
368
|
+
end
|
369
|
+
# resource path
|
370
|
+
local_var_path = '/validate/ip/reverse-domain-lookup'
|
371
|
+
|
372
|
+
# query parameters
|
373
|
+
query_params = {}
|
374
|
+
|
375
|
+
# header parameters
|
376
|
+
header_params = {}
|
377
|
+
# HTTP header 'Accept' (if needed)
|
378
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
379
|
+
# HTTP header 'Content-Type'
|
380
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
381
|
+
|
382
|
+
# form parameters
|
383
|
+
form_params = {}
|
384
|
+
|
385
|
+
# http body (model)
|
386
|
+
post_body = @api_client.object_to_http_body(value)
|
387
|
+
auth_names = ['Apikey']
|
388
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
389
|
+
:header_params => header_params,
|
390
|
+
:query_params => query_params,
|
391
|
+
:form_params => form_params,
|
392
|
+
:body => post_body,
|
393
|
+
:auth_names => auth_names,
|
394
|
+
:return_type => 'IPReverseDNSLookupResponse')
|
395
|
+
if @api_client.config.debugging
|
396
|
+
@api_client.config.logger.debug "API called: IPAddressApi#i_p_address_reverse_domain_lookup\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
397
|
+
end
|
398
|
+
return data, status_code, headers
|
399
|
+
end
|
184
400
|
end
|
185
401
|
end
|
@@ -0,0 +1,185 @@
|
|
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(['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
|
+
# Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
|
77
|
+
# Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
|
78
|
+
# @param value User-facing text input.
|
79
|
+
# @param [Hash] opts the optional parameters
|
80
|
+
# @return [XssProtectionBatchResponse]
|
81
|
+
def text_input_check_xss_batch(value, opts = {})
|
82
|
+
data, _status_code, _headers = text_input_check_xss_batch_with_http_info(value, opts)
|
83
|
+
data
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
|
87
|
+
# Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
|
88
|
+
# @param value User-facing text input.
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [Array<(XssProtectionBatchResponse, Fixnum, Hash)>] XssProtectionBatchResponse data, response status code and response headers
|
91
|
+
def text_input_check_xss_batch_with_http_info(value, opts = {})
|
92
|
+
if @api_client.config.debugging
|
93
|
+
@api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xss_batch ...'
|
94
|
+
end
|
95
|
+
# verify the required parameter 'value' is set
|
96
|
+
if @api_client.config.client_side_validation && value.nil?
|
97
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_xss_batch"
|
98
|
+
end
|
99
|
+
# resource path
|
100
|
+
local_var_path = '/validate/text-input/check-and-protect/xss/batch'
|
101
|
+
|
102
|
+
# query parameters
|
103
|
+
query_params = {}
|
104
|
+
|
105
|
+
# header parameters
|
106
|
+
header_params = {}
|
107
|
+
# HTTP header 'Accept' (if needed)
|
108
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
109
|
+
# HTTP header 'Content-Type'
|
110
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
111
|
+
|
112
|
+
# form parameters
|
113
|
+
form_params = {}
|
114
|
+
|
115
|
+
# http body (model)
|
116
|
+
post_body = @api_client.object_to_http_body(value)
|
117
|
+
auth_names = ['Apikey']
|
118
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
119
|
+
:header_params => header_params,
|
120
|
+
:query_params => query_params,
|
121
|
+
:form_params => form_params,
|
122
|
+
:body => post_body,
|
123
|
+
:auth_names => auth_names,
|
124
|
+
:return_type => 'XssProtectionBatchResponse')
|
125
|
+
if @api_client.config.debugging
|
126
|
+
@api_client.config.logger.debug "API called: TextInputApi#text_input_check_xss_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
127
|
+
end
|
128
|
+
return data, status_code, headers
|
129
|
+
end
|
130
|
+
# Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
131
|
+
# Detects and removes XSS (Cross-Site-Scripting) attacks from text input through normalization. Returns the normalized result, as well as information on whether the original input contained an XSS risk.
|
132
|
+
# @param value User-facing text input.
|
133
|
+
# @param [Hash] opts the optional parameters
|
134
|
+
# @return [XssProtectionResult]
|
135
|
+
def text_input_protect_xss(value, opts = {})
|
136
|
+
data, _status_code, _headers = text_input_protect_xss_with_http_info(value, opts)
|
137
|
+
data
|
138
|
+
end
|
139
|
+
|
140
|
+
# Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
|
141
|
+
# 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.
|
142
|
+
# @param value User-facing text input.
|
143
|
+
# @param [Hash] opts the optional parameters
|
144
|
+
# @return [Array<(XssProtectionResult, Fixnum, Hash)>] XssProtectionResult data, response status code and response headers
|
145
|
+
def text_input_protect_xss_with_http_info(value, opts = {})
|
146
|
+
if @api_client.config.debugging
|
147
|
+
@api_client.config.logger.debug 'Calling API: TextInputApi.text_input_protect_xss ...'
|
148
|
+
end
|
149
|
+
# verify the required parameter 'value' is set
|
150
|
+
if @api_client.config.client_side_validation && value.nil?
|
151
|
+
fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_protect_xss"
|
152
|
+
end
|
153
|
+
# resource path
|
154
|
+
local_var_path = '/validate/text-input/protect/xss'
|
155
|
+
|
156
|
+
# query parameters
|
157
|
+
query_params = {}
|
158
|
+
|
159
|
+
# header parameters
|
160
|
+
header_params = {}
|
161
|
+
# HTTP header 'Accept' (if needed)
|
162
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
|
163
|
+
# HTTP header 'Content-Type'
|
164
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
|
165
|
+
|
166
|
+
# form parameters
|
167
|
+
form_params = {}
|
168
|
+
|
169
|
+
# http body (model)
|
170
|
+
post_body = @api_client.object_to_http_body(value)
|
171
|
+
auth_names = ['Apikey']
|
172
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
173
|
+
:header_params => header_params,
|
174
|
+
:query_params => query_params,
|
175
|
+
:form_params => form_params,
|
176
|
+
:body => post_body,
|
177
|
+
:auth_names => auth_names,
|
178
|
+
:return_type => 'XssProtectionResult')
|
179
|
+
if @api_client.config.debugging
|
180
|
+
@api_client.config.logger.debug "API called: TextInputApi#text_input_protect_xss\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
181
|
+
end
|
182
|
+
return data, status_code, headers
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,186 @@
|
|
1
|
+
=begin
|
2
|
+
#validateapi
|
3
|
+
|
4
|
+
#The validation APIs help you validate data. Check if an E-mail address is real. Check if a domain is real. Check up on an IP address, and even where it is located. All this and much more is available in the validation API.
|
5
|
+
|
6
|
+
OpenAPI spec version: v1
|
7
|
+
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.14
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module CloudmersiveValidateApiClient
|
16
|
+
# Result of performing a Bot check on an IP address
|
17
|
+
class BotCheckResponse
|
18
|
+
# True if the input IP address is a Bot or Robot, false otherwise
|
19
|
+
attr_accessor :is_bot
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'is_bot' => :'IsBot'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'is_bot' => :'BOOLEAN'
|
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?(:'IsBot')
|
44
|
+
self.is_bot = attributes[:'IsBot']
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
49
|
+
# @return Array for valid properties with the reasons
|
50
|
+
def list_invalid_properties
|
51
|
+
invalid_properties = Array.new
|
52
|
+
invalid_properties
|
53
|
+
end
|
54
|
+
|
55
|
+
# Check to see if the all the properties in the model are valid
|
56
|
+
# @return true if the model is valid
|
57
|
+
def valid?
|
58
|
+
true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks equality by comparing each attribute.
|
62
|
+
# @param [Object] Object to be compared
|
63
|
+
def ==(o)
|
64
|
+
return true if self.equal?(o)
|
65
|
+
self.class == o.class &&
|
66
|
+
is_bot == o.is_bot
|
67
|
+
end
|
68
|
+
|
69
|
+
# @see the `==` method
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def eql?(o)
|
72
|
+
self == o
|
73
|
+
end
|
74
|
+
|
75
|
+
# Calculates hash code according to all attributes.
|
76
|
+
# @return [Fixnum] Hash code
|
77
|
+
def hash
|
78
|
+
[is_bot].hash
|
79
|
+
end
|
80
|
+
|
81
|
+
# Builds the object from hash
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
83
|
+
# @return [Object] Returns the model itself
|
84
|
+
def build_from_hash(attributes)
|
85
|
+
return nil unless attributes.is_a?(Hash)
|
86
|
+
self.class.swagger_types.each_pair do |key, type|
|
87
|
+
if type =~ /\AArray<(.*)>/i
|
88
|
+
# check to ensure the input is an array given that the attribute
|
89
|
+
# is documented as an array but the input is not
|
90
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
91
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
92
|
+
end
|
93
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
94
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
95
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
96
|
+
end
|
97
|
+
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
101
|
+
# Deserializes the data based on type
|
102
|
+
# @param string type Data type
|
103
|
+
# @param string value Value to be deserialized
|
104
|
+
# @return [Object] Deserialized data
|
105
|
+
def _deserialize(type, value)
|
106
|
+
case type.to_sym
|
107
|
+
when :DateTime
|
108
|
+
DateTime.parse(value)
|
109
|
+
when :Date
|
110
|
+
Date.parse(value)
|
111
|
+
when :String
|
112
|
+
value.to_s
|
113
|
+
when :Integer
|
114
|
+
value.to_i
|
115
|
+
when :Float
|
116
|
+
value.to_f
|
117
|
+
when :BOOLEAN
|
118
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
119
|
+
true
|
120
|
+
else
|
121
|
+
false
|
122
|
+
end
|
123
|
+
when :Object
|
124
|
+
# generic object (usually a Hash), return directly
|
125
|
+
value
|
126
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
127
|
+
inner_type = Regexp.last_match[:inner_type]
|
128
|
+
value.map { |v| _deserialize(inner_type, v) }
|
129
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
130
|
+
k_type = Regexp.last_match[:k_type]
|
131
|
+
v_type = Regexp.last_match[:v_type]
|
132
|
+
{}.tap do |hash|
|
133
|
+
value.each do |k, v|
|
134
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
else # model
|
138
|
+
temp_model = CloudmersiveValidateApiClient.const_get(type).new
|
139
|
+
temp_model.build_from_hash(value)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Returns the string representation of the object
|
144
|
+
# @return [String] String presentation of the object
|
145
|
+
def to_s
|
146
|
+
to_hash.to_s
|
147
|
+
end
|
148
|
+
|
149
|
+
# to_body is an alias to to_hash (backward compatibility)
|
150
|
+
# @return [Hash] Returns the object in the form of hash
|
151
|
+
def to_body
|
152
|
+
to_hash
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the object in the form of hash
|
156
|
+
# @return [Hash] Returns the object in the form of hash
|
157
|
+
def to_hash
|
158
|
+
hash = {}
|
159
|
+
self.class.attribute_map.each_pair do |attr, param|
|
160
|
+
value = self.send(attr)
|
161
|
+
next if value.nil?
|
162
|
+
hash[param] = _to_hash(value)
|
163
|
+
end
|
164
|
+
hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Outputs non-array value in the form of hash
|
168
|
+
# For object, use to_hash. Otherwise, just return the value
|
169
|
+
# @param [Object] value Any valid value
|
170
|
+
# @return [Hash] Returns the value in the form of hash
|
171
|
+
def _to_hash(value)
|
172
|
+
if value.is_a?(Array)
|
173
|
+
value.compact.map { |v| _to_hash(v) }
|
174
|
+
elsif value.is_a?(Hash)
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
177
|
+
end
|
178
|
+
elsif value.respond_to? :to_hash
|
179
|
+
value.to_hash
|
180
|
+
else
|
181
|
+
value
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
end
|
186
|
+
end
|