Class: Api::V2::PlateCreationResource

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

Overview

Note:

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

Note:

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

Provides a JSON:API representation of PlateCreation for creation of a child plate with a given purpose which is linked to a parent plate as one of its children. Creation of this resource via a POST request will initiate the child plate creation. The child plate is returned by this endpoint under the #child relationship.

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 with arguments specified by UUID (deprecated)

POST /api/v2/plate_creations/
{
  "data": {
    "type": "plate_creations",
    "attributes": {
      "parent_uuid": "11111111-2222-3333-4444-555555666666",
      "child_purpose_uuid": "22222222-3333-4444-5555-666666777777",
      "user_uuid": "33333333-4444-5555-6666-777777888888"
    }
  }
}

POST request with arguments specified by relationship

POST /api/v2/plate_creations/
{
  "data": {
    "type": "plate_creations",
    "attributes": {},
    "relationships": {
      "parent": {
        "data": { "type": "plates", "id": "123" }
      },
      "child_purpose": {
        "data": { "type": "plate_purposes", "id": "234" }
      },
      "user": {
        "data": { "type": "users", "id": "345" }
      }
    }
  }
}

GET request for all PlateCreation resources

GET /api/v2/plate_creations/

GET request for a PlateCreation with ID 123

GET /api/v2/plate_creations/123/

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

#childApi::V2::PlateResource (readonly)

Returns The child plate created by this resource.

Returns:



109
# File 'app/resources/api/v2/plate_creation_resource.rb', line 109

has_one :child, class_name: 'Plate', readonly: true

#child_purposeApi::V2::PlatePurposeResource

Note:

This relationship is required.

Setting this relationship alongside the child_purpose_uuid attribute will override the attribute value. The purpose which the child plate should be created with.



116
# File 'app/resources/api/v2/plate_creation_resource.rb', line 116

has_one :child_purpose, class_name: 'PlatePurpose'

#child_purpose_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the child_purpose relationship instead.

This is declared for convenience where the PlatePurpose is not available to set as a relationship. Setting this attribute alongside the child_purpose relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the PlatePurpose to use when creating the child plate.

Returns:

  • (Void)

See Also:



67
# File 'app/resources/api/v2/plate_creation_resource.rb', line 67

attribute :child_purpose_uuid, writeonly: true

#parentApi::V2::PlateResource

Setting this relationship alongside the parent_uuid attribute will override the attribute value.

Returns:



121
# File 'app/resources/api/v2/plate_creation_resource.rb', line 121

has_one :parent, class_name: 'Plate'

#parent_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the parent relationship instead.

This is declared for convenience where the parent Plate is not available to set as a relationship. Setting this attribute alongside the parent relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the Plate to become the parent of the created child plate.

Returns:

  • (Void)

See Also:



80
# File 'app/resources/api/v2/plate_creation_resource.rb', line 80

attribute :parent_uuid, writeonly: true

#userApi::V2::UserResource

Note:

This relationship is required.

Setting this relationship alongside the user_uuid attribute will override the attribute value.

Returns:



127
# File 'app/resources/api/v2/plate_creation_resource.rb', line 127

has_one :user

#user_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the user relationship instead.

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

Parameters:

  • value (String)

    The UUID of the User who initiated this plate creation.

Returns:

  • (Void)

See Also:



93
# File 'app/resources/api/v2/plate_creation_resource.rb', line 93

attribute :user_uuid, writeonly: true

#uuidString (readonly)

Returns The UUID of the plate creation.

Returns:

  • (String)

    The UUID of the plate creation.



101
# File 'app/resources/api/v2/plate_creation_resource.rb', line 101

attribute :uuid, readonly: true