cloudmersive-validate-api-client 2.1.4 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -4
  3. data/docs/BotCheckResponse.md +8 -0
  4. data/docs/DomainApi.md +275 -0
  5. data/docs/IPAddressApi.md +110 -0
  6. data/docs/IPIntelligenceResponse.md +16 -0
  7. data/docs/PhishingCheckRequest.md +8 -0
  8. data/docs/PhishingCheckResponse.md +9 -0
  9. data/docs/SqlInjectionCheckBatchRequest.md +9 -0
  10. data/docs/SqlInjectionCheckBatchResponse.md +8 -0
  11. data/docs/SqlInjectionCheckRequestItem.md +8 -0
  12. data/docs/SqlInjectionDetectionResult.md +10 -0
  13. data/docs/TextInputApi.md +233 -1
  14. data/docs/UrlSafetyCheckRequestFull.md +8 -0
  15. data/docs/UrlSafetyCheckResponseFull.md +9 -0
  16. data/docs/UrlSsrfRequestBatch.md +8 -0
  17. data/docs/UrlSsrfRequestFull.md +9 -0
  18. data/docs/UrlSsrfResponseBatch.md +8 -0
  19. data/docs/UrlSsrfResponseFull.md +9 -0
  20. data/docs/ValidateUrlResponseSyntaxOnly.md +1 -0
  21. data/docs/XxeDetectionBatchRequest.md +8 -0
  22. data/docs/XxeDetectionBatchResponse.md +8 -0
  23. data/docs/XxeDetectionRequestItem.md +11 -0
  24. data/docs/XxeDetectionResult.md +9 -0
  25. data/lib/cloudmersive-validate-api-client.rb +18 -0
  26. data/lib/cloudmersive-validate-api-client/api/domain_api.rb +270 -0
  27. data/lib/cloudmersive-validate-api-client/api/ip_address_api.rb +108 -0
  28. data/lib/cloudmersive-validate-api-client/api/text_input_api.rb +230 -2
  29. data/lib/cloudmersive-validate-api-client/models/bot_check_response.rb +186 -0
  30. data/lib/cloudmersive-validate-api-client/models/geolocate_response.rb +1 -1
  31. data/lib/cloudmersive-validate-api-client/models/ip_intelligence_response.rb +266 -0
  32. data/lib/cloudmersive-validate-api-client/models/phishing_check_request.rb +186 -0
  33. data/lib/cloudmersive-validate-api-client/models/phishing_check_response.rb +196 -0
  34. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_request.rb +198 -0
  35. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_batch_response.rb +188 -0
  36. data/lib/cloudmersive-validate-api-client/models/sql_injection_check_request_item.rb +186 -0
  37. data/lib/cloudmersive-validate-api-client/models/sql_injection_detection_result.rb +206 -0
  38. data/lib/cloudmersive-validate-api-client/models/url_safety_check_request_full.rb +186 -0
  39. data/lib/cloudmersive-validate-api-client/models/url_safety_check_response_full.rb +196 -0
  40. data/lib/cloudmersive-validate-api-client/models/url_ssrf_request_batch.rb +188 -0
  41. data/lib/cloudmersive-validate-api-client/models/url_ssrf_request_full.rb +198 -0
  42. data/lib/cloudmersive-validate-api-client/models/url_ssrf_response_batch.rb +188 -0
  43. data/lib/cloudmersive-validate-api-client/models/url_ssrf_response_full.rb +196 -0
  44. data/lib/cloudmersive-validate-api-client/models/validate_url_response_syntax_only.rb +14 -4
  45. data/lib/cloudmersive-validate-api-client/models/xxe_detection_batch_request.rb +188 -0
  46. data/lib/cloudmersive-validate-api-client/models/xxe_detection_batch_response.rb +188 -0
  47. data/lib/cloudmersive-validate-api-client/models/xxe_detection_request_item.rb +220 -0
  48. data/lib/cloudmersive-validate-api-client/models/xxe_detection_result.rb +196 -0
  49. data/lib/cloudmersive-validate-api-client/version.rb +1 -1
  50. data/spec/api/domain_api_spec.rb +60 -0
  51. data/spec/api/ip_address_api_spec.rb +24 -0
  52. data/spec/api/text_input_api_spec.rb +53 -1
  53. data/spec/models/bot_check_response_spec.rb +41 -0
  54. data/spec/models/ip_intelligence_response_spec.rb +89 -0
  55. data/spec/models/phishing_check_request_spec.rb +41 -0
  56. data/spec/models/phishing_check_response_spec.rb +47 -0
  57. data/spec/models/sql_injection_check_batch_request_spec.rb +47 -0
  58. data/spec/models/sql_injection_check_batch_response_spec.rb +41 -0
  59. data/spec/models/sql_injection_check_request_item_spec.rb +41 -0
  60. data/spec/models/sql_injection_detection_result_spec.rb +53 -0
  61. data/spec/models/url_safety_check_request_full_spec.rb +41 -0
  62. data/spec/models/url_safety_check_response_full_spec.rb +47 -0
  63. data/spec/models/url_ssrf_request_batch_spec.rb +41 -0
  64. data/spec/models/url_ssrf_request_full_spec.rb +47 -0
  65. data/spec/models/url_ssrf_response_batch_spec.rb +41 -0
  66. data/spec/models/url_ssrf_response_full_spec.rb +47 -0
  67. data/spec/models/validate_url_response_syntax_only_spec.rb +6 -0
  68. data/spec/models/xxe_detection_batch_request_spec.rb +41 -0
  69. data/spec/models/xxe_detection_batch_response_spec.rb +41 -0
  70. data/spec/models/xxe_detection_request_item_spec.rb +59 -0
  71. data/spec/models/xxe_detection_result_spec.rb +47 -0
  72. metadata +56 -2
