Class: Apress::Documentation::SwaggerJsonBuilder

Inherits:
Object
  • Object
show all
Defined in:
app/services/apress/documentation/swagger_json_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(module_name) ⇒ SwaggerJsonBuilder

Returns a new instance of SwaggerJsonBuilder.



4
5
6
# File 'app/services/apress/documentation/swagger_json_builder.rb', line 4

def initialize(module_name)
  @module_name = module_name
end

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/services/apress/documentation/swagger_json_builder.rb', line 8

def call
  classes =
    if @module_name
      Apress::Documentation::Swagger::Schema.swagger_classes.select do |klass|
        klass.document_slug.to_s == @module_name.to_s || !klass.resource
      end
    else
      Apress::Documentation::Swagger::Schema.swagger_classes
    end

  ::Swagger::Blocks.build_root_json(classes)
end