Class: Api::V2::TubeResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::TubeResource
- Includes:
- SharedBehaviour::Labware
- Defined in:
- app/resources/api/v2/tube_resource.rb
Overview
This resource is immutable: its endpoint will not accept POST, PATCH, or DELETE requests.
Access this resource via the /api/v2/tubes/ endpoint.
Provides a JSON:API representation of a Tube.
A Tube is a piece of Labware, which is a container that can hold samples, aliquots, or other entities in a laboratory setting.
For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.
Instance Attribute Summary collapse
-
#aliquots ⇒ Array<Api::V2::AliquotResource>
readonly
The aliquots contained within this tube.
-
#racked_tube ⇒ Api::V2::RackedTubeResource
readonly
The racked tube association.
-
#receptacle ⇒ Api::V2::ReceptacleResource
readonly
The receptacle associated with aliquots contained by this tube.
-
#sibling_tubes ⇒ Array<Hash>
readonly
An array of hashes containing metadata for sibling tubes.
-
#transfer_requests_as_target ⇒ Array<Api::V2::TransferRequestResource>
readonly
The transfer requests that target this tube.
Method Summary
Methods included from SharedBehaviour::Labware
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#aliquots ⇒ Array<Api::V2::AliquotResource> (readonly)
This relationship is read-only and represents the aliquots that are physically stored within the tube.
The aliquots contained within this tube. An aliquot is a portion of the contents from a larger sample, typically for further analysis or experimentation.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/resources/api/v2/tube_resource.rb', line 55 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 |
#racked_tube ⇒ Api::V2::RackedTubeResource (readonly)
Returns The racked tube association.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'app/resources/api/v2/tube_resource.rb', line 74 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 |
#receptacle ⇒ Api::V2::ReceptacleResource (readonly)
This relationship is read-only and is primarily used for retrieving information about the receptacle,
The receptacle associated with aliquots contained by this tube. A receptacle can refer to a container that holds multiple aliquots. not for modifying it.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'app/resources/api/v2/tube_resource.rb', line 63 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 |
#sibling_tubes ⇒ Array<Hash> (readonly)
This attribute is read-only and may not be present for all tubes, as it depends on the context (e.g., tubes that are part of a group or series).
An array of hashes containing metadata for sibling tubes. Sibling tubes are tubes that share a common ancestor, often used in a grouping of tubes.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/resources/api/v2/tube_resource.rb', line 40 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 |
#transfer_requests_as_target ⇒ Array<Api::V2::TransferRequestResource> (readonly)
This relationship is read-only and provides insights into the transfer requests targeting this tube.
The transfer requests that target this tube. A transfer request represents an instruction to move aliquots or samples into the tube.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/resources/api/v2/tube_resource.rb', line 70 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 |