Class: Workarea::Api::Admin::SwaggerController

Inherits:
ApplicationController show all
Includes:
Swagger::Blocks
Defined in:
app/controllers/workarea/api/admin/swagger_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #sort_direction, #sort_field

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/workarea/api/admin/swagger_controller.rb', line 7

def index
  controller = self
  self.class.send(:swagger_root) do
    key :swagger, '2.0'

    info do
      key :version, '1.0.0'
      key :title, 'Workarea Admin'
      key :description, 'A backend API for integrating and configuring Workarea'
      key :termsOfService, 'https://workarea.com'
      contact do
        key :name, 'Workarea Product Team'
      end
    end

    key :host, Workarea.config.host
    key :basePath, controller.root_path[0..-2]
    key :schemes, [Rails.application.config.force_ssl ? 'https' : 'http']
    key :consumes, ['application/json']
    key :produces, ['application/json']

    security_definition :BasicAuth do
      key :type, :basic
    end
    security do
      key :BasicAuth, []
    end
  end

  render json: ::Swagger::Blocks.build_root_json(Swagger.klasses)
end