Class: Swaggard::Swagger::Response::ResponseModel
- Inherits:
-
Object
- Object
- Swaggard::Swagger::Response::ResponseModel
- Defined in:
- lib/swaggard/swagger/response.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#response_class ⇒ Object
Returns the value of attribute response_class.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
84 85 86 |
# File 'lib/swaggard/swagger/response.rb', line 84 def id @id end |
#response_class ⇒ Object
Returns the value of attribute response_class.
84 85 86 |
# File 'lib/swaggard/swagger/response.rb', line 84 def response_class @response_class end |
Instance Method Details
#parse(value) ⇒ Object
86 87 88 89 90 91 92 93 |
# File 'lib/swaggard/swagger/response.rb', line 86 def parse(value) @is_array_response = value =~ /Array/ @response_class = if @is_array_response value.match(/^Array<(.*)>$/)[1] else value end end |
#response_class_type ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/swaggard/swagger/response.rb', line 106 def response_class_type if PRIMITIVE_TYPES.include?(@response_class) { 'type' => @response_class } else { '$ref' => "#/components/schemas/#{Swaggard.ref_name(@response_class)}" } end end |
#to_doc ⇒ Object
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/swaggard/swagger/response.rb', line 95 def to_doc if @is_array_response { 'type' => 'array', 'items' => response_class_type } else response_class_type end end |