Class: ApimaticApi::ApiValidationV2ExternalApisController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/apimatic_api/controllers/api_validation_v2_external_apis_controller.rb

Overview

ApiValidationV2ExternalApisController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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).

Parameters:

  • content_type (ContentType)

    Required parameter: Example:

  • file (File | UploadIO)

    Required parameter: The API specification

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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.

Parameters:

  • url (String)

    Required parameter: The URL for the API specification

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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