Class: OasRails::Spec::Info
- Inherits:
-
Object
- Object
- OasRails::Spec::Info
- Includes:
- Specable
- Defined in:
- lib/oas_rails/spec/info.rb
Instance Attribute Summary collapse
-
#contact ⇒ Object
Returns the value of attribute contact.
-
#description ⇒ Object
Returns the value of attribute description.
-
#license ⇒ Object
Returns the value of attribute license.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#terms_of_service ⇒ Object
Returns the value of attribute terms_of_service.
-
#title ⇒ Object
Returns the value of attribute title.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #default_description ⇒ Object
- #default_summary ⇒ Object
- #default_title ⇒ Object
-
#initialize(**kwargs) ⇒ Info
constructor
A new instance of Info.
- #oas_fields ⇒ Object
Methods included from Specable
Constructor Details
#initialize(**kwargs) ⇒ Info
Returns a new instance of Info.
7 8 9 10 11 12 13 14 15 |
# File 'lib/oas_rails/spec/info.rb', line 7 def initialize(**kwargs) @title = kwargs[:title] || default_title @summary = kwargs[:summary] || default_summary @description = kwargs[:description] || default_description @terms_of_service = kwargs[:terms_of_service] || '' @contact = Spec::Contact.new @license = Spec::License.new @version = kwargs[:version] || '0.0.1' end |
Instance Attribute Details
#contact ⇒ Object
Returns the value of attribute contact.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def contact @contact end |
#description ⇒ Object
Returns the value of attribute description.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def description @description end |
#license ⇒ Object
Returns the value of attribute license.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def license @license end |
#summary ⇒ Object
Returns the value of attribute summary.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def summary @summary end |
#terms_of_service ⇒ Object
Returns the value of attribute terms_of_service.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def terms_of_service @terms_of_service end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def title @title end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/oas_rails/spec/info.rb', line 5 def version @version end |
Instance Method Details
#default_description ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/oas_rails/spec/info.rb', line 29 def default_description "# Welcome to OasRails OasRails automatically generates interactive documentation for your Rails APIs using the OpenAPI Specification 3.1 (OAS 3.1) and displays it with a nice UI. ## Getting Started You've successfully mounted the OasRails engine. This default documentation is based on your routes and automatically gathered information. ## Enhancing Your Documentation To customize and enrich your API documentation: 1. Generate an initializer file: ``` rails generate oas_rails:config ``` 2. Edit the created `config/initializers/oas_rails.rb` file to override default settings and add project-specific information. 3. Use Yard tags in your controller methods to provide detailed API endpoint descriptions. ## Features - Automatic OAS 3.1 document generation - [RapiDoc](https://github.com/rapi-doc/RapiDoc) integration for interactive exploration - Minimal setup required for basic documentation - Extensible through configuration and Yard tags Explore your API documentation and enjoy the power of OasRails! For more information and advanced usage, visit the [OasRails GitHub repository](https://github.com/a-chacon/oas_rails). " end |
#default_summary ⇒ Object
25 26 27 |
# File 'lib/oas_rails/spec/info.rb', line 25 def default_summary "OasRails: Automatic Interactive API Documentation for Rails" end |
#default_title ⇒ Object
21 22 23 |
# File 'lib/oas_rails/spec/info.rb', line 21 def default_title "OasRails #{VERSION}" end |
#oas_fields ⇒ Object
17 18 19 |
# File 'lib/oas_rails/spec/info.rb', line 17 def oas_fields [:title, :summary, :description, :terms_of_service, :contact, :license, :version] end |