@@ -19,6 +19,117 @@ module CloudmersiveValidateApiClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Check text input for SQL Injection (SQLI) attacks
23
+ # Detects SQL Injection (SQLI) attacks from text input.
24
+ # @param value User-facing text input.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
27
+ # @return [SqlInjectionDetectionResult]
28
+ def text_input_check_sql_injection(value, opts = {})
29
+ data, _status_code, _headers = text_input_check_sql_injection_with_http_info(value, opts)
30
+ data
31
+ end
32
+
33
+ # Check text input for SQL Injection (SQLI) attacks
34
+ # Detects SQL Injection (SQLI) attacks from text input.
35
+ # @param value User-facing text input.
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :detection_level Set to Normal to target a high-security SQL Injection detection level with a very low false positive rate; select High to target a very-high security SQL Injection detection level with higher false positives. Default is Normal (recommended).
38
+ # @return [Array<(SqlInjectionDetectionResult, Fixnum, Hash)>] SqlInjectionDetectionResult data, response status code and response headers
39
+ def text_input_check_sql_injection_with_http_info(value, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_sql_injection ...'
42
+ end
43
+ # verify the required parameter 'value' is set
44
+ if @api_client.config.client_side_validation && value.nil?
45
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_sql_injection"
46
+ end
47
+ # resource path
48
+ local_var_path = '/validate/text-input/check/sql-injection'
49
+
50
+ # query parameters
51
+ query_params = {}
52
+
53
+ # header parameters
54
+ header_params = {}
55
+ # HTTP header 'Accept' (if needed)
56
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
57
+ # HTTP header 'Content-Type'
58
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
59
+ header_params[:'detectionLevel'] = opts[:'detection_level'] if !opts[:'detection_level'].nil?
60
+
61
+ # form parameters
62
+ form_params = {}
63
+
64
+ # http body (model)
65
+ post_body = @api_client.object_to_http_body(value)
66
+ auth_names = ['Apikey']
67
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
68
+ :header_params => header_params,
69
+ :query_params => query_params,
70
+ :form_params => form_params,
71
+ :body => post_body,
72
+ :auth_names => auth_names,
73
+ :return_type => 'SqlInjectionDetectionResult')
74
+ if @api_client.config.debugging
75
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_sql_injection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
76
+ end
77
+ return data, status_code, headers
78
+ end
79
+ # Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
80
+ # Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items.
81
+ # @param value User-facing text input.
82
+ # @param [Hash] opts the optional parameters
83
+ # @return [SqlInjectionCheckBatchResponse]
84
+ def text_input_check_sql_injection_batch(value, opts = {})
85
+ data, _status_code, _headers = text_input_check_sql_injection_batch_with_http_info(value, opts)
86
+ data
87
+ end
88
+
89
+ # Check and protect multiple text inputs for SQL Injection (SQLI) attacks in batch
90
+ # Detects SQL Injection (SQLI) attacks from multiple text inputs. Output preverses order of input items.
91
+ # @param value User-facing text input.
92
+ # @param [Hash] opts the optional parameters
93
+ # @return [Array<(SqlInjectionCheckBatchResponse, Fixnum, Hash)>] SqlInjectionCheckBatchResponse data, response status code and response headers
94
+ def text_input_check_sql_injection_batch_with_http_info(value, opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_sql_injection_batch ...'
97
+ end
98
+ # verify the required parameter 'value' is set
99
+ if @api_client.config.client_side_validation && value.nil?
100
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_sql_injection_batch"
101
+ end
102
+ # resource path
103
+ local_var_path = '/validate/text-input/check/sql-injection/batch'
104
+
105
+ # query parameters
106
+ query_params = {}
107
+
108
+ # header parameters
109
+ header_params = {}
110
+ # HTTP header 'Accept' (if needed)
111
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
112
+ # HTTP header 'Content-Type'
113
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
114
+
115
+ # form parameters
116
+ form_params = {}
117
+
118
+ # http body (model)
119
+ post_body = @api_client.object_to_http_body(value)
120
+ auth_names = ['Apikey']
121
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
122
+ :header_params => header_params,
123
+ :query_params => query_params,
124
+ :form_params => form_params,
125
+ :body => post_body,
126
+ :auth_names => auth_names,
127
+ :return_type => 'SqlInjectionCheckBatchResponse')
128
+ if @api_client.config.debugging
129
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_sql_injection_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
130
+ end
131
+ return data, status_code, headers
132
+ end
22
133
  # Check text input for Cross-Site-Scripting (XSS) attacks
