Class: Apipie::Generator::Swagger::MethodDescription::ApiSchemaService
- Inherits:
-
Object
- Object
- Apipie::Generator::Swagger::MethodDescription::ApiSchemaService
- Defined in:
- lib/apipie/generator/swagger/method_description/api_schema_service.rb
Instance Method Summary collapse
- #call ⇒ Hash
-
#initialize(method_description, language: nil) ⇒ ApiSchemaService
constructor
A new instance of ApiSchemaService.
Constructor Details
#initialize(method_description, language: nil) ⇒ ApiSchemaService
Returns a new instance of ApiSchemaService.
3 4 5 6 |
# File 'lib/apipie/generator/swagger/method_description/api_schema_service.rb', line 3 def initialize(method_description, language: nil) @method_description = method_description @language = language end |
Instance Method Details
#call ⇒ Hash
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/apipie/generator/swagger/method_description/api_schema_service.rb', line 9 def call @method_description.apis.each_with_object({}) do |api, paths| api = Apipie::Generator::Swagger::MethodDescription::ApiDecorator.new(api) path = Apipie::Generator::Swagger::PathDecorator.new(api.path) op_id = Apipie::Generator::Swagger::OperationId.from(api).to_s if Apipie.configuration.generator.swagger.generate_x_computed_id_field? Apipie::Generator::Swagger::ComputedInterfaceId.instance.add!(op_id) end parameters = Apipie::Generator::Swagger::MethodDescription::ParametersService .new(@method_description, path: path, http_method: api.normalized_http_method) .call paths[path.swagger_path(@method_description)] ||= {} paths[path.swagger_path(@method_description)][api.normalized_http_method] = { tags: , consumes: consumes, operationId: op_id, summary: api.summary(method_description: @method_description, language: @language), parameters: parameters, responses: responses(api), description: Apipie.app.translate(@method_description.full_description, @language) }.compact end end |