Class: Swaggard::Swagger::Parameters::Body::Property
- Inherits:
-
Object
- Object
- Swaggard::Swagger::Parameters::Body::Property
- Defined in:
- lib/swaggard/swagger/parameters/body.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(string) ⇒ Property
constructor
A new instance of Property.
-
#parse(string) ⇒ Object
Example: [Array] status Filter by status.
- #to_doc ⇒ Object
Constructor Details
#initialize(string) ⇒ Property
Returns a new instance of Property.
41 42 43 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 41 def initialize(string) parse(string) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
39 40 41 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 39 def id @id end |
Instance Method Details
#parse(string) ⇒ Object
Example: [Array] status Filter by status. (e.g. status[]=1&status=2&status[]=3) Example: [Array] status(required) Filter by status. (e.g. status[]=1&status=2&status[]=3) Example: [Integer] media ID of the desired media type.
54 55 56 57 58 59 60 61 62 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 54 def parse(string) data_type, name, description = string.split data_type.gsub!('[', '').gsub!(']', '') @id = name @description = description @type = Type.new([data_type]) end |
#to_doc ⇒ Object
45 46 47 48 49 |
# File 'lib/swaggard/swagger/parameters/body.rb', line 45 def to_doc result = @type.to_doc result['description'] = @description if @description result end |