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