Class: DoctorSwagger::PostBody

Inherits:
PostParameter show all
Defined in:
lib/doctor_swagger/post_body.rb

Constant Summary

Constants inherited from Parameter

DoctorSwagger::Parameter::ALLOWED_TYPES

Instance Method Summary collapse

Methods inherited from PostParameter

#param_type

Methods inherited from Parameter

#allow_multiple!, #allowable_values, #allowable_values_as_json, #description, #required!, #type

Constructor Details

#initialize(&block) ⇒ PostBody

Returns a new instance of PostBody.


3
4
5
# File 'lib/doctor_swagger/post_body.rb', line 3

def initialize(&block)
  super(:body, &block)
end

Instance Method Details

#as_jsonObject


11
12
13
14
15
16
17
# File 'lib/doctor_swagger/post_body.rb', line 11

def as_json(*)
  if @example && !@example.empty?
    super.merge('example' => @example)
  else
    super
  end
end

#example(example) ⇒ Object


7
8
9
# File 'lib/doctor_swagger/post_body.rb', line 7

def example(example)
  @example = example
end