Class: Api::V2::TagLayoutResource

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

Overview

Note:

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

Note:

This resource cannot be modified after creation: its endpoint will not accept PATCH requests.

Provides a JSON:API representation of the TagLayout resource.

TagLayout Lays out the tags in the specified tag group in a particular pattern. This resource is used for managing tag layouts for plates, which define how tags are applied or distributed across the plate. It supports creating a tag layout and retrieving its details.

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:

GET request to fetch all tag layouts

GET /api/v2/tag_layouts/

GET request to fetch a specific tag layout by ID

GET /api/v2/tag_layouts/123/

POST request to create a new tag layout

POST /api/v2/tag_layouts/
{
  "data": {
    "type": "tag_layouts",
    "attributes": {
        "direction": "column",
        "initial_tag": 100,
        "substitutions": {"key": "value"},
        "tags_per_well": 5,
        "walking_by": "wells in pools"
    },
    "relationships": {
        "tag_group": {
            "data": { "type": "tag_groups", "id": 1 }
        },
        "plate": {
            "data": { "type": "plates", "id": 1 }
        },
        "user": {
            "data": { "type": "users", "id": 4 }
        }
    }
  }
}

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseResource

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

Instance Attribute Details

#directionString

Note:

This attribute is required and must be specified when creating a tag layout.

The name of the algorithm defining the direction of the tag layout.

Returns:

  • (String)

    The direction of the tag layout.



58
# File 'app/resources/api/v2/tag_layout_resource.rb', line 58

attribute :direction

#enforce_uniqueness=(value) ⇒ Object (writeonly)

Not stored on the model



199
# File 'app/resources/api/v2/tag_layout_resource.rb', line 199

attribute :enforce_uniqueness, writeonly: true

#initial_tagInteger

An offset for the tag set indicating which tag to start with in the layout.

Returns:

  • (Integer)

    The tag number to start with in the layout.



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

attribute :initial_tag

#plateApi::V2::PlateResource

Note:

This relationship is required and must be set when creating the tag layout.

This relationship defines the plate to which this tag layout is applied. Setting this relationship alongside the plate_uuid attribute will override the attribute value.

Returns:



157
# File 'app/resources/api/v2/tag_layout_resource.rb', line 157

has_one :plate

#plate_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the plate relationship instead.

This is a convenience attribute for when the plate is not available as a relationship. Setting this alongside the plate relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the Plate this tag layout applies to.

Returns:

  • (Void)

See Also:



72
# File 'app/resources/api/v2/tag_layout_resource.rb', line 72

attribute :plate_uuid, writeonly: true

#substitutionsHash

A hash of substitutions to be applied during the layout creation, mapping placeholders to values.

Returns:

  • (Hash)

    The substitutions for the tag layout.



81
# File 'app/resources/api/v2/tag_layout_resource.rb', line 81

attribute :substitutions

#tag2_groupApi::V2::TagGroupResource

Defines a secondary tag group used in the tag layout, typically for dual indexing. Setting this relationship alongside the tag2_group_uuid attribute will override the attribute value. This is used during dual indexing, but will not be found during single indexing.

Returns:



171
# File 'app/resources/api/v2/tag_layout_resource.rb', line 171

has_one :tag2_group, class_name: 'TagGroup'

#tag2_group_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the tag2_group relationship instead.

This is a convenience attribute for when a second TagGroup is not available to set as a relationship. Setting this alongside the tag2_group relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the second TagGroup used in this tag layout.

Returns:

  • (Void)

See Also:



112
# File 'app/resources/api/v2/tag_layout_resource.rb', line 112

attribute :tag2_group_uuid, writeonly: true

#tag_groupApi::V2::TagGroupResource

Note:

This relationship is required.

Defines the primary tag group used in the tag layout. Setting this relationship alongside the tag_group_uuid attribute will override the attribute value.

Returns:



164
# File 'app/resources/api/v2/tag_layout_resource.rb', line 164

has_one :tag_group

#tag_group_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the tag_group relationship instead.

This is a convenience attribute for when the TagGroup is not available to set as a relationship. Setting this alongside the tag_group relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the TagGroup used in this tag layout.

Returns:

  • (Void)

See Also:



99
# File 'app/resources/api/v2/tag_layout_resource.rb', line 99

attribute :tag_group_uuid, writeonly: true

#tag_layout_template_uuid=(value) ⇒ Object (writeonly)

Not stored on the model



192
# File 'app/resources/api/v2/tag_layout_resource.rb', line 192

attribute :tag_layout_template_uuid, writeonly: true

#tags_per_wellInteger

The number of tags per well in the layout. Used for specific tag layout algorithms like #walking_by. When not used, this will be nil.

Returns:

  • (Integer)

    The number of tags per well.



123
# File 'app/resources/api/v2/tag_layout_resource.rb', line 123

attribute :tags_per_well

#userApi::V2::UserResource

Note:

This relationship is required.

Defines the user who initiated the creation of this tag layout. Setting this relationship alongside the user_uuid attribute will override the attribute value.

Returns:



178
# File 'app/resources/api/v2/tag_layout_resource.rb', line 178

has_one :user

#user_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the user relationship instead.

This is a convenience attribute for when the User is not available to set as a relationship. Setting this alongside the user relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the User who initiated the creation of the tag layout.

Returns:

  • (Void)

See Also:



132
# File 'app/resources/api/v2/tag_layout_resource.rb', line 132

attribute :user_uuid, writeonly: true

#uuidString (readonly)

Returns The UUID of the tag layout.

Returns:

  • (String)

    The UUID of the tag layout.



140
# File 'app/resources/api/v2/tag_layout_resource.rb', line 140

attribute :uuid, readonly: true

#walking_byString

Note:

This attribute is required and must be specified when creating a tag layout.

Defines the algorithm that determines how the tag layout is walked through (e.g., by row, by column).

Returns:

  • (String)

    The walking algorithm used for the tag layout.



146
# File 'app/resources/api/v2/tag_layout_resource.rb', line 146

attribute :walking_by