class Nexmo::OAS::Renderer::Presenters::OpenApiSpecification

Attributes

definition_name[R]

Public Class Methods

new(definition_name:, expand_responses:) click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 22
def initialize(definition_name:, expand_responses:)
  @definition_name  = definition_name
  @expand_responses = expand_responses
  @versions         = Versions.new(definition_name)
  @groups           = Groups.new(definition)
end

Public Instance Methods

auto_expand_responses() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 45
def auto_expand_responses
  @expand_responses
end
definition() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 41
def definition
  @definition ||= OpenApiDefinitionResolver.find(@definition_name)
end
definition_errors() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 33
def definition_errors
  return unless errors?

  @definition_errors ||= Nexmo::Markdown::Renderer.new.call(
    File.read("#{API.oas_path}/../../errors/#{@definition_name}.md")
  )
end
errors?() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 29
def errors?
  File.exist?("#{API.oas_path}/../../errors/#{@definition_name}.md")
end
formats() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 49
def formats
  @formats ||= ResponseFormat.to_dropdown(endpoints.flat_map(&:formats).uniq)
end

Private Instance Methods

endpoints() click to toggle source
# File lib/nexmo/oas/renderer/presenters/open_api_specification.rb, line 55
def endpoints
  @endpoints ||= definition.endpoints.map { |e| Endpoint.new(e) }
end