Class: V1::Pacbio::RequestResource

Inherits:
JSONAPI::Resource
  • Object
show all
Includes:
Shared::SourceIdentifierFilterable
Defined in:
app/resources/v1/pacbio/request_resource.rb

Overview

Provides a JSON:API representation of Pacbio::Request.

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for the service implementation of the JSON:API standard. This resource represents a Pacbio Request and can return all requests, a single request or multiple requests along with their relationships.

Filters:

  • sample_name

  • source_identifier

  • species

Primary relationships:

Relationship trees:

  • well.plate

  • plate.wells

  • tube.requests

Examples:

curl -X GET http://localhost:3000/v1/pacbio/requests/1
curl -X GET http://localhost:3000/v1/pacbio/requests/
curl -X GET http://localhost:3000/v1/pacbio/requests/1?include=well,plate,tube

https://localhost:3000/v1/pacbio/requests?filter[sample_name]=sample_name
https://localhost:3000/v1/pacbio/requests?filter[species]=species

https://localhost:3000/v1/pacbio/requests?filter[source_identifier]=TRAC-2-12068

https://localhost:3000/v1/pacbio/requests?filter[source_identifier]=TRAC-2-12068,TRAC-2-12066,TRAC-2-12067:A1

https://localhost:3000/v1/pacbio/requests?filter[source_identifier]=TRAC-2-12068,TRAC-2-12066,TRAC-2-12067&include=well.plate,plate.wells,tube.requests

Direct Known Subclasses

V1::Pacbio::Runs::RequestResource

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#barcodeString

Returns the barcode of the sample.

Returns:

  • (String)

    the barcode of the sample



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#cost_codeString

Returns the cost code.

Returns:

  • (String)

    the cost code



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#created_atString

Returns the creation time of the request.

Returns:

  • (String)

    the creation time of the request



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#estimate_of_gb_requiredFloat

Returns the estimated gigabytes required.

Returns:

  • (Float)

    the estimated gigabytes required



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#external_study_idString

Returns the external study ID.

Returns:

  • (String)

    the external study ID



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#library_typeString

Returns the type of the library.

Returns:

  • (String)

    the type of the library



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#number_of_smrt_cellsInteger

Returns the number of SMRT cells.

Returns:

  • (Integer)

    the number of SMRT cells



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#sample_nameString

Returns the name of the sample.

Returns:

  • (String)

    the name of the sample



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#sample_speciesString

Returns the species of the sample.

Returns:

  • (String)

    the species of the sample



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

#source_identifierString

Returns the source identifier of the request.

Returns:

  • (String)

    the source identifier of the request



69
70
# File 'app/resources/v1/pacbio/request_resource.rb', line 69

attributes(*::Pacbio.request_attributes, :sample_name, :barcode, :sample_species,
:created_at, :source_identifier)

Class Method Details

.default_sortObject



97
98
99
# File 'app/resources/v1/pacbio/request_resource.rb', line 97

def self.default_sort
  [{ field: 'created_at', direction: :desc }]
end

.records_for_populate(*_args) ⇒ Object



113
114
115
# File 'app/resources/v1/pacbio/request_resource.rb', line 113

def self.records_for_populate(*_args)
  super.preload(:sample, :tube, well: :plate)
end

Instance Method Details

#publish_messagesObject



117
118
119
# File 'app/resources/v1/pacbio/request_resource.rb', line 117

def publish_messages
  Messages.publish(@model.sequencing_runs, Pipelines.pacbio.message)
end