Class: Api::V2::QcableResource

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

Overview

Note:

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

Provides a JSON:API representation of Qcable which represents an element of a lot which needs to be approved by QC before it can be used.

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 to create a Qcable.

POST /api/v2/qcables/
{
  "data": {
    "type": "qcables",
    "attributes": {
    },
    "relationships": {
      "labware": {
        "data": { "type": "labware", "id": 57 }
      },
      "lot": {
        "data": { "type": "lots", "id": 1 }
      }
    }
  }
}

PATCH request to change the Asset of a Qcable.

PATCH /api/v2/qcables/
{
  "data": {
    "type": "qc_files",
    "id": 123
    "relationships": {
      "asset": {
        "data": {
          "type": "labware",
          "id": 456
        }
      }
    }
  }
}

GET request for all Qcable resources

GET /api/v2/qcables/

GET request for a Qcable with ID 123

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

#assetLabwareResource

Deprecated.

Use the #labware relationship instead.

Returns the Labware resource associated with this Qcable.

Returns:



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

has_one :asset

#labwareLabwareResource

Returns the Labware resource associated with this Qcable.

Returns:



103
# File 'app/resources/api/v2/qcable_resource.rb', line 103

has_one :labware, relation_name: 'asset', foreign_key: :asset_id

#labware_barcodeHash (readonly)

Returns the barcodes of the labware associated with this Qcable. This includes the EAN13 barcode, the machine barcode and the human barcode. Note however that some of these barcodes may be nil.

Returns:

  • (Hash)

    the barcodes of the labware associated with this Qcable. This includes the EAN13 barcode, the machine barcode and the human barcode. Note however that some of these barcodes may be nil.



65
# File 'app/resources/api/v2/qcable_resource.rb', line 65

attribute :labware_barcode, readonly: true

#lotLotResource

Returns the Lot resource associated with this Qcable.

Returns:



107
# File 'app/resources/api/v2/qcable_resource.rb', line 107

has_one :lot

#stateString (readonly)

Returns a string representation of the state this Qcable is in. The state is changed by a state machine via events that occur as the Qcable is processed. The possible states are: - created - pending - failed - passed - available - destroyed - qc_in_progress - exhausted.

Returns:

  • (String)

    a string representation of the state this Qcable is in. The state is changed by a state machine via events that occur as the Qcable is processed. The possible states are: - created - pending - failed - passed - available - destroyed - qc_in_progress - exhausted.



86
# File 'app/resources/api/v2/qcable_resource.rb', line 86

attribute :state, readonly: true

#uuidString (readonly)

Returns the UUID of this Qcable.

Returns:

  • (String)

    the UUID of this Qcable.



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

attribute :uuid, readonly: true

Instance Method Details

#filter_barcodeObject

Apply a filter across all Qcable resource , matching by barcode.

Examples:

Get all Qcable resources with a specific barcode.

/api/v2/qcables?filter[barcode]=1234567890123


117
# File 'app/resources/api/v2/qcable_resource.rb', line 117

filter :barcode, apply: ->(records, value, _options) { records.with_barcode(value) }

#filter_uuidObject

Apply a filter across all Qcable resources, matching by UUID.

Examples:

Get all Qcable resources with a specific UUID.

/api/v2/qcables?filter[uuid]=12345678-1234-1234-1234-123456789012


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

filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) }