Info
Block context for defining API metadata.
Used within the info block in API::Base.
Modules
Instance Methods
#contact
#contact(&block)
The API contact.
Returns
Contact, nil
Yields Contact
Example: instance_eval style
contact do
name 'Support'
email 'support@example.com'
endExample: yield style
contact do |contact|
contact.name 'Support'
contact.email 'support@example.com'
end#deprecated!
#deprecated!
Marks the API as deprecated.
Returns
void
Example
info do
deprecated!
end#deprecated?
#deprecated?
Whether the API is deprecated.
Returns
Boolean
#description
#description(value = nil)
The API description.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The description. |
Returns
String, nil
Example
description 'Full-featured API for managing invoices and payments.'
info.description # => "Full-featured..."#license
#license(&block)
The API license.
Returns
License, nil
Yields License
Example: instance_eval style
license do
name 'MIT'
url 'https://opensource.org/licenses/MIT'
endExample: yield style
license do |license|
license.name 'MIT'
license.url 'https://opensource.org/licenses/MIT'
end#server
#server(&block)
Defines a server for the API.
Can be called multiple times.
Returns
Array<Server>
Yields Server
Example: instance_eval style
server do
url 'https://api.example.com'
description 'Production'
endExample: yield style
server do |server|
server.url 'https://api.example.com'
server.description 'Production'
end#summary
#summary(value = nil)
The API summary.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The summary. |
Returns
String, nil
Example
summary 'Invoice management API'
info.summary # => "Invoice management API"#tags
#tags(*values)
The API tags.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
values | Array<String> | The tags. |
Returns
Array<String>
Example
tags 'invoices', 'payments'
info.tags # => ["invoices", "payments"]#terms_of_service
#terms_of_service(value = nil)
The API terms of service.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The URL to terms of service. |
Returns
String, nil
Example
terms_of_service 'https://example.com/terms'
info.terms_of_service # => "https://example.com/terms"#title
#title(value = nil)
The API title.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The title. |
Returns
String, nil
Example
title 'Invoice API'
info.title # => "Invoice API"#version
#version(value = nil)
The API version.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The version. |
Returns
String, nil
Example
version '1.0.0'
info.version # => "1.0.0"