Class: ApimaticApi::TransformationController
- Inherits:
-
BaseController
- Object
- BaseController
- ApimaticApi::TransformationController
- Defined in:
- lib/apimatic_api/controllers/transformation_controller.rb
Overview
TransformationController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#delete_transformation(transformation_id) ⇒ ApiResponse
Delete a particular Transformation performed for an API via the Transformation endpoints.
-
#download_input_file(transformation_id) ⇒ ApiResponse
Download the API Specification file used as input for a particular Transformation performed via the Transformation endpoints.
-
#download_transformed_file(transformation_id) ⇒ ApiResponse
Download the transformed API specification file transformed via the Transformation endpoints.
-
#get_a_transformation(transformation_id) ⇒ ApiResponse
Get details on a particular Transformation performed via the Transformation endpoints.
-
#list_all_transformations ⇒ ApiResponse
Get a list of all API transformations performed.
-
#transform_via_file(content_type, file, export_format, _query_parameters: nil) ⇒ ApiResponse
Transform an API into any of the supported API specification formats by uploading the API specification file.
-
#transform_via_url(body) ⇒ ApiResponse
Transform an API into any of the supported API specification formats 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
#delete_transformation(transformation_id) ⇒ ApiResponse
Delete a particular Transformation performed for an API via the Transformation endpoints. transformation to delete. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 165 def delete_transformation(transformation_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/transformations/{transformation_id}', Server::DEFAULT) .template_param(new_parameter(transformation_id, key: 'transformation_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#download_input_file(transformation_id) ⇒ ApiResponse
Download the API Specification file used as input for a particular Transformation performed via the Transformation endpoints. transformation to download the API specification for. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls.
102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 102 def download_input_file(transformation_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/transformations/{transformation_id}/input-file', Server::DEFAULT) .template_param(new_parameter(transformation_id, key: 'transformation_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_api_response(true)) .execute end |
#download_transformed_file(transformation_id) ⇒ ApiResponse
Download the transformed API specification file transformed via the Transformation endpoints. transformation received in the response of the Transform Via File or Transform Via URL calls.
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 80 def download_transformed_file(transformation_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/transformations/{transformation_id}/converted-file', Server::DEFAULT) .template_param(new_parameter(transformation_id, key: 'transformation_id') .is_required(true) .should_encode(true)) .auth(Single.new('Authorization'))) .response(new_response_handler .is_api_response(true)) .execute end |
#get_a_transformation(transformation_id) ⇒ ApiResponse
Get details on a particular Transformation performed via the Transformation endpoints. transformation to fetch. The transformation ID is received in the response of the Transform Via File or Transform Via URL calls.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 140 def get_a_transformation(transformation_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/transformations/{transformation_id}', Server::DEFAULT) .template_param(new_parameter(transformation_id, key: 'transformation_id') .is_required(true) .should_encode(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(Transformation.method(:from_hash)) .is_api_response(true)) .execute end |
#list_all_transformations ⇒ ApiResponse
Get a list of all API transformations performed.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 118 def list_all_transformations @api_call .request(new_request_builder(HttpMethodEnum::GET, '/transformations', Server::DEFAULT) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Transformation.method(:from_hash)) .is_api_response(true) .is_response_array(true)) .execute end |
#transform_via_file(content_type, file, export_format, _query_parameters: nil) ⇒ ApiResponse
Transform an API into any of the supported API specification formats by
uploading the API specification file.
This endpoint transforms and then uploads the transformed API
specification to APIMatic's cloud storage. An ID for the transformation
performed is returned as part of the response.
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).
contains API specification formats that Transformer can convert to.
supported by this endpoint.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 25 def transform_via_file(content_type, file, export_format, _query_parameters: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/transformations/transform-via-file', Server::DEFAULT) .multipart_param(new_parameter(file, key: 'file') .is_required(true) .default_content_type('application/octet-stream')) .form_param(new_parameter(export_format, key: 'export_format') .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .additional_query_params(_query_parameters) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Transformation.method(:from_hash)) .is_api_response(true)) .execute end |
#transform_via_url(body) ⇒ ApiResponse
Transform an API into any of the supported API specification formats by providing the URL of the API specification file. This endpoint transforms and then uploads the transformed API specification to APIMatic's cloud storage. An ID for the transformation performed is returned as part of the response.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/apimatic_api/controllers/transformation_controller.rb', line 55 def transform_via_url(body) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/transformations/transform-via-url', Server::DEFAULT) .header_param(new_parameter('application/vnd.apimatic.urlTransformDto.v1+json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('Authorization'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Transformation.method(:from_hash)) .is_api_response(true)) .execute end |