=begin #validateapi #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. OpenAPI spec version: v1 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.14 =end require 'uri' module CloudmersiveValidateApiClient class DomainApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Validate a domain name # Check whether a domain name is valid or not. API performs a live validation by contacting DNS services to validate the existence of the domain name. # @param domain Domain name to check, for example \"cloudmersive.com\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [CheckResponse] def domain_check(domain, opts = {}) data, _status_code, _headers = domain_check_with_http_info(domain, opts) data end # Validate a domain name # Check whether a domain name is valid or not. API performs a live validation by contacting DNS services to validate the existence of the domain name. # @param domain Domain name to check, for example \"cloudmersive.com\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [Array<(CheckResponse, Fixnum, Hash)>] CheckResponse data, response status code and response headers def domain_check_with_http_info(domain, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_check ...' end # verify the required parameter 'domain' is set if @api_client.config.client_side_validation && domain.nil? fail ArgumentError, "Missing the required parameter 'domain' when calling DomainApi.domain_check" end # resource path local_var_path = '/validate/domain/check' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(domain) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CheckResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get top-level domain name from URL # Gets the top-level domain name from a URL, such as mydomain.com. # @param request Input URL information # @param [Hash] opts the optional parameters # @return [ValidateUrlResponseSyntaxOnly] def domain_get_top_level_domain_from_url(request, opts = {}) data, _status_code, _headers = domain_get_top_level_domain_from_url_with_http_info(request, opts) data end # Get top-level domain name from URL # Gets the top-level domain name from a URL, such as mydomain.com. # @param request Input URL information # @param [Hash] opts the optional parameters # @return [Array<(ValidateUrlResponseSyntaxOnly, Fixnum, Hash)>] ValidateUrlResponseSyntaxOnly data, response status code and response headers def domain_get_top_level_domain_from_url_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_get_top_level_domain_from_url ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_get_top_level_domain_from_url" end # resource path local_var_path = '/validate/domain/url/get-top-level-domain' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ValidateUrlResponseSyntaxOnly') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_get_top_level_domain_from_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check if path is a high-risk server administration path # Check if the input URL or relative path is a server Administration Path, and therefore a risk for remote access. # @param value URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [IsAdminPathResponse] def domain_is_admin_path(value, opts = {}) data, _status_code, _headers = domain_is_admin_path_with_http_info(value, opts) data end # Check if path is a high-risk server administration path # Check if the input URL or relative path is a server Administration Path, and therefore a risk for remote access. # @param value URL or relative path to check, e.g. \"/admin/login\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [Array<(IsAdminPathResponse, Fixnum, Hash)>] IsAdminPathResponse data, response status code and response headers def domain_is_admin_path_with_http_info(value, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_is_admin_path ...' end # verify the required parameter 'value' is set if @api_client.config.client_side_validation && value.nil? fail ArgumentError, "Missing the required parameter 'value' when calling DomainApi.domain_is_admin_path" end # resource path local_var_path = '/validate/domain/url/is-admin-path' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(value) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'IsAdminPathResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_is_admin_path\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check a URL for Phishing threats # 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. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [PhishingCheckResponse] def domain_phishing_check(request, opts = {}) data, _status_code, _headers = domain_phishing_check_with_http_info(request, opts) data end # Check a URL for Phishing threats # 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. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [Array<(PhishingCheckResponse, Fixnum, Hash)>] PhishingCheckResponse data, response status code and response headers def domain_phishing_check_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_phishing_check ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_phishing_check" end # resource path local_var_path = '/validate/domain/url/phishing-threat-check' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'PhishingCheckResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_phishing_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get WHOIS information for a domain # 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. # @param domain Domain name to check, for example \"cloudmersive.com\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [WhoisResponse] def domain_post(domain, opts = {}) data, _status_code, _headers = domain_post_with_http_info(domain, opts) data end # Get WHOIS information for a domain # 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. # @param domain Domain name to check, for example \"cloudmersive.com\". The input is a string so be sure to enclose it in double-quotes. # @param [Hash] opts the optional parameters # @return [Array<(WhoisResponse, Fixnum, Hash)>] WhoisResponse data, response status code and response headers def domain_post_with_http_info(domain, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_post ...' end # verify the required parameter 'domain' is set if @api_client.config.client_side_validation && domain.nil? fail ArgumentError, "Missing the required parameter 'domain' when calling DomainApi.domain_post" end # resource path local_var_path = '/validate/domain/whois' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(domain) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'WhoisResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate a domain name's quality score # Check the quality of a domain name. Supports over 9 million domain names. Higher quality scores indicate more trust and authority in the domain name, with values ranging from 0.0 (low quality) to 10.0 (maximum quality). # @param domain Domain name to check, for example \"cloudmersive.com\". # @param [Hash] opts the optional parameters # @return [DomainQualityResponse] def domain_quality_score(domain, opts = {}) data, _status_code, _headers = domain_quality_score_with_http_info(domain, opts) data end # Validate a domain name's quality score # Check the quality of a domain name. Supports over 9 million domain names. Higher quality scores indicate more trust and authority in the domain name, with values ranging from 0.0 (low quality) to 10.0 (maximum quality). # @param domain Domain name to check, for example \"cloudmersive.com\". # @param [Hash] opts the optional parameters # @return [Array<(DomainQualityResponse, Fixnum, Hash)>] DomainQualityResponse data, response status code and response headers def domain_quality_score_with_http_info(domain, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_quality_score ...' end # verify the required parameter 'domain' is set if @api_client.config.client_side_validation && domain.nil? fail ArgumentError, "Missing the required parameter 'domain' when calling DomainApi.domain_quality_score" end # resource path local_var_path = '/validate/domain/quality-score' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(domain) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DomainQualityResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_quality_score\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check a URL for safety threats # Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [UrlSafetyCheckResponseFull] def domain_safety_check(request, opts = {}) data, _status_code, _headers = domain_safety_check_with_http_info(request, opts) data end # Check a URL for safety threats # Checks if an input URL is at risk of being a safety threat through malware, unwanted software, or social engineering threats. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [Array<(UrlSafetyCheckResponseFull, Fixnum, Hash)>] UrlSafetyCheckResponseFull data, response status code and response headers def domain_safety_check_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_safety_check ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_safety_check" end # resource path local_var_path = '/validate/domain/url/safety-threat-check' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UrlSafetyCheckResponseFull') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_safety_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check a URL for SSRF threats # Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [UrlSsrfResponseFull] def domain_ssrf_check(request, opts = {}) data, _status_code, _headers = domain_ssrf_check_with_http_info(request, opts) data end # Check a URL for SSRF threats # Checks if an input URL is at risk of being an SSRF (Server-side request forgery) threat or attack. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [Array<(UrlSsrfResponseFull, Fixnum, Hash)>] UrlSsrfResponseFull data, response status code and response headers def domain_ssrf_check_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_ssrf_check ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_ssrf_check" end # resource path local_var_path = '/validate/domain/url/ssrf-threat-check' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UrlSsrfResponseFull') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_ssrf_check\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check a URL for SSRF threats in batches # Batch-checks if input URLs are at risk of being an SSRF (Server-side request forgery) threat or attack. # @param request Input URL request as a batch of multiple URLs # @param [Hash] opts the optional parameters # @return [UrlSsrfResponseBatch] def domain_ssrf_check_batch(request, opts = {}) data, _status_code, _headers = domain_ssrf_check_batch_with_http_info(request, opts) data end # Check a URL for SSRF threats in batches # Batch-checks if input URLs are at risk of being an SSRF (Server-side request forgery) threat or attack. # @param request Input URL request as a batch of multiple URLs # @param [Hash] opts the optional parameters # @return [Array<(UrlSsrfResponseBatch, Fixnum, Hash)>] UrlSsrfResponseBatch data, response status code and response headers def domain_ssrf_check_batch_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_ssrf_check_batch ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_ssrf_check_batch" end # resource path local_var_path = '/validate/domain/url/ssrf-threat-check/batch' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'UrlSsrfResponseBatch') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_ssrf_check_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate a URL fully # 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. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [ValidateUrlResponseFull] def domain_url_full(request, opts = {}) data, _status_code, _headers = domain_url_full_with_http_info(request, opts) data end # Validate a URL fully # 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. # @param request Input URL request # @param [Hash] opts the optional parameters # @return [Array<(ValidateUrlResponseFull, Fixnum, Hash)>] ValidateUrlResponseFull data, response status code and response headers def domain_url_full_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_url_full ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_url_full" end # resource path local_var_path = '/validate/domain/url/full' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ValidateUrlResponseFull') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_url_full\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate a URL syntactically # 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. # @param request Input URL information # @param [Hash] opts the optional parameters # @return [ValidateUrlResponseSyntaxOnly] def domain_url_syntax_only(request, opts = {}) data, _status_code, _headers = domain_url_syntax_only_with_http_info(request, opts) data end # Validate a URL syntactically # 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. # @param request Input URL information # @param [Hash] opts the optional parameters # @return [Array<(ValidateUrlResponseSyntaxOnly, Fixnum, Hash)>] ValidateUrlResponseSyntaxOnly data, response status code and response headers def domain_url_syntax_only_with_http_info(request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainApi.domain_url_syntax_only ...' end # verify the required parameter 'request' is set if @api_client.config.client_side_validation && request.nil? fail ArgumentError, "Missing the required parameter 'request' when calling DomainApi.domain_url_syntax_only" end # resource path local_var_path = '/validate/domain/url/syntax-only' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(request) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ValidateUrlResponseSyntaxOnly') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainApi#domain_url_syntax_only\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end