Response
Defines body for a response.
Returns Contract::Object via body.
Instance Methods
#body
#body(&block)
Defines the response body for this response.
Returns
Yields Contract::Object
Example: instance_eval style
ruby
body do
integer :id
string :title
decimal :amount
endExample: yield style
ruby
body do |body|
body.integer :id
body.string :title
body.decimal :amount
end#description
#description(value = nil)
The description for this response.
Metadata included in exports.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
value | String, nil | nil | The description. |
Returns
String, nil
Example
ruby
action :show do
response do
description 'Returns the invoice'
end
end#no_content!
#no_content!
Declares this response as 204 No Content.
Use for actions that don't return a response body, like DELETE or actions that only perform side effects.
Returns
void
Example
ruby
action :destroy do
response { no_content! }
endExample: Archive action
ruby
action :archive do
response { no_content! }
end#no_content?
#no_content?
Whether this response has no content.
Returns
Boolean