Module: Jets::Controller::Params

Included in:
Base
Defined in:
lib/jets/controller/params.rb

Instance Method Summary collapse

Instance Method Details

#params(raw = false) ⇒ Object

Merge all the parameters together for convenience. Users still have access via events.

Precedence:

1. path parameters have highest precdence
2. query string parameters
3. body parameters


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jets/controller/params.rb', line 12

def params(raw=false)
  query_string_params = event["queryStringParameters"] || {}
  path_params = event["pathParameters"] || {}
  params = body_params
            .deep_merge(query_string_params)
            .deep_merge(path_params)
  if raw
    params
  else
    ActionController::Parameters.new(params)
  end
end