Class: Api::V2::Sapio::StudiesController
- Inherits:
-
JSONAPI::ResourceController
- Object
- JSONAPI::ResourceController
- Api::V2::Sapio::StudiesController
- Includes:
- Concerns::ApiKeyAuthenticatable
- Defined in:
- app/controllers/api/v2/sapio/studies_controller.rb
Overview
Provides a JSON:API endpoint for Sapio to query Studies by name pattern. This endpoint is feature-flagged and returns a limited result set (max 20 studies).
Constant Summary collapse
- RESULTS_RANGE =
The range of valid values for the custom
maxResultsquery parameter to override the default maximum number of search results returned by theindexaction (Api::V2::BaseResource::MAX_RESULTS). 1..1000
Instance Method Summary collapse
-
#create ⇒ void
Creates a new externally managed Study, or, when the
y26_245_sapio_study_upsertfeature flag is enabled and the supplied uuid already belongs to an existing Study, marks that Study as externally managed instead (see StudyProcessor#create_resource). -
#index ⇒ void
Enforces a name search constraint on resource index listing.
-
#update ⇒ void
Updates an existing Study.
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates a new externally managed Study, or, when the
y26_245_sapio_study_upsert feature flag is enabled and the
supplied uuid already belongs to an existing Study, marks that
Study as externally managed instead
(see StudyProcessor#create_resource).
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/api/v2/sapio/studies_controller.rb', line 42 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
#index ⇒ void
This method returns an undefined value.
Enforces a name search constraint on resource index listing.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/api/v2/sapio/studies_controller.rb', line 29 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |
#update ⇒ void
This method returns an undefined value.
Updates an existing Study.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/api/v2/sapio/studies_controller.rb', line 50 do # NOTE: The following attribute is not required for Microarray Genotyping. # I think this might be broken and suggests that there should be separate classes for project: one for # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping # that doesn't. include ProjectManager::Associations include BudgetDivision::Associations custom_attribute(:project_cost_code, required: true) custom_attribute(:funding_comments) custom_attribute(:collaborators) custom_attribute(:external_funding_source) custom_attribute(:sequencing_budget_cost_centre) custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS) custom_attribute(:gt_committee_tracking_id) before_validation do |record| record.project_cost_code = nil if record.project_cost_code.blank? record.project_funding_model = nil if record.project_funding_model.blank? end end |