Class: Swaggard::Swagger::Parameters::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/swaggard/swagger/parameters/base.rb

Direct Known Subclasses

Body, Form, List, Path, Query

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/swaggard/swagger/parameters/base.rb', line 6

def description
  @description
end

#is_required=(value) ⇒ Object (writeonly)

Sets the attribute is_required

Parameters:

  • value

    the value to set the attribute is_required to.



7
8
9
# File 'lib/swaggard/swagger/parameters/base.rb', line 7

def is_required=(value)
  @is_required = value
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/swaggard/swagger/parameters/base.rb', line 6

def name
  @name
end

Instance Method Details

#to_docObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/swaggard/swagger/parameters/base.rb', line 9

def to_doc
  doc = {
    'name'        => @name,
    'in'          => @in,
    'required'    => @is_required,
    'description' => description
  }
  doc['schema'] = { 'type' => @data_type } if @data_type
  doc
end