Class: ActionSpec::OpenApi::Document
- Inherits:
-
Object
- Object
- ActionSpec::OpenApi::Document
- Defined in:
- lib/action_spec/open_api/document.rb
Constant Summary collapse
- OPENAPI_VERSION =
"3.2.0"
Instance Method Summary collapse
- #build(paths:) ⇒ Object
-
#initialize(title:, version:, server_url: nil) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(title:, version:, server_url: nil) ⇒ Document
Returns a new instance of Document.
8 9 10 11 12 |
# File 'lib/action_spec/open_api/document.rb', line 8 def initialize(title:, version:, server_url: nil) @title = title @version = version @server_url = server_url end |
Instance Method Details
#build(paths:) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/action_spec/open_api/document.rb', line 14 def build(paths:) { "openapi" => OPENAPI_VERSION, "info" => { "title" => title, "version" => version }, "paths" => paths }.tap do |document| document["servers"] = [{ "url" => server_url }] if server_url.present? end end |