Sha256: 71a3f926f61fb15ecbb03aa7087e8b019783e446bffbbd11bbec0776923034cb

Contents?: true

Size: 1004 Bytes

Versions: 9

Compression:

Stored size: 1004 Bytes

Contents

module Panoptes
  class Client
    module Subjects
      # Get list of subjects
      #
      # @param subject_set_id [Integer] filter by subject set
      # @return list of subjects
      def subjects(subject_set_id:)
        query = {}
        query[:subject_set_id] = subject_set_id

        response = panoptes.get("/subjects", query)
        response.fetch("subjects")
      end

      # Retire a subject for a workflow
      #
      # @todo Add this endpoint to the Apiary docs and add a see-reference here.
      # @param workflow_id [Integer] the ID of a workflow
      # @param subject_id  [Integer] the ID of a subject associated with that workflow (through one of the assigned subject_sets)
      # @return nothing
      def retire_subject(workflow_id, subject_id, reason: nil)
        panoptes.post("/workflows/#{workflow_id}/retired_subjects", {
          admin: true,
          subject_id: subject_id,
          retirement_reason: reason
        })
        true
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
panoptes-client-0.3.2 lib/panoptes/client/subjects.rb
panoptes-client-0.3.1 lib/panoptes/client/subjects.rb
panoptes-client-0.3.0 lib/panoptes/client/subjects.rb
panoptes-client-0.2.13 lib/panoptes/client/subjects.rb
panoptes-client-0.2.12 lib/panoptes/client/subjects.rb
panoptes-client-0.2.11 lib/panoptes/client/subjects.rb
panoptes-client-0.2.10 lib/panoptes/client/subjects.rb
panoptes-client-0.2.9 lib/panoptes/client/subjects.rb
panoptes-client-0.2.8 lib/panoptes/client/subjects.rb