Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
inc-validator-client-ruby/lib/inc-validator-client/api/validation_api.rb
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
131 lines (113 sloc)
4.67 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
#Metadata Validation API | |
#API for the metadata validation service. | |
OpenAPI spec version: 1.0.0 | |
Contact: ian@iay.org.uk | |
Generated by: https://github.com/swagger-api/swagger-codegen.git | |
Swagger Codegen version: 2.3.1 | |
=end | |
require "uri" | |
module ValidatorClient | |
class ValidationApi | |
attr_accessor :api_client | |
def initialize(api_client = ApiClient.default) | |
@api_client = api_client | |
end | |
# lists available validators | |
# Lists all of the available validator pipelines. | |
# @param [Hash] opts the optional parameters | |
# @return [Array<Validator>] | |
def get_validators(opts = {}) | |
data, _status_code, _headers = get_validators_with_http_info(opts) | |
return data | |
end | |
# lists available validators | |
# Lists all of the available validator pipelines. | |
# @param [Hash] opts the optional parameters | |
# @return [Array<(Array<Validator>, Fixnum, Hash)>] Array<Validator> data, response status code and response headers | |
def get_validators_with_http_info(opts = {}) | |
if @api_client.config.debugging | |
@api_client.config.logger.debug "Calling API: ValidationApi.get_validators ..." | |
end | |
# resource path | |
local_var_path = "/validators" | |
# query parameters | |
query_params = {} | |
# header parameters | |
header_params = {} | |
# HTTP header 'Accept' (if needed) | |
header_params['Accept'] = @api_client.select_header_accept(['application/json']) | |
# form parameters | |
form_params = {} | |
# http body (model) | |
post_body = nil | |
auth_names = [] | |
data, status_code, headers = @api_client.call_api(:GET, local_var_path, | |
:header_params => header_params, | |
:query_params => query_params, | |
:form_params => form_params, | |
:body => post_body, | |
:auth_names => auth_names, | |
:return_type => 'Array<Validator>') | |
if @api_client.config.debugging | |
@api_client.config.logger.debug "API called: ValidationApi#get_validators\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" | |
end | |
return data, status_code, headers | |
end | |
# performs a validation | |
# | |
# @param validator_id An identifier for the validation to be performed. | |
# @param metadata The metadata to be validated. | |
# @param [Hash] opts the optional parameters | |
# @return [Array<Status>] | |
def validate(validator_id, metadata, opts = {}) | |
data, _status_code, _headers = validate_with_http_info(validator_id, metadata, opts) | |
return data | |
end | |
# performs a validation | |
# | |
# @param validator_id An identifier for the validation to be performed. | |
# @param metadata The metadata to be validated. | |
# @param [Hash] opts the optional parameters | |
# @return [Array<(Array<Status>, Fixnum, Hash)>] Array<Status> data, response status code and response headers | |
def validate_with_http_info(validator_id, metadata, opts = {}) | |
if @api_client.config.debugging | |
@api_client.config.logger.debug "Calling API: ValidationApi.validate ..." | |
end | |
# verify the required parameter 'validator_id' is set | |
if @api_client.config.client_side_validation && validator_id.nil? | |
fail ArgumentError, "Missing the required parameter 'validator_id' when calling ValidationApi.validate" | |
end | |
# verify the required parameter 'metadata' is set | |
if @api_client.config.client_side_validation && metadata.nil? | |
fail ArgumentError, "Missing the required parameter 'metadata' when calling ValidationApi.validate" | |
end | |
# resource path | |
local_var_path = "/validators/{validator_id}/validate".sub('{' + 'validator_id' + '}', validator_id.to_s) | |
# query parameters | |
query_params = {} | |
# header parameters | |
header_params = {} | |
# HTTP header 'Accept' (if needed) | |
header_params['Accept'] = @api_client.select_header_accept(['application/json']) | |
# HTTP header 'Content-Type' | |
header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml+samlmetadata']) | |
# form parameters | |
form_params = {} | |
# http body (model) | |
post_body = @api_client.object_to_http_body(metadata) | |
auth_names = [] | |
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 => 'Array<Status>') | |
if @api_client.config.debugging | |
@api_client.config.logger.debug "API called: ValidationApi#validate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" | |
end | |
return data, status_code, headers | |
end | |
end | |
end |