Class: WeakSwaggerParameters::Definitions::Parameter

Inherits:
Object
  • Object
show all
Includes:
LeafDefinition
Defined in:
lib/weak_swagger_parameters/definitions/parameter.rb

Instance Method Summary collapse

Methods included from LeafDefinition

#apply_validations

Constructor Details

#initialize(location, type, name, description, options = {}) ⇒ Parameter

Returns a new instance of Parameter.



8
9
10
# File 'lib/weak_swagger_parameters/definitions/parameter.rb', line 8

def initialize(location, type, name, description, options = {})
  @options = options.merge(location: location, type: type, name: name, description: description)
end

Instance Method Details

#apply_docs(parent_node) ⇒ Object



12
13
14
15
16
# File 'lib/weak_swagger_parameters/definitions/parameter.rb', line 12

def apply_docs(parent_node)
  parameter_options = WeakSwaggerParameters::Services::SwaggerOptionsAdapter.adapt(@options)

  parent_node.instance_eval { parameter parameter_options }
end