Class: Api::V2::TubeRackResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::TubeRackResource
- Defined in:
- app/resources/api/v2/tube_rack_resource.rb
Overview
This documentation does not yet include a detailed description of what this resource represents.
This documentation does not yet include detailed descriptions for relationships, attributes and filters.
This documentation does not yet include any example usage of the API via cURL or similar.
Access this resource via the /api/v2/tube_racks/
endpoint.
Provides a JSON:API representation of TubeRack.
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 Method Summary collapse
- #labware_barcode ⇒ Object
-
#tube_locations=(tube_locations) ⇒ Object
Tube locations should be received as: { A1: { uuid: ‘a1_tube_uuid’ }, B1: { uuid: ‘b1_tube_uuid’ }, … }.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Method Details
#labware_barcode ⇒ Object
68 69 70 71 72 73 74 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 68 def { 'ean13_barcode' => _model., 'machine_barcode' => _model., 'human_barcode' => _model. } end |
#tube_locations=(tube_locations) ⇒ Object
Tube locations should be received as: { A1: { uuid: ‘a1_tube_uuid’ }, B1: { uuid: ‘b1_tube_uuid’ }, … }
58 59 60 61 62 63 64 65 66 |
# File 'app/resources/api/v2/tube_rack_resource.rb', line 58 def tube_locations=(tube_locations) all_uuids = tube_locations.values.pluck(:uuid) tubes = Tube.with_uuid(all_uuids).index_by(&:uuid) tube_locations.each do |coordinate, tube| tube_uuid = tube[:uuid] raise "No tube found for UUID '#{tube_uuid}'" unless tubes.key?(tube_uuid) RackedTube.create(coordinate: coordinate, tube: tubes[tube_uuid], tube_rack: @model) end end |