Sha256: 938a69d6ddb54dd9178e0c6cde87275840f35b8336084811c2ddd3ba604fb246

Contents?: true

Size: 997 Bytes

Versions: 6

Compression:

Stored size: 997 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
panoptes-client-1.0.0.pre1 lib/panoptes/client/project_preferences.rb
panoptes-client-1.0.0.pre lib/panoptes/client/project_preferences.rb
panoptes-client-0.4.0 lib/panoptes/client/project_preferences.rb
panoptes-client-0.3.8 lib/panoptes/client/project_preferences.rb
panoptes-client-0.3.7 lib/panoptes/client/project_preferences.rb
panoptes-client-0.3.6 lib/panoptes/client/project_preferences.rb