lib/panoptes/client/subjects.rb in panoptes-client-1.0.0.pre1 vs lib/panoptes/client/subjects.rb in panoptes-client-1.0.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Panoptes
class Client
module Subjects
# Get list of subjects
#
@@ -10,12 +12,12 @@
query[:subject_set_id] = subject_set_id if subject_set_id
query[:workflow_id] = workflow_id if workflow_id
raise 'Must filter on at least one of subject_set_id, workflow_id' if query.empty?
- response = panoptes.paginate("/subjects", query)
- response.fetch("subjects")
+ response = panoptes.paginate('/subjects', query)
+ response.fetch('subjects')
end
# Fetch a subject given filters (including permissions)
#
# @param subject_id [Integer]
@@ -25,11 +27,11 @@
query = {}
query[:project_id] = project_id if project_id
response = panoptes.get("/subjects/#{subject_id}", query)
if response.fetch('subjects', []).count > 1
- raise StandardError.new 'Unexpectedly many subjects returned'
+ raise StandardError, 'Unexpectedly many subjects returned'
end
response.fetch('subjects', []).fetch(0, nil)
end
@@ -38,14 +40,13 @@
# @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
- })
+ panoptes.post("/workflows/#{workflow_id}/retired_subjects",
+ admin: true,
+ subject_id: subject_id,
+ retirement_reason: reason)
true
end
end
end
end