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.



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

def definitions
  @definitions
end

Class Method Details

.can_be_moved?(params, http_verb) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 9

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

.to_definition(path, params, route, definitions) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 13

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

  params_to_move = movable_params(params)

  return (params + correct_array_param(params_to_move)) if should_correct_array?(params_to_move)

  params << parent_definition_of_params(params_to_move, path, route)

  params
end