Class: Api::V2::TransferResource

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

Provides a JSON:API representation of Transfer.

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, updatable_fields

Instance Attribute Details

#destinationLabwareResource, Void

The destination Labware for the transfer. Setting this relationship alongside the destination_uuid attribute will override the attribute value.

Returns:



118
# File 'app/resources/api/v2/transfer_resource.rb', line 118

has_one :destination

#destination_uuidString, Void

Deprecated.

Use the destination relationship instead.

Setting this attribute alongside the destination relationship will prefer the relationship value.

Returns:

  • (String, Void)

    the UUID of the destination labware.

See Also:



26
# File 'app/resources/api/v2/transfer_resource.rb', line 26

attribute :destination_uuid

#sourceLabwareResource

Note:

This relationship is required.

The source labware for the transfer. The type of the labware varies by the type of transfer. Setting this relationship alongside the source_uuid attribute will override the attribute value.

Returns:



125
# File 'app/resources/api/v2/transfer_resource.rb', line 125

has_one :source, class_name: 'Labware'

#source_uuidString

Deprecated.

Use the source relationship instead.

Setting this attribute alongside the source relationship will prefer the relationship value.

Returns:

  • (String)

    the UUID of the source labware. The type of the labware varies by the type of transfer.

See Also:



42
# File 'app/resources/api/v2/transfer_resource.rb', line 42

attribute :source_uuid

#transfer_template_uuid=(uuid) ⇒ String (writeonly)

Returns the UUID of a TransferTemplate to create a transfer from. This must be provided or the Transfer creation will raise an error.

Returns:

  • (String)

    the UUID of a TransferTemplate to create a transfer from. This must be provided or the Transfer creation will raise an error.



78
# File 'app/resources/api/v2/transfer_resource.rb', line 78

attribute :transfer_template_uuid, writeonly: true

#transfer_typeObject (readonly)

A filter to restrict the type of transfer to retrieve. One of the following types: - ‘Transfer::BetweenPlateAndTubes’ - ‘Transfer::BetweenPlatesBySubmission’ - ‘Transfer::BetweenPlates’ - ‘Transfer::BetweenSpecificTubes’ - ‘Transfer::BetweenTubesBySubmission’ - ‘Transfer::FromPlateToSpecificTubesByPool’ - ‘Transfer::FromPlateToSpecificTubes’ - ‘Transfer::FromPlateToTubeByMultiplex’ - ‘Transfer::FromPlateToTubeBySubmission’ - ‘Transfer::FromPlateToTube’



88
# File 'app/resources/api/v2/transfer_resource.rb', line 88

attribute :transfer_type, delegate: :sti_type, readonly: true

#transfersHash

Returns a hash of the transfers made. This is usually populated by the TransferTemplate used during creation of the Transfer.

Returns:

  • (Hash)

    a hash of the transfers made. This is usually populated by the TransferTemplate used during creation of the Transfer.



55
# File 'app/resources/api/v2/transfer_resource.rb', line 55

attribute :transfers

#userUserResource

Note:

This relationship is required.

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

Returns:



131
# File 'app/resources/api/v2/transfer_resource.rb', line 131

has_one :user

#user_uuidString

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.

Returns:

  • (String)

    The UUID of the user who requested the transfer.

See Also:



96
# File 'app/resources/api/v2/transfer_resource.rb', line 96

attribute :user_uuid, write_once: true

#uuidString (readonly)

Returns the UUID of the transfer.

Returns:

  • (String)

    the UUID of the transfer.



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

attribute :uuid, readonly: true

Class Method Details

.create_with_model(context, model_type) ⇒ TransferResource

Returns The new Transfer resource.

Parameters:

  • context (Hash)

    The context for the request.

  • model_type (Class)

    The polymorphic type of the Transfer model to create.

Returns:



162
163
164
165
# File 'app/resources/api/v2/transfer_resource.rb', line 162

def self.create_with_model(context, model_type)
  # Create the polymorphic type, not the base class.
  new(model_type.new, context)
end

Instance Method Details

#create_with_modelObject

Create a new Transfer resource with the polymorphic type extracted from a template. This is called by the controller when a create request for a Transfer is made.



162
163
164
165
# File 'app/resources/api/v2/transfer_resource.rb', line 162

def self.create_with_model(context, model_type)
  # Create the polymorphic type, not the base class.
  new(model_type.new, context)
end