Class: Api::V2::VolumeUpdateResource

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

Overview

TODO:

This documentation does not yet include a detailed description of what this resource represents.

TODO:

This documentation does not yet include detailed descriptions for relationships, attributes and filters.

TODO:

This documentation does not yet include any example usage of the API via cURL or similar.

Note:

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

Provides a JSON:API representation of VolumeUpdate.

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

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

Instance Attribute Details

#asset_uuidString

Returns the uuid of the target labware associated with the volume update.

Returns:

  • (String)

    the uuid of the target labware associated with the volume update.



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

attribute :target_uuid

#created_byString

Returns the user who created the volume update.

Returns:

  • (String)

    the user who created the volume update.



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

attribute :created_by

#witnessed_byFloat

Returns the volume change that occured on the target labware.

Returns:

  • (Float)

    the volume change that occured on the target labware.



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

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.



50
51
52
# File 'app/resources/api/v2/volume_update_resource.rb', line 50

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

Instance Method Details

#target_uuidString

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

Returns:

  • (String)

    the uuid of the associated target Labware.



42
43
44
# File 'app/resources/api/v2/volume_update_resource.rb', line 42

def target_uuid
  @model.target.uuid
end

#target_uuid=(uuid) ⇒ void

This method returns an undefined value.

Sets the target Labware on the model using the UUID provided in the API create/update request.

Parameters:

  • uuid (String)

    the uuid of the associated target Labware.



35
36
37
# File 'app/resources/api/v2/volume_update_resource.rb', line 35

def target_uuid=(uuid)
  @model.target = Uuid.with_external_id(uuid).include_resource.map(&:resource).first
end