Class: V1::Pacbio::ContainerMaterialResource

Inherits:
JSONAPI::Resource
  • Object
show all
Defined in:
app/resources/v1/pacbio/container_material_resource.rb

Overview

Note:

This endpoint can’t be directly accessed via the /v1/pacbio/container_material/

Provides a JSON:API representation of ContainerMaterial.

endpoint, as it is only accessible via the nested route under TubeResource and WellResource using includes.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#barcodeObject

Delegations to container



57
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 57

attributes :barcode, :created_at, :material_type

#concentrationFloat

Returns the concentration of the library.

Returns:

  • (Float)

    the concentration of the library



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#cost_codeString

Returns the cost code for the library.

Returns:

  • (String)

    the cost code for the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#created_atString

Returns the creation time of the container.

Returns:

  • (String)

    the creation time of the container



57
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 57

attributes :barcode, :created_at, :material_type

#deactivated_atDateTime?

Returns the deactivation time of the library, or nil if not deactivated.

Returns:

  • (DateTime, nil)

    the deactivation time of the library, or nil if not deactivated



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#estimate_of_gb_requiredFloat

Returns the estimated gigabytes required for the library.

Returns:

  • (Float)

    the estimated gigabytes required for the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#external_study_idString

Returns the external study ID for the library.

Returns:

  • (String)

    the external study ID for the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#insert_sizeInteger

Returns the insert size of the library.

Returns:

  • (Integer)

    the insert size of the library



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#library_typeString

Returns the type of the library.

Returns:

  • (String)

    the type of the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#material_typeString

Returns the type of material in the container.

Returns:

  • (String)

    the type of material in the container



57
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 57

attributes :barcode, :created_at, :material_type

#number_of_smrt_cellsInteger

Returns the number of SMRT cells required for the library.

Returns:

  • (Integer)

    the number of SMRT cells required for the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#sample_nameString

Returns the name of the sample in the library.

Returns:

  • (String)

    the name of the sample in the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#sample_namesObject

TODO: Moved here as dropped it from library, but this should probably become sample name. But overall, not really convinced this model should be exposed via the API.



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#sample_speciesString

Returns the species of the sample in the library.

Returns:

  • (String)

    the species of the sample in the library



47
48
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 47

attributes :library_type, :estimate_of_gb_required, :number_of_smrt_cells, :cost_code,
:external_study_id, :sample_name, :sample_species

#stateString

Returns the state of the library.

Returns:

  • (String)

    the state of the library



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#template_prep_kit_box_barcodeString

Returns the barcode of the template prep kit box.

Returns:

  • (String)

    the barcode of the template prep kit box



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

#volumeFloat

Returns the volume of the library.

Returns:

  • (Float)

    the volume of the library



29
30
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 29

attributes :state, :insert_size, :volume, :concentration,
:template_prep_kit_box_barcode, :deactivated_at, :sample_names

Class Method Details

.records_for_populate(*_args) ⇒ Object



72
73
74
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 72

def self.records_for_populate(*_args)
  super.preload(:container, material: %i[material_type sample])
end

Instance Method Details

#fetchable_fieldsObject



59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/resources/v1/pacbio/container_material_resource.rb', line 59

def fetchable_fields
  case @model.material
  when ::Pacbio::Library
    %i[state barcode volume concentration template_prep_kit_box_barcode insert_size
       created_at deactivated_at sample_names material_type]
  when ::Pacbio::Request
    %i[library_type estimate_of_gb_required number_of_smrt_cells cost_code external_study_id
       sample_name barcode sample_species created_at material_type]
  else
    super
  end
end