Class: Api::V2::QcFileResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::QcFileResource
- Defined in:
- app/resources/api/v2/qc_file_resource.rb
Overview
Access this resource via the /api/v2/qc_files/
endpoint.
This resource cannot be modified after creation: its endpoint will not accept PATCH
requests.
Provides a JSON:API representation of QcFile which contains the QC data previously added to a piece of Labware. The file contents are stored in the database using the DbFile model.
}
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
-
#content_type ⇒ String
readonly
The content type, or MIME type, of the QC file.
-
#contents ⇒ String
The String contents of the QC file.
-
#created_at ⇒ DateTime
readonly
The date and time the QC file was created.
-
#filename ⇒ String
The filename of the QC file.
-
#labware ⇒ LabwareResource
The Labware which this QcFile belongs to.
-
#size ⇒ Integer
readonly
The size of the QC file in bytes.
-
#uuid ⇒ String
readonly
The UUID of the bulk transfers operation.
Class Method Summary collapse
Instance Method Summary collapse
-
#filter_uuid ⇒ Object
Filter the QcFile resources by UUID.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#content_type ⇒ String (readonly)
Returns The content type, or MIME type, of the QC file.
50 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 50 attribute :content_type, readonly: true |
#contents ⇒ String
Returns The String contents of the QC file. This is usually the CSV data for the QC file. This can only be written once on creation.
90 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 90 attribute :contents, write_once: true |
#created_at ⇒ DateTime (readonly)
Returns The date and time the QC file was created.
54 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 54 attribute :created_at, readonly: true |
#filename ⇒ String
Returns The filename of the QC file. This can only be written once on creation.
101 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 101 attribute :filename, write_once: true |
#labware ⇒ LabwareResource
Returns The Labware which this QcFile belongs to.
70 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 70 has_one :labware, relation_name: :asset, foreign_key: :asset_id, write_once: true |
#size ⇒ Integer (readonly)
Returns The size of the QC file in bytes.
58 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 58 attribute :size, readonly: true |
#uuid ⇒ String (readonly)
Returns The UUID of the bulk transfers operation.
62 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 62 attribute :uuid, readonly: true |
Class Method Details
.create(context) ⇒ Object
104 105 106 107 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 104 def self.create(context) opts = { uploaded_data: context.slice(:filename, :tempfile) } new(QcFile.new(opts), context) end |
Instance Method Details
#filter_uuid ⇒ Object
Filter the QcFile resources by UUID.
80 |
# File 'app/resources/api/v2/qc_file_resource.rb', line 80 filter :uuid, apply: ->(records, value, ) { records.with_uuid(value) } |