Sha256: 457ce9d960e103bac1d6c71a4a497021ac8ac758d6b7e7c07cda2cd3caa736bc
Contents?: true
Size: 1010 Bytes
Versions: 1
Compression:
Stored size: 1010 Bytes
Contents
module Cellect module Server class API module Helpers def workflow @workflow ||= Workflow[params[:workflow_id]] end def selector_params { limit: param_to_int(:limit, default: 5), user_id: param_to_int(:user_id), group_id: param_to_int(:group_id) } end def update_params { subject_id: param_to_int(:subject_id), group_id: param_to_int(:group_id), priority: param_to_float(:priority) } end def param_to_int(param, default: nil) _param_to param, :to_i, default end def param_to_float(param, default: nil) _param_to param, :to_f, default end def _param_to(param, conversion, default) val = params[param].try conversion params[param] && val && val > 0 ? val : default end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cellect-server-0.1.3 | lib/cellect/server/api/helpers.rb |