23
134
  # Detects XSS (Cross-Site-Scripting) attacks from text input.
24
135
  # @param value User-facing text input.
@@ -74,7 +185,7 @@ module CloudmersiveValidateApiClient
74
185
  return data, status_code, headers
75
186
  end
76
187
  # Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
77
- # Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
188
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items.
78
189
  # @param value User-facing text input.
79
190
  # @param [Hash] opts the optional parameters
80
191
  # @return [XssProtectionBatchResponse]
@@ -84,7 +195,7 @@ module CloudmersiveValidateApiClient
84
195
  end
85
196
 
86
197
  # Check and protect multiple text inputs for Cross-Site-Scripting (XSS) attacks in batch
87
- # Detects XSS (Cross-Site-Scripting) attacks from multiple text input. Output preverses order of input items.
198
+ # Detects XSS (Cross-Site-Scripting) attacks from multiple text inputs. Output preverses order of input items.
88
199
  # @param value User-facing text input.
89
200
  # @param [Hash] opts the optional parameters
90
201
  # @return [Array<(XssProtectionBatchResponse, Fixnum, Hash)>] XssProtectionBatchResponse data, response status code and response headers
@@ -127,6 +238,123 @@ module CloudmersiveValidateApiClient
127
238
  end
128
239
  return data, status_code, headers
129
240
  end
