Class: GrapeSwagger::RequestParamParsers::Body
- Inherits:
-
Object
- Object
- GrapeSwagger::RequestParamParsers::Body
- Defined in:
- lib/grape-swagger/request_param_parsers/body.rb
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#route ⇒ Object
readonly
Returns the value of attribute route.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(_route, params, settings, endpoint) ⇒ Body
constructor
A new instance of Body.
- #parse ⇒ Object
Constructor Details
#initialize(_route, params, settings, endpoint) ⇒ Body
Returns a new instance of Body.
12 13 14 15 16 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 12 def initialize(_route, params, settings, endpoint) @params = params @settings = settings @endpoint = endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 6 def endpoint @endpoint end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 6 def params @params end |
#route ⇒ Object (readonly)
Returns the value of attribute route.
6 7 8 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 6 def route @route end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
6 7 8 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 6 def settings @settings end |
Class Method Details
.parse(route, params, settings, endpoint) ⇒ Object
8 9 10 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 8 def self.parse(route, params, settings, endpoint) new(route, params, settings, endpoint).parse end |
Instance Method Details
#parse ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/grape-swagger/request_param_parsers/body.rb', line 18 def parse public_params.each_with_object({}) do |(name, ), memo| name = name.to_s param_type = [:type]&.to_s if array_param?(param_type) [:is_array] = true name += '[]' if array_use_braces? end memo[name] = end end |