Class: Api::V2::LotTypeResource

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

Overview

Note:

This resource is immutable: its endpoint will not accept POST, PATCH, or DELETE requests.

Note:

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

Provides a JSON:API representation of LotType.

A LotType governs the behaviour of a Lot

For more information about JSON:API, see the JSON:API Specifications or the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.

Examples:

GET request to fetch all lot types

GET /api/v2/lot_types/

GET request to fetch a specific lot type by ID

GET /api/v2/lot_types/123/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseResource

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

Instance Attribute Details

#nameString

TODO:

This resource is immutable; Update attribute to be read-only.

Note:

This attribute must be unique.

The name of this lot type

Returns:

  • (String)

    The lot type name.



41
# File 'app/resources/api/v2/lot_type_resource.rb', line 41

attribute :name, write_once: true

#printer_typeString (readonly)

The type of printer used for this lot type. This is retrieved from the LotType model. e.g. '96 Well Plate'

Returns:

  • (String)

    The printer type.



63
# File 'app/resources/api/v2/lot_type_resource.rb', line 63

attribute :printer_type, readonly: true

#qcable_nameString? (readonly)

Retrieves the name of the target purpose associated with this lot type. This is the type of labware that end up being created under this lot type. The method (along with naming) was added for consistency with the v1 API when converting Gatekeeper to use the v2 API.

e.g. 'Tag Plate'

Returns:

  • (String, nil)

    The name of the target purpose, or nil if no target purpose is set.



56
# File 'app/resources/api/v2/lot_type_resource.rb', line 56

attribute :qcable_name, readonly: true

#target_purposePurposeResource

TODO:

This resource is immutable; Update relationship to be read-only.

The Purpose that this lot type is associated with

Returns:



97
# File 'app/resources/api/v2/lot_type_resource.rb', line 97

has_one :target_purpose, write_once: true, class_name: 'Purpose'

#template_classObject (readonly)

The class of the template associated with this lot type.



45
# File 'app/resources/api/v2/lot_type_resource.rb', line 45

attribute :template_class, readonly: true

#template_typeString

Retrieves the template type based on the internal class name.

e.g 'TagLayoutTemplate'

Returns:

  • (String)

    The template type



52
# File 'app/resources/api/v2/lot_type_resource.rb', line 52

attribute :template_type, write_once: true

#uuidString (readonly)

Note:

This identifier is automatically assigned upon creation and cannot be modified.

Returns The universally unique identifier (UUID) of the lot type.

Returns:

  • (String)

    The universally unique identifier (UUID) of the lot type.



34
# File 'app/resources/api/v2/lot_type_resource.rb', line 34

attribute :uuid, readonly: true

Instance Method Details

#activeBoolean

Filter to return only active lot types. This filter allows users to specify if only active lot types should be returned.

Examples:

Using the filter: GET /api/v2/lot_types?active=true

Returns:

  • (Boolean)

    Whether the lot type is active or not.



108
# File 'app/resources/api/v2/lot_type_resource.rb', line 108

filter :active, default: true