Class: Respect::Rails::ResponseDef
- Inherits:
-
Object
- Object
- Respect::Rails::ResponseDef
- Defined in:
- lib/respect/rails/response_def.rb
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Object) body(options = {}, &block)
Define the schema of the response body.
-
- (Object) documentation(text)
Set the documentation to
text
. - - (Object) eval(&block)
- - (Object) headers(options = {}, &block)
-
- (ResponseDef) initialize(*args)
constructor
A new instance of ResponseDef.
Constructor Details
- (ResponseDef) initialize(*args)
A new instance of ResponseDef
11 12 13 |
# File 'lib/respect/rails/response_def.rb', line 11 def initialize(*args) @response_schema = ResponseSchema.new(*args) end |
Class Method Details
+ (Object) eval(*args, &block)
6 7 8 |
# File 'lib/respect/rails/response_def.rb', line 6 def eval(*args, &block) new(*args).eval(&block) end |
Instance Method Details
- (Object) body(options = {}, &block)
Define the schema of the response body.
22 23 24 25 26 27 28 29 30 |
# File 'lib/respect/rails/response_def.rb', line 22 def body( = {}, &block) @response_schema.body = ( if .fetch(:hash, true) HashSchema.define(&block) else Schema.define(&block) end ) end |
- (Object) documentation(text)
Set the documentation to text
.
37 38 39 |
# File 'lib/respect/rails/response_def.rb', line 37 def documentation(text) @response_schema.documentation = text end |
- (Object) eval(&block)
15 16 17 18 |
# File 'lib/respect/rails/response_def.rb', line 15 def eval(&block) block.call(self) @response_schema end |
- (Object) headers(options = {}, &block)
32 33 34 |
# File 'lib/respect/rails/response_def.rb', line 32 def headers( = {}, &block) @response_schema.headers = HashSchema.define(, &block) end |