Class: Gitlab::GrapeOpenapi::Models::RequestBody::Parameters

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/grape_openapi/models/request_body/parameters.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route:, params:) ⇒ Parameters

Returns a new instance of Parameters.



10
11
12
13
# File 'lib/gitlab/grape_openapi/models/request_body/parameters.rb', line 10

def initialize(route:, params:)
  @route = route
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/gitlab/grape_openapi/models/request_body/parameters.rb', line 8

def params
  @params
end

#routeObject (readonly)

Returns the value of attribute route.



8
9
10
# File 'lib/gitlab/grape_openapi/models/request_body/parameters.rb', line 8

def route
  @route
end

Instance Method Details

#extractObject



15
16
17
18
19
20
21
# File 'lib/gitlab/grape_openapi/models/request_body/parameters.rb', line 15

def extract
  body_params = params.reject do |key, _|
    path_with_params.include?("{#{key}}")
  end

  restructure_nested_params(body_params)
end