241
+ # Protect text input from XML External Entity (XXE) attacks
242
+ # Detects XXE (XML External Entity) attacks from text input.
243
+ # @param value User-facing text input.
244
+ # @param [Hash] opts the optional parameters
245
+ # @option opts [BOOLEAN] :allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
246
+ # @option opts [String] :known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
247
+ # @option opts [String] :known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
248
+ # @return [XxeDetectionResult]
249
+ def text_input_check_xxe(value, opts = {})
250
+ data, _status_code, _headers = text_input_check_xxe_with_http_info(value, opts)
251
+ data
252
+ end
253
+
254
+ # Protect text input from XML External Entity (XXE) attacks
255
+ # Detects XXE (XML External Entity) attacks from text input.
256
+ # @param value User-facing text input.
257
+ # @param [Hash] opts the optional parameters
258
+ # @option opts [BOOLEAN] :allow_internet_urls Optional: Set to true to allow Internet-based dependency URLs for DTDs and other XML External Entitites, set to false to block. Default is false.
259
+ # @option opts [String] :known_safe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered safe.
260
+ # @option opts [String] :known_unsafe_urls Optional: Comma separated list of fully-qualified URLs that will automatically be considered unsafe.
261
+ # @return [Array<(XxeDetectionResult, Fixnum, Hash)>] XxeDetectionResult data, response status code and response headers
262
+ def text_input_check_xxe_with_http_info(value, opts = {})
263
+ if @api_client.config.debugging
264
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xxe ...'
265
+ end
266
+ # verify the required parameter 'value' is set
267
+ if @api_client.config.client_side_validation && value.nil?
268
+ fail ArgumentError, "Missing the required parameter 'value' when calling TextInputApi.text_input_check_xxe"
269
+ end
270
+ # resource path
271
+ local_var_path = '/validate/text-input/check/xxe'
272
+
273
+ # query parameters
274
+ query_params = {}
275
+
276
+ # header parameters
277
+ header_params = {}
278
+ # HTTP header 'Accept' (if needed)
279
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
280
+ # HTTP header 'Content-Type'
281
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
282
+ header_params[:'allowInternetUrls'] = opts[:'allow_internet_urls'] if !opts[:'allow_internet_urls'].nil?
283
+ header_params[:'knownSafeUrls'] = opts[:'known_safe_urls'] if !opts[:'known_safe_urls'].nil?
284
+ header_params[:'knownUnsafeUrls'] = opts[:'known_unsafe_urls'] if !opts[:'known_unsafe_urls'].nil?
285
+
286
+ # form parameters
287
+ form_params = {}
288
+
289
+ # http body (model)
290
+ post_body = @api_client.object_to_http_body(value)
291
+ auth_names = ['Apikey']
292
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
293
+ :header_params => header_params,
294
+ :query_params => query_params,
295
+ :form_params => form_params,
296
+ :body => post_body,
297
+ :auth_names => auth_names,
298
+ :return_type => 'XxeDetectionResult')
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_xxe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
301
+ end
302
+ return data, status_code, headers
303
+ end
304
+ # Protect text input from XML External Entity (XXE) attacks
305
+ # Detects XXE (XML External Entity) attacks from text input.
306
+ # @param request
307
+ # @param [Hash] opts the optional parameters
308
+ # @return [XxeDetectionBatchResponse]
309
+ def text_input_check_xxe_batch(request, opts = {})
310
+ data, _status_code, _headers = text_input_check_xxe_batch_with_http_info(request, opts)
311
+ data
312
+ end
313
+
314
+ # Protect text input from XML External Entity (XXE) attacks
315
+ # Detects XXE (XML External Entity) attacks from text input.
316
+ # @param request
317
+ # @param [Hash] opts the optional parameters
318
+ # @return [Array<(XxeDetectionBatchResponse, Fixnum, Hash)>] XxeDetectionBatchResponse data, response status code and response headers
319
+ def text_input_check_xxe_batch_with_http_info(request, opts = {})
320
+ if @api_client.config.debugging
321
+ @api_client.config.logger.debug 'Calling API: TextInputApi.text_input_check_xxe_batch ...'
322
+ end
323
+ # verify the required parameter 'request' is set
324
+ if @api_client.config.client_side_validation && request.nil?
325
+ fail ArgumentError, "Missing the required parameter 'request' when calling TextInputApi.text_input_check_xxe_batch"
326
+ end
327
+ # resource path
328
+ local_var_path = '/validate/text-input/check/xxe/batch'
329
+
330
+ # query parameters
331
+ query_params = {}
332
+
333
+ # header parameters
334
+ header_params = {}
335
+ # HTTP header 'Accept' (if needed)
336
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
337
+ # HTTP header 'Content-Type'
338
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
339
+
340
+ # form parameters
341
+ form_params = {}
342
+
343
+ # http body (model)
344
+ post_body = @api_client.object_to_http_body(request)
345
+ auth_names = ['Apikey']
346
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
347
+ :header_params => header_params,
348
+ :query_params => query_params,
349
+ :form_params => form_params,
350
+ :body => post_body,
351
+ :auth_names => auth_names,
352
+ :return_type => 'XxeDetectionBatchResponse')
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: TextInputApi#text_input_check_xxe_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
130
358
  # Protect text input from Cross-Site-Scripting (XSS) attacks through normalization
131
359
  # Detects and removes XSS (Cross-Site-Scripting) attacks from text input through normalization. Returns the normalized result, as well as information on whether the original input contained an XSS risk.
132
360
  # @param value User-facing text input.
@@ -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
@@ -13,7 +13,7 @@ Swagger Codegen version: 2.4.14
13
13
  require 'date'
14
14
 
15
15
  module CloudmersiveValidateApiClient
16
- # Geolocation result
16
+ # Geolocation result of performing an IP address geolocation operation. This product includes GeoLite2 data created by MaxMind, available from www.maxmind.com.
17
17
  class GeolocateResponse
18
18
  # Two-letter country code of IP address
19
19
  attr_accessor :country_code