Sha256: 87d680e6c7c5aaaaeb6d52a2b9cb965ec8456cbd1cee74fc857236cf1afc047f

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module Panoptes
  class Client
    module ProjectPreferences
      def project_preferences(id)
        response = panoptes.get("project_preferences/#{id}")
        response.fetch('project_preferences').first
      end

      def user_project_preferences(user_id, project_id)
        response = panoptes.get('project_preferences',
                                user_id: user_id,
                                project_id: project_id)
        response.fetch('project_preferences').first
      end

      def promote_user_to_workflow(user_id, project_id, workflow_id)
        id = panoptes.get('project_preferences',
                          user_id: user_id,
                          project_id: project_id).fetch('project_preferences').first['id']

        response = panoptes.connection.get("/api/project_preferences/#{id}")
        etag = response.headers['ETag']

        panoptes.put("project_preferences/#{id}", {
                       project_preferences: { settings: { workflow_id: workflow_id } }
                     }, etag: etag)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
panoptes-client-1.2.0 lib/panoptes/client/project_preferences.rb
panoptes-client-1.1.1 lib/panoptes/client/project_preferences.rb
panoptes-client-1.1.0 lib/panoptes/client/project_preferences.rb
panoptes-client-1.0.0 lib/panoptes/client/project_preferences.rb