Class: Apigen::Rest::Input
- Inherits:
-
Object
- Object
- Apigen::Rest::Input
- Defined in:
- lib/apigen/rest/input.rb
Overview
Input is the request body expected by an API endpoint.
Instance Method Summary collapse
-
#initialize ⇒ Input
constructor
A new instance of Input.
- #to_s ⇒ Object
-
#type(type = nil, &block) ⇒ Object
Declares the input type.
- #validate(model_registry) ⇒ Object
Constructor Details
#initialize ⇒ Input
Returns a new instance of Input.
11 12 13 14 |
# File 'lib/apigen/rest/input.rb', line 11 def initialize @type = nil @description = nil end |
Instance Method Details
#to_s ⇒ Object
28 29 30 |
# File 'lib/apigen/rest/input.rb', line 28 def to_s @type.to_s end |
#type(type = nil, &block) ⇒ Object
Declares the input type.
18 19 20 21 |
# File 'lib/apigen/rest/input.rb', line 18 def type(type = nil, &block) return @type unless type @type = Apigen::Model.type type, &block end |
#validate(model_registry) ⇒ Object
23 24 25 26 |
# File 'lib/apigen/rest/input.rb', line 23 def validate(model_registry) validate_properties model_registry.check_type @type end |