Class: Swaggard::Swagger::Parameters::Body
- Defined in:
- lib/swaggard/swagger/parameters/body.rb
Defined Under Namespace
Classes: Property
Instance Attribute Summary collapse
-
#content_type ⇒ Object
writeonly
Sets the attribute content_type.
-
#definition ⇒ Object
Returns the value of attribute definition.
Attributes inherited from Base
#description, #is_required, #name
Instance Method Summary collapse
- #add_property(string) ⇒ Object
- #description=(description) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(operation_name) ⇒ Body
constructor
A new instance of Body.
- #title=(title) ⇒ Object
- #to_request_body ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(operation_name) ⇒ Body
Returns a new instance of Body.
12 13 14 15 16 17 18 19 20 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 12 def initialize(operation_name) @in = 'body' @name = 'body' @is_required = false @description = '' @content_type = 'application/json' @definition = Definition.new("#{operation_name}_body") @definition_id = @definition.id end |
Instance Attribute Details
#content_type=(value) ⇒ Object (writeonly)
Sets the attribute content_type
10 11 12 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 10 def content_type=(value) @content_type = value end |
#definition ⇒ Object
Returns the value of attribute definition.
8 9 10 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 8 def definition @definition end |
Instance Method Details
#add_property(string) ⇒ Object
22 23 24 25 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 22 def add_property(string) property = Property.new(string) @definition.add_property(property) end |
#description=(description) ⇒ Object
42 43 44 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 42 def description=(description) @definition.description = description end |
#empty? ⇒ Boolean
27 28 29 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 27 def empty? @definition.empty? && @definition_id == @definition.id end |
#title=(title) ⇒ Object
46 47 48 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 46 def title=(title) @definition.title = title end |