Sha256: b6bc7efbdfe2989f352df5108ac6762977524d125613a735840b8df3eb921c63

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Cellect
  module Server
    class API
      class Users < Grape::API
        resources :users do
          segment '/:user_id' do
            # PUT /workflows/:workflow_id/users/:user_id/add_seen
            # 
            # Adds a subject to a user's seen set for a workflow
            # Accepts params
            #   subject_id: integer, required
            put :add_seen do
              user_id = param_to_int :user_id
              subject_id = param_to_int :subject_id
              
              if user_id && user_id > 0 && subject_id && subject_id > 0
                workflow.async.add_seen_for user_id, subject_id
              end
              
              nil
            end
            
            # POST /workflows/:workflow_id/users/:user_id/load
            # 
            # Preloads a user for a workflow
            post :load do
              user_id = param_to_int :user_id
              
              if user_id && user_id > 0
                workflow.async.user user_id
              end
              
              nil
            end
          end
        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/users.rb