cloudmersive-validate-api-client 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afffb6db20490e6875a2912aae61a195e915e7f227a408a19b8dfc8116bf8c97
4
- data.tar.gz: bd4588635ccdea19658f9cf1becebc2f21fe7316c73a2439a3438719c5d1570a
3
+ metadata.gz: 4efb7c1b214896dcd9bf6aba9314f75a4d05b90b8d8f1563401ccc1aa6086657
4
+ data.tar.gz: ef7cb76a16710e47a88e4b438c25fcb5d65957160ec4655587fc7f23e3c974b1
5
5
  SHA512:
6
- metadata.gz: 8e4bb3b1b307b45ee352fd353330b5fb40c2eae83e6de7731936fb8f929e704a836f019dbd152926595cd31cafeb6226972d2c32466ce4ed2a0108391bfc567b
7
- data.tar.gz: cf5ed08ccb9440cfcc3ccb1ce2ff197a63e1e6b9adc5893381d77d1e1041c6a57ea1a27800fba11dcd95a2225cfe6dc5bddc8935f6159b57e0044b8476ddefcf
6
+ metadata.gz: 9d84a9600887dde17dd1446cb558698ddc4a91c44a39c909537c54940531279b51f6bc93f7e67058dcf0c56f169e39c0b3e858e795b66b9aa69686441e75a082
7
+ data.tar.gz: e7a718999f87d3c8d70c4da49eb610f09b8154286b070b36755599003ba84ca27600d8a3d3cca5ca83b10ad2f5c6010defdb7b5bf0d4d2406cb2a7130792182f
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.6
10
+ - Package version: 2.1.7
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.6.gem
26
+ gem install ./cloudmersive-validate-api-client-2.1.7.gem
27
27
  ```
28
- (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.6.gem` to install the development dependencies)
28
+ (for development, run `gem install --dev ./cloudmersive-validate-api-client-2.1.7.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.6'
34
+ gem 'cloudmersive-validate-api-client', '~> 2.1.7'
35
35
 
36
36
  ### Install from Git
37
37
 
@@ -103,8 +103,10 @@ Class | Method | HTTP request | Description
103
103
  *CloudmersiveValidateApiClient::DateTimeApi* | [**date_time_parse_standard_date_time**](docs/DateTimeApi.md#date_time_parse_standard_date_time) | **POST** /validate/date-time/parse/date-time/structured | Parses a standardized date and time string into a date and time
104
104
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_check**](docs/DomainApi.md#domain_check) | **POST** /validate/domain/check | Validate a domain name
105
105
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_get_top_level_domain_from_url**](docs/DomainApi.md#domain_get_top_level_domain_from_url) | **POST** /validate/domain/url/get-top-level-domain | Get top-level domain name from URL
106
+ *CloudmersiveValidateApiClient::DomainApi* | [**domain_phishing_check**](docs/DomainApi.md#domain_phishing_check) | **POST** /validate/domain/url/phishing-threat-check | Check a URL for Phishing threats
106
107
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_post**](docs/DomainApi.md#domain_post) | **POST** /validate/domain/whois | Get WHOIS information for a domain
107
108
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_quality_score**](docs/DomainApi.md#domain_quality_score) | **POST** /validate/domain/quality-score | Validate a domain name's quality score
109
+ *CloudmersiveValidateApiClient::DomainApi* | [**domain_safety_check**](docs/DomainApi.md#domain_safety_check) | **POST** /validate/domain/url/safety-threat-check | Check a URL for safety threats
108
110
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_ssrf_check**](docs/DomainApi.md#domain_ssrf_check) | **POST** /validate/domain/url/ssrf-threat-check | Check a URL for SSRF threats
109
111
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_ssrf_check_batch**](docs/DomainApi.md#domain_ssrf_check_batch) | **POST** /validate/domain/url/ssrf-threat-check/batch | Check a URL for SSRF threats in batches
110
112
  *CloudmersiveValidateApiClient::DomainApi* | [**domain_url_full**](docs/DomainApi.md#domain_url_full) | **POST** /validate/domain/url/full | Validate a URL fully
@@ -168,6 +170,8 @@ Class | Method | HTTP request | Description
168
170
  - [CloudmersiveValidateApiClient::NormalizeAddressResponse](docs/NormalizeAddressResponse.md)
169
171
  - [CloudmersiveValidateApiClient::ParseAddressRequest](docs/ParseAddressRequest.md)
170
172
  - [CloudmersiveValidateApiClient::ParseAddressResponse](docs/ParseAddressResponse.md)
173
+ - [CloudmersiveValidateApiClient::PhishingCheckRequest](docs/PhishingCheckRequest.md)
174
+ - [CloudmersiveValidateApiClient::PhishingCheckResponse](docs/PhishingCheckResponse.md)
171
175
  - [CloudmersiveValidateApiClient::PhoneNumberValidateRequest](docs/PhoneNumberValidateRequest.md)
172
176
  - [CloudmersiveValidateApiClient::PhoneNumberValidationResponse](docs/PhoneNumberValidationResponse.md)
173
177
  - [CloudmersiveValidateApiClient::PublicHolidayOccurrence](docs/PublicHolidayOccurrence.md)
@@ -176,6 +180,8 @@ Class | Method | HTTP request | Description
176
180
  - [CloudmersiveValidateApiClient::ReverseGeocodeAddressResponse](docs/ReverseGeocodeAddressResponse.md)
177
181
  - [CloudmersiveValidateApiClient::Timezone](docs/Timezone.md)
178
182
  - [CloudmersiveValidateApiClient::TorNodeResponse](docs/TorNodeResponse.md)
183
+ - [CloudmersiveValidateApiClient::UrlSafetyCheckRequestFull](docs/UrlSafetyCheckRequestFull.md)
184
+ - [CloudmersiveValidateApiClient::UrlSafetyCheckResponseFull](docs/UrlSafetyCheckResponseFull.md)
179
185
  - [CloudmersiveValidateApiClient::UrlSsrfRequestBatch](docs/UrlSsrfRequestBatch.md)
180
186
  - [CloudmersiveValidateApiClient::UrlSsrfRequestFull](docs/UrlSsrfRequestFull.md)
181
187
  - [CloudmersiveValidateApiClient::UrlSsrfResponseBatch](docs/UrlSsrfResponseBatch.md)
data/docs/DomainApi.md CHANGED
@@ -6,8 +6,10 @@ 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_get_top_level_domain_from_url**](DomainApi.md#domain_get_top_level_domain_from_url) | **POST** /validate/domain/url/get-top-level-domain | Get top-level domain name from URL
9
+ [**domain_phishing_check**](DomainApi.md#domain_phishing_check) | **POST** /validate/domain/url/phishing-threat-check | Check a URL for Phishing threats
9
10
  [**domain_post**](DomainApi.md#domain_post) | **POST** /validate/domain/whois | Get WHOIS information for a domain
10
11
  [**domain_quality_score**](DomainApi.md#domain_quality_score) | **POST** /validate/domain/quality-score | Validate a domain name's quality score
12
+ [**domain_safety_check**](DomainApi.md#domain_safety_check) | **POST** /validate/domain/url/safety-threat-check | Check a URL for safety threats
11
13
  [**domain_ssrf_check**](DomainApi.md#domain_ssrf_check) | **POST** /validate/domain/url/ssrf-threat-check | Check a URL for SSRF threats
12
14
  [**domain_ssrf_check_batch**](DomainApi.md#domain_ssrf_check_batch) | **POST** /validate/domain/url/ssrf-threat-check/batch | Check a URL for SSRF threats in batches
13
15
  [**domain_url_full**](DomainApi.md#domain_url_full) | **POST** /validate/domain/url/full | Validate a URL fully
@@ -122,6 +124,60 @@ Name | Type | Description | Notes
122
124
 
123
125
 
124
126
 
127
+ # **domain_phishing_check**
128
+ > PhishingCheckResponse domain_phishing_check(request)
129
+
130
+ Check a URL for Phishing threats
131
+
132
+ Checks if an input URL is at risk of being an Phishing (fake login page, or other page designed to collect information via social engineering) threat or attack.
133
+
134
+ ### Example
135
+ ```ruby
136
+ # load the gem
137
+ require 'cloudmersive-validate-api-client'
138
+ # setup authorization
139
+ CloudmersiveValidateApiClient.configure do |config|
140
+ # Configure API key authorization: Apikey
141
+ config.api_key['Apikey'] = 'YOUR API KEY'
142
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
143
+ #config.api_key_prefix['Apikey'] = 'Bearer'
144
+ end
145
+
146
+ api_instance = CloudmersiveValidateApiClient::DomainApi.new
147
+
148
+ request = CloudmersiveValidateApiClient::PhishingCheckRequest.new # PhishingCheckRequest | Input URL request
149
+
150
+
151
+ begin
152
+ #Check a URL for Phishing threats
153
+ result = api_instance.domain_phishing_check(request)
154
+ p result
155
+ rescue CloudmersiveValidateApiClient::ApiError => e
156
+ puts "Exception when calling DomainApi->domain_phishing_check: #{e}"
157
+ end
158
+ ```
159
+
160
+ ### Parameters
161
+
162
+ Name | Type | Description | Notes
163
+ ------------- | ------------- | ------------- | -------------
164
+ **request** | [**PhishingCheckRequest**](PhishingCheckRequest.md)| Input URL request |
165
+
166
+ ### Return type
167
+
168
+ [**PhishingCheckResponse**](PhishingCheckResponse.md)
169
+
170
+ ### Authorization
171
+
172
+ [Apikey](../README.md#Apikey)
173
+
174
+ ### HTTP request headers
175
+
176
+ - **Content-Type**: application/json, text/json
177
+ - **Accept**: application/json, text/json, application/xml, text/xml
178
+
179
+
180
+
125
181
  # **domain_post**
126
182
  > WhoisResponse domain_post(domain)
127
183
 
@@ -230,6 +286,60 @@ Name | Type | Description | Notes
230
286
 
231
287
 
232
288
 
289
+ # **domain_safety_check**
290
+ > UrlSafetyCheckResponseFull domain_safety_check(request)
291
+
292
+ Check a URL for safety threats
293
+
294
+ Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats.
295
+
296
+ ### Example
297
+ ```ruby
298
+ # load the gem
299
+ require 'cloudmersive-validate-api-client'
300
+ # setup authorization
301
+ CloudmersiveValidateApiClient.configure do |config|
302
+ # Configure API key authorization: Apikey
303
+ config.api_key['Apikey'] = 'YOUR API KEY'
304
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
305
+ #config.api_key_prefix['Apikey'] = 'Bearer'
306
+ end
307
+
308
+ api_instance = CloudmersiveValidateApiClient::DomainApi.new
309
+
310
+ request = CloudmersiveValidateApiClient::UrlSafetyCheckRequestFull.new # UrlSafetyCheckRequestFull | Input URL request
311
+
312
+
313
+ begin
314
+ #Check a URL for safety threats
315
+ result = api_instance.domain_safety_check(request)
316
+ p result
317
+ rescue CloudmersiveValidateApiClient::ApiError => e
318
+ puts "Exception when calling DomainApi->domain_safety_check: #{e}"
319
+ end
320
+ ```
321
+
322
+ ### Parameters
323
+
324
+ Name | Type | Description | Notes
325
+ ------------- | ------------- | ------------- | -------------
326
+ **request** | [**UrlSafetyCheckRequestFull**](UrlSafetyCheckRequestFull.md)| Input URL request |
327
+
328
+ ### Return type
329
+
330
+ [**UrlSafetyCheckResponseFull**](UrlSafetyCheckResponseFull.md)
331
+
332
+ ### Authorization
333
+
334
+ [Apikey](../README.md#Apikey)
335
+
336
+ ### HTTP request headers
337
+
338
+ - **Content-Type**: application/json, text/json
339
+ - **Accept**: application/json, text/json, application/xml, text/xml
340
+
341
+
342
+
233
343
  # **domain_ssrf_check**
234
344
  > UrlSsrfResponseFull domain_ssrf_check(request)
235
345
 
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::PhishingCheckRequest
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **url** | **String** | URL to validate | [optional]
7
+
8
+
@@ -0,0 +1,9 @@
1
+ # CloudmersiveValidateApiClient::PhishingCheckResponse
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **clean_url** | **BOOLEAN** | True if the URL is clean, false if it is at risk of containing a Phishing threat or attack | [optional]
7
+ **threat_type** | **String** | Threat type of the Phishing threat; possible values are VerifiedPhishingURL, UnverifiedPhishingURL, or VerifiedPhishingDomain | [optional]
8
+
9
+
@@ -0,0 +1,8 @@
1
+ # CloudmersiveValidateApiClient::UrlSafetyCheckRequestFull
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **url** | **String** | URL to validate | [optional]
7
+
8
+
@@ -0,0 +1,9 @@
1
+ # CloudmersiveValidateApiClient::UrlSafetyCheckResponseFull
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **clean_url** | **BOOLEAN** | True if the URL is clean, false if it is at risk of containing a safety threat or attack | [optional]
7
+ **threat_type** | **String** | Threat type identified, if any; possible values are \"ForcedDownload\", \"VirusesAndMalware\", \"Phishing\" | [optional]
8
+
9
+
@@ -50,6 +50,8 @@ require 'cloudmersive-validate-api-client/models/lead_enrichment_response'
50
50
  require 'cloudmersive-validate-api-client/models/normalize_address_response'
51
51
  require 'cloudmersive-validate-api-client/models/parse_address_request'
52
52
  require 'cloudmersive-validate-api-client/models/parse_address_response'
53
+ require 'cloudmersive-validate-api-client/models/phishing_check_request'
54
+ require 'cloudmersive-validate-api-client/models/phishing_check_response'
53
55
  require 'cloudmersive-validate-api-client/models/phone_number_validate_request'
54
56
  require 'cloudmersive-validate-api-client/models/phone_number_validation_response'
55
57
  require 'cloudmersive-validate-api-client/models/public_holiday_occurrence'
@@ -58,6 +60,8 @@ require 'cloudmersive-validate-api-client/models/reverse_geocode_address_request
58
60
  require 'cloudmersive-validate-api-client/models/reverse_geocode_address_response'
59
61
  require 'cloudmersive-validate-api-client/models/timezone'
60
62
  require 'cloudmersive-validate-api-client/models/tor_node_response'
63
+ require 'cloudmersive-validate-api-client/models/url_safety_check_request_full'
64
+ require 'cloudmersive-validate-api-client/models/url_safety_check_response_full'
61
65
  require 'cloudmersive-validate-api-client/models/url_ssrf_request_batch'
62
66
  require 'cloudmersive-validate-api-client/models/url_ssrf_request_full'
63
67
  require 'cloudmersive-validate-api-client/models/url_ssrf_response_batch'
@@ -127,6 +127,60 @@ module CloudmersiveValidateApiClient
127
127
  end
128
128
  return data, status_code, headers
129
129
  end
130
+ # Check a URL for Phishing threats
131
+ # Checks if an input URL is at risk of being an Phishing (fake login page, or other page designed to collect information via social engineering) threat or attack.
132
+ # @param request Input URL request
133
+ # @param [Hash] opts the optional parameters
134
+ # @return [PhishingCheckResponse]
135
+ def domain_phishing_check(request, opts = {})
136
+ data, _status_code, _headers = domain_phishing_check_with_http_info(request, opts)
137
+ data
138
+ end
139
+
140
+ # Check a URL for Phishing threats
141
+ # Checks if an input URL is at risk of being an Phishing (fake login page, or other page designed to collect information via social engineering) threat or attack.
142
+ # @param request Input URL request
143
+ # @param [Hash] opts the optional parameters
144
+ # @return [Array<(PhishingCheckResponse, Fixnum, Hash)>] PhishingCheckResponse data, response status code and response headers
145
+ def domain_phishing_check_with_http_info(request, opts = {})
146
+ if @api_client.config.debugging
147
+ @api_client.config.logger.debug 'Calling API: DomainApi.domain_phishing_check ...'
148
+ end
149
+ # verify the required parameter 'request' is set
150
+ if @api_client.config.client_side_validation && request.nil?
151
+ fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_phishing_check"
152
+ end
153
+ # resource path
154
+ local_var_path = '/validate/domain/url/phishing-threat-check'
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(request)
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 => 'PhishingCheckResponse')
179
+ if @api_client.config.debugging
180
+ @api_client.config.logger.debug "API called: DomainApi#domain_phishing_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
181
+ end
182
+ return data, status_code, headers
183
+ end
130
184
  # Get WHOIS information for a domain
131
185
  # Validate whether a domain name exists, and also return the full WHOIS record for that domain name. WHOIS records include all the registration details of the domain name, such as information about the domain's owners.
132
186
  # @param domain Domain name to check, for example \&quot;cloudmersive.com\&quot;. The input is a string so be sure to enclose it in double-quotes.
@@ -235,6 +289,60 @@ module CloudmersiveValidateApiClient
235
289
  end
236
290
  return data, status_code, headers
237
291
  end
292
+ # Check a URL for safety threats
293
+ # Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats.
294
+ # @param request Input URL request
295
+ # @param [Hash] opts the optional parameters
296
+ # @return [UrlSafetyCheckResponseFull]
297
+ def domain_safety_check(request, opts = {})
298
+ data, _status_code, _headers = domain_safety_check_with_http_info(request, opts)
299
+ data
300
+ end
301
+
302
+ # Check a URL for safety threats
303
+ # Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats.
304
+ # @param request Input URL request
305
+ # @param [Hash] opts the optional parameters
306
+ # @return [Array<(UrlSafetyCheckResponseFull, Fixnum, Hash)>] UrlSafetyCheckResponseFull data, response status code and response headers
307
+ def domain_safety_check_with_http_info(request, opts = {})
308
+ if @api_client.config.debugging
309
+ @api_client.config.logger.debug 'Calling API: DomainApi.domain_safety_check ...'
310
+ end
311
+ # verify the required parameter 'request' is set
312
+ if @api_client.config.client_side_validation && request.nil?
313
+ fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_safety_check"
314
+ end
315
+ # resource path
316
+ local_var_path = '/validate/domain/url/safety-threat-check'
317
+
318
+ # query parameters
319
+ query_params = {}
320
+
321
+ # header parameters
322
+ header_params = {}
323
+ # HTTP header 'Accept' (if needed)
324
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml'])
325
+ # HTTP header 'Content-Type'
326
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json'])
327
+
328
+ # form parameters
329
+ form_params = {}
330
+
331
+ # http body (model)
332
+ post_body = @api_client.object_to_http_body(request)
333
+ auth_names = ['Apikey']
334
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
335
+ :header_params => header_params,
336
+ :query_params => query_params,
337
+ :form_params => form_params,
338
+ :body => post_body,
339
+ :auth_names => auth_names,
340
+ :return_type => 'UrlSafetyCheckResponseFull')
341
+ if @api_client.config.debugging
342
+ @api_client.config.logger.debug "API called: DomainApi#domain_safety_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
343
+ end
344
+ return data, status_code, headers
345
+ end
238
346
  # Check a URL for SSRF threats
239
347
  # Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack.
240
348
  # @param request Input URL request
@@ -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
+ # Request to determine if a URL is a Phishing threat
17
+ class PhishingCheckRequest
18
+ # URL to validate
19
+ attr_accessor :url
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'url' => :'URL'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'url' => :'String'
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?(:'URL')
44
+ self.url = attributes[:'URL']
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
+ url == o.url
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
+ [url].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