Class: Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::Endpoint::ResponseDefinitionsFormatter
- Inherits:
-
AbstractFormatter
- Object
- AbstractFormatter
- Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::Endpoint::ResponseDefinitionsFormatter
- Includes:
- Helper
- Defined in:
- lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint/response_definitions_formatter.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(endpoint) ⇒ ResponseDefinitionsFormatter
constructor
A new instance of ResponseDefinitionsFormatter.
Methods included from Helper
#format_http_method, #format_sentence, #format_tag_name, #presenter_title, #type_and_format, #uncapitalize
Methods inherited from AbstractFormatter
Methods included from Concerns::Optional
Constructor Details
#initialize(endpoint) ⇒ ResponseDefinitionsFormatter
Returns a new instance of ResponseDefinitionsFormatter.
22 23 24 25 26 27 28 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint/response_definitions_formatter.rb', line 22 def initialize(endpoint) @endpoint = endpoint @http_method = format_http_method(endpoint) @presenter = endpoint.presenter @model_name = presenter ? presenter_title(presenter) : "object" @output = ActiveSupport::HashWithIndifferentAccess.new end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
20 21 22 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint/response_definitions_formatter.rb', line 20 def output @output end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint/response_definitions_formatter.rb', line 30 def call if endpoint.custom_response_configuration_tree.present? format_custom_response! elsif http_method == 'delete' format_delete_response! else format_schema_response! end format_error_responses! output end |