Class: Api::V2::TubeRackResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::TubeRackResource
- Defined in:
- app/resources/api/v2/tube_rack_resource.rb
Overview
Access this resource via the /api/v2/tube_racks/
endpoint.
Provides a JSON:API representation of TubeRack.
This resource represents a tube rack, which can contain a collection of tubes, with locations specified for each tube in the rack. Tubes are linked via the RackedTubes association
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
-
#comments ⇒ CommentResource
readonly
A collection of comments related to the tube rack.
-
#created_at ⇒ String
readonly
The timestamp when the tube rack was created.
-
#labware_barcode ⇒ Hash
A hash containing the different types of barcodes associated with the tube rack.
-
#name ⇒ String
The name of the tube rack.
-
#number_of_columns ⇒ Integer
The number of columns in the tube rack.
-
#number_of_rows ⇒ Integer
The number of rows in the tube rack.
-
#purpose ⇒ PurposeResource
The purpose associated with the tube rack.
-
#racked_tubes ⇒ RackedTubeResource
The tubes that have been placed in the tube rack.
-
#size ⇒ String
The size of the tube rack (e.g., 48, 96).
- #tube_locations ⇒ Void
-
#updated_at ⇒ String
readonly
The timestamp when the tube rack was last updated.
-
#uuid(: uuid) ⇒ ActiveRecord::Relation
readonly
Filtered tube racks that match the provided UUID.
Instance Method Summary collapse
-
#barcode(: barcode) ⇒ ActiveRecord::Relation
Filtered tube racks that match the provided barcode.
-
#purpose_id(: purpose_id) ⇒ ActiveRecord::Relation
Filtered tube racks that have the specified purpose ID.
-
#purpose_name(: purpose_name) ⇒ ActiveRecord::Relation
Filtered tube racks that have the specified purpose name.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#comments ⇒ CommentResource (readonly)
Comments are readonly and provide additional context or notes regarding the tube rack.
Returns A collection of comments related to the tube rack.
114 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 114 has_many :comments, readonly: true |
#created_at ⇒ String (readonly)
Returns The timestamp when the tube rack was created. Readonly.
60 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 60 attribute :created_at, readonly: true |
#labware_barcode ⇒ Hash
The labware barcode can be returned in different formats, such as EAN13 or machine-readable formats.
Returns A hash containing the different types of barcodes associated with the tube rack.
66 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 66 attribute :labware_barcode, write_once: true |
#name ⇒ String
This is a write-once attribute, meaning it cannot be modified once it has been set.
Returns The name of the tube rack.
71 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 71 attribute :name, write_once: true |
#number_of_columns ⇒ Integer
A POST request errors when this attribute is provided. I believe these are automatically calculated based on the size of the tube rack.
This is a write-once attribute, meaning it cannot be modified once it has been set.
Returns The number of columns in the tube rack.
78 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 78 attribute :number_of_columns, write_once: true |
#number_of_rows ⇒ Integer
A POST request errors when this attribute is provided. I believe these are automatically calculated based on the size of the tube rack.
This is a write-once attribute, meaning it cannot be modified once it has been set.
Returns The number of rows in the tube rack.
85 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 85 attribute :number_of_rows, write_once: true |
#purpose ⇒ PurposeResource
Returns The purpose associated with the tube rack.
118 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 118 has_one :purpose, foreign_key: :plate_purpose_id |
#racked_tubes ⇒ RackedTubeResource
This relationship represents the tubes placed in the rack at specified coordinates.
Returns The tubes that have been placed in the tube rack.
123 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 123 has_many :racked_tubes |
#size ⇒ String
This attribute is required.
Returns The size of the tube rack (e.g., 48, 96).
90 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 90 attribute :size |
#tube_locations ⇒ Void
This is a write-only attribute used to map tubes to specific coordinates in the rack.
97 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 97 attribute :tube_locations, writeonly: true |
#updated_at ⇒ String (readonly)
Returns The timestamp when the tube rack was last updated. Readonly.
101 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 101 attribute :updated_at, readonly: true |
#uuid(: uuid) ⇒ ActiveRecord::Relation (readonly)
Returns Filtered tube racks that match the provided UUID.
105 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 105 attribute :uuid, readonly: true |
Instance Method Details
#barcode(: barcode) ⇒ ActiveRecord::Relation
Returns Filtered tube racks that match the provided barcode.
132 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 132 filter :barcode, apply: ->(records, value, ) { records.(value) } |
#purpose_id(: purpose_id) ⇒ ActiveRecord::Relation
Returns Filtered tube racks that have the specified purpose ID.
154 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 154 filter :purpose_id, apply: ->(records, value, ) { records.where(plate_purpose_id: value) } |
#purpose_name(: purpose_name) ⇒ ActiveRecord::Relation
Returns Filtered tube racks that have the specified purpose name.
142 143 144 145 146 147 148 149 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 142 filter :purpose_name, apply: ( lambda do |records, value, | purpose = Purpose.find_by(name: value) records.where(plate_purpose_id: purpose) end ) |