Class: Api::V2::VolumeUpdateResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/volume_update_resource.rb

Overview

Note:

Access this resource via the /api/v2/volume_updates/ endpoint.

Note:

Updates are not allowed on this resource @see self.updatable_fields

Provides a JSON:API representation of VolumeUpdate for the tracking of volume changes associated with labware.

Performs a change of volume on a resource Primarily created on plates via Assets Audits application to indicate reduced volume on, eg. working dilution creation. No records exist on 29/05/2019 due to no volumes configured for processes

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.

Examples:

POST request to create a volume update

POST /api/v2/volume_updates/
{
  "data": {
    "type": "volume_updates",
    "attributes": {
      "created_by": "me",
      "target_uuid": "9dc5f262-f524-11ef-8842-000000000000",
      "volume_change": -2.345
    }
  }
}

GET request for all VolumeUpdate resources

GET /api/v2/volume_updates/

GET request for a specific VolumeUpdate resource with ID 123

GET /api/v2/volume_updates/123/

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BaseResource

apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations

Instance Attribute Details

#created_byString

Note:

This attribute is required.

The user who created the volume update.

Returns:

  • (String)

    the UUID of the user who created the volume update.



48
# File 'app/resources/api/v2/volume_update_resource.rb', line 48

attribute :created_by

#target_uuidString

Transforms the target Labware into its UUID when generating an API query response.

Returns:

  • (String)

    the UUID of the associated target labware.



54
# File 'app/resources/api/v2/volume_update_resource.rb', line 54

attribute :target_uuid

#volume_changeFloat

Note:

This attribute is required.

The amount of volume change that occurred on the target labware.

Returns:

  • (Float)

    the volume change value (e.g., 5.0 for an increase of 5 units).



60
# File 'app/resources/api/v2/volume_update_resource.rb', line 60

attribute :volume_change

Class Method Details

.updatable_fields(_context) ⇒ Array<Symbol>

Gets the list of fields which are updatable on an existing VolumeUpdate.

Parameters:

  • _context (JSONAPI::Resource::Context)

    not used.

Returns:

  • (Array<Symbol>)

    the list of updatable fields (empty in this case as updates are not allowed).



89
90
91
# File 'app/resources/api/v2/volume_update_resource.rb', line 89

def self.updatable_fields(_context)
  [] # Do not allow updating any fields.
end