Sha256: 379ccc6259884bbf9444f6cfabf9dc4742e1dc0b5ebd8ca8fff47c4db204a272

Contents?: true

Size: 633 Bytes

Versions: 61

Compression:

Stored size: 633 Bytes

Contents

module MobileWorkflow
  module ParamParser
    def mw_rewrite_payload_properties(model:, properties:)
      properties.each {|property| mw_rewrite_payload_property(model: model, model_property: property, params_property: property)}
    end

    def mw_rewrite_payload_property(model:, model_property:, params_property:)
      params[model][model_property] = params.dig(:payload, params_property, :answer)
    end

    def mw_rewrite_payload_array(model:, model_property:, params_property:)
      answer = params.dig(:payload, params_property, :answer)
      params[model][model_property] = answer[0] if answer
    end    
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
mobile_workflow-0.2.0 app/controllers/concerns/mobile_workflow/param_parser.rb