Class: RubyAPI::OpenAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyapi/openapi.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ OpenAPI

Returns a new instance of OpenAPI.



5
6
7
# File 'lib/rubyapi/openapi.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#generateObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubyapi/openapi.rb', line 9

def generate
  {
    openapi: "3.0.0",
    info: {
      title: "RubyAPI App",
      version: "0.1.0"
    },
    paths: generate_paths
  }
end

#to_jsonObject



20
21
22
# File 'lib/rubyapi/openapi.rb', line 20

def to_json
  JSON.pretty_generate(generate)
end