class Nexmo::OAS::Renderer::Presenters::ResponseTab::Panel

Attributes

index[R]

Public Class Methods

new(schema:, index:, format:, content:, endpoint:, theme_light: nil) click to toggle source
# File lib/nexmo/oas/renderer/presenters/response_tab/panel.rb, line 11
def initialize(schema:, index:, format:, content:, endpoint:, theme_light: nil) # rubocop:disable Metrics/ParameterLists
  @schema  = schema
  @index   = index
  @format  = format
  @content = content
  @endpoint = endpoint
  @theme_light = theme_light
end

Public Instance Methods

content() click to toggle source
# File lib/nexmo/oas/renderer/presenters/response_tab/panel.rb, line 26
def content
  if @content.is_a?(Nexmo::OAS::Renderer::Presenters::ContentSwitcher)
    return @content.render
  end

  if @content == :responses
    Nexmo::OAS::Renderer::ResponseParserDecorator
      .new(@schema)
      .html(@format, xml_options: @schema['xml'], theme_light: @theme_light)
  else
    [:'open_api/_response_fields', locals: {
      schema: @schema,
      index: @index,
      format: @format,
      endpoint: @endpoint,
    }]
  end
end
css_classes() click to toggle source
# File lib/nexmo/oas/renderer/presenters/response_tab/panel.rb, line 20
def css_classes
  classes = ['Vlt-tabs__panel']
  classes << 'Vlt-tabs__panel_active' if @index.zero?
  classes.join(' ')
end