Class: Api::V2::BulkTransferResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/bulk_transfer_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/bulk_transfers/ endpoint.

Provides a JSON:API representation of BulkTransfer which allows the transfer of multiple wells from source plates to destination plates. The plates and wells to transfer are specified using #well_transfers=. Creation of this resource via a POST request will perform the specified transfers. After creation, the transfers can be accessed via the #transfers 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

POST /api/v2/bulk_transfers/
{
  "data": {
    "type": "bulk_transfers",
    "attributes": {
      "well_transfers": [
        {
          "source_uuid": "src_plate1_uuid",
          "source_location": "A1",
          "destination_uuid": "dest_plate1_uuid",
          "destination_location": "A1"
        },
        {
          "source_uuid": "src_plate1_uuid",
          "source_location": "B1",
          "destination_uuid": "dest_plate2_uuid",
          "destination_location": "A1"
        },
        {
          "source_uuid": "src_plate2_uuid",
          "source_location": "A1",
          "destination_uuid": "dest_plate1_uuid",
          "destination_location": "B1"
        },
        {
          "source_uuid": "src_plate2_uuid",
          "source_location": "B1",
          "destination_uuid": "dest_plate2_uuid",
          "destination_location": "B1"
        }
      ],
      "user_uuid": "user_uuid"
    }
  }
}

GET request for all BulkTransfer resources

GET /api/v2/bulk_transfers/

GET request for a BulkTransfer with ID 123

GET /api/v2/bulk_transfers/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

#transfersArray<TransferResource> (readonly)

The transfers that were created as a result of this bulk transfer.

Returns:



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

has_many :transfers, readonly: true

#userUserResource

Note:

This relationship is required.

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

Returns:

  • (UserResource)

    The user who initiated the creation of the bulk transfers.



105
# File 'app/resources/api/v2/bulk_transfer_resource.rb', line 105

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 the creation of the bulk transfers.

Returns:

  • (Void)

See Also:



71
# File 'app/resources/api/v2/bulk_transfer_resource.rb', line 71

attribute :user_uuid, writeonly: true

#uuidString (readonly)

Returns The UUID of the bulk transfers operation.

Returns:

  • (String)

    The UUID of the bulk transfers operation.



79
# File 'app/resources/api/v2/bulk_transfer_resource.rb', line 79

attribute :uuid, readonly: true

#well_transfers=(value) ⇒ Void (writeonly)

An array of well transfers to perform. Each transfer is a hash with the following:

  • source_uuid [String] The UUID of the source plate.

  • source_location [String] The location on the source plate.

  • destination_uuid [String] The UUID of the destination plate.

  • destination_location [String] The location on the destination plate.

Returns:

  • (Void)


90
# File 'app/resources/api/v2/bulk_transfer_resource.rb', line 90

attribute :well_transfers, writeonly: true