Class: ApimaticApi::ApiValidationV2ExternalApisController
- Inherits:
-
BaseController
- Object
- BaseController
- ApimaticApi::ApiValidationV2ExternalApisController
- Defined in:
- lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb
Overview
ApiValidationV2ExternalApisController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#validate_api_via_file_v2(content_type, file) ⇒ ApiResponse
Validate an API by uploading the API specification file.
-
#validate_api_via_url_v2(url) ⇒ ApiResponse
Validate an API by providing the URL of the API specification file.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler
Constructor Details
This class inherits a constructor from ApimaticApi::BaseController
Instance Method Details
#validate_api_via_file_v2(content_type, file) ⇒ ApiResponse
Validate an API by uploading the API specification file.
You can also specify API
Metadata while
validating the API using this endpoint. When specifying Metadata, the
uploaded file will be a zip file containing the API specification file and
the APIMATIC-META json file.
file.
The type of the specification file should be any of the
[supported
formats](https://docs.apimatic.io/api-transformer/overview-transformer#sup
ported-input-formats).
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb', line 22 def validate_api_via_file_v2(content_type, file) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/validation/v2/validate-via-file', Server::DEFAULT) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ValidateApiResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', ProblemDetailsException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('403', 'Subscription Issue', ProblemDetailsException) .local_error('500', 'Internal Server Error', InternalServerErrorResponseException)) .execute end |
#validate_api_via_url_v2(url) ⇒ ApiResponse
Validate an API by providing the URL of the API specification file.
You can also specify API
Metadata while
validating the API using this endpoint. When specifying Metadata, the URL
provided will be that of a zip file containing the API specification file
and the APIMATIC-META json file.
file.
Note: This URL should be publicly accessible.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb', line 61 def validate_api_via_url_v2(url) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/validation/v2/validate-via-url', Server::DEFAULT) .query_param(new_parameter(url, key: 'url') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ValidateApiResult.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Request', ProblemDetailsException) .local_error('401', 'Unauthorized', UnauthorizedResponseException) .local_error('403', 'Subscription Issue', ProblemDetailsException) .local_error('500', 'Internal Server Error', InternalServerErrorResponseException)) .execute end |