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.
-
#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.
56 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 56 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.
62 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 62 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.
67 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 67 attribute :name, delegate: :display_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.
74 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 74 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.
81 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 81 attribute :number_of_rows, write_once: true |
#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.
119 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 119 has_many :racked_tubes |
#size ⇒ String
This attribute is required.
Returns The size of the tube rack (e.g., 48, 96).
86 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 86 attribute :size, write_once: true |
#tube_locations ⇒ Void
This is a write-only attribute used to map tubes to specific coordinates in the rack.
93 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 93 attribute :tube_locations, writeonly: true |
#updated_at ⇒ String (readonly)
Returns The timestamp when the tube rack was last updated. Readonly.
97 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 97 attribute :updated_at, readonly: true |
#uuid(: uuid) ⇒ ActiveRecord::Relation (readonly)
Returns Filtered tube racks that match the provided UUID.
101 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 101 attribute :uuid, readonly: true |
Instance Method Details
#barcode(: barcode) ⇒ ActiveRecord::Relation
Returns Filtered tube racks that match the provided barcode.
136 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 136 filter :barcode, apply: ->(records, value, ) { records.(value) } |
#purpose_id(: purpose_id) ⇒ ActiveRecord::Relation
Returns Filtered tube racks that have the specified purpose ID.
158 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 158 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.
146 147 148 149 150 151 152 153 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 146 filter :purpose_name, apply: ( lambda do |records, value, | purpose = TubeRack::Purpose.find_by(name: value) records.where(plate_purpose_id: purpose) end ) |