Class: GrapeSwagger::DocMethods::MoveParams

Inherits:
Object
  • Object
show all
Defined in:
lib/grape-swagger/doc_methods/move_params.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.definitionsObject

Returns the value of attribute definitions.



5
6
7
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 5

def definitions
  @definitions
end

Class Method Details

.can_be_moved?(params, http_verb) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 7

def can_be_moved?(params, http_verb)
  move_methods.include?(http_verb) && includes_body_param?(params)
end

.to_definition(params, route, definitions) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 11

def to_definition(params, route, definitions)
  @definitions = definitions
  unify!(params)

  params_to_move = movable_params(params)
  params << parent_definition_of_params(params_to_move, route)

  params
end