class Brainstem::ApiDocs::Formatters::OpenApiSpecification::Version2::EndpointCollectionFormatter
Attributes
endpoint_collection[RW]
output[RW]
Public Class Methods
new(endpoint_collection, options = {})
click to toggle source
Calls superclass method
Brainstem::ApiDocs::Formatters::AbstractFormatter::new
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint_collection_formatter.rb, line 16 def initialize(endpoint_collection, options = {}) self.endpoint_collection = endpoint_collection self.output = {} super options end
Public Instance Methods
call()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint_collection_formatter.rb, line 23 def call format_endpoints! end
Private Instance Methods
documentable_endpoints()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint_collection_formatter.rb, line 31 def documentable_endpoints endpoint_collection .only_documentable end
format_endpoints!()
click to toggle source
# File lib/brainstem/api_docs/formatters/open_api_specification/version_2/endpoint_collection_formatter.rb, line 36 def format_endpoints! documentable_endpoints.each do |endpoint| formatted_endpoint = endpoint.formatted_as(:oas_v2) next if formatted_endpoint.blank? if (common_keys = output.keys & formatted_endpoint.keys).present? common_keys.each do |key| output[key].merge!(formatted_endpoint[key]) end else output.merge!(formatted_endpoint) end end output end