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.



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

def definitions
  @definitions
end

Class Method Details

.can_be_moved?(http_verb, params) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/grape-swagger/doc_methods/move_params.rb', line 11

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

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



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

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