Sha256: b05cbbaebb5fb9a797a46285b9d7cb1d7bbb468e87281379e41300585ea3207b

Contents?: true

Size: 688 Bytes

Versions: 4

Compression:

Stored size: 688 Bytes

Contents

require_dependency 'apidoco/application_controller'

module Apidoco
  class ApisController < ApplicationController
    before_action :set_version_parser

    http_basic_authenticate_with name: Apidoco.auth_name, password: Apidoco.auth_password,
                                 if: proc { Apidoco.auth_name && Apidoco.auth_password }

    def index
      redirect_to api_path(id: @vp.documentations.first.name)
    end

    def show
      @documentation = @vp.documentation(params[:id])
      @data = @documentation.as_json
    rescue Apidoco::FileParseError => e
      render plain: e.info
    end

    private

    def set_version_parser
      @vp = VersionParser.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
apidoco-1.6.4 app/controllers/apidoco/apis_controller.rb
apidoco-1.6.3 app/controllers/apidoco/apis_controller.rb
apidoco-1.6.2 app/controllers/apidoco/apis_controller.rb
apidoco-1.6.1 app/controllers/apidoco/apis_controller.rb