Sha256: 17f52bf66b3ddf84ecdd2803566b56607cd3c9a28c30767af7130a8a66dff2f3

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

require "json"

module InstaSwag
  class DocumentationApp

    attr_reader :klass, :settings, :docs_klass

    def initialize(klass, settings)
      @klass, @settings = klass, settings
      @docs_klass       = Class.new(Grape::API)
      set_swagger
    end

    def set_swagger
      docs_klass.mount klass
      docs_klass.add_swagger_documentation(
        api_version: klass.version,
        mount_path:  MOUNT_PATH,
        hide_documentation_path: settings[:hide_documentation_path],
        base_path: settings[:prefix]
        )
    end

    def self.create(klass, settings)
      app = new(klass, settings)
      ->(env) { run app.docs_klass }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
insta_swag-0.1.1 lib/insta_swag/documentation_app.rb