Class: Api::V2::StudyResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::StudyResource
- Defined in:
- app/resources/api/v2/study_resource.rb
Overview
This resource is immutable: its endpoint will not accept POST
, PATCH
, or DELETE
requests.
Access this resource via the /api/v2/studies/
endpoint.
A Study is a collection of various samples and the work done on them.
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
-
#name ⇒ String
readonly
The name of the study.
-
#poly_metadata ⇒ Array<PolyMetadatumResource>
readonly
This metadata allows for the flexible extension of study attributes.
-
#study_metadata ⇒ StudyMetadataResource
The metadata associated with this sample, containing additional details like faculty sponsor.
-
#uuid ⇒ String
readonly
The UUID of the study.
Instance Method Summary collapse
-
#filter_by_name(name) ⇒ Object
Allows filtering studies by their name.
-
#filter_by_state(state) ⇒ Object
Allows filtering studies by their state (e.g., active, archived).
-
#filter_by_user(user_id) ⇒ Object
Allows filtering studies by the user who owns or manages them.
-
#filter_by_uuid(uuid) ⇒ Object
A filter to return only studies with the given UUID.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#name ⇒ String (readonly)
Returns The name of the study.
32 |
# File 'app/resources/api/v2/study_resource.rb', line 32 attribute :name |
#poly_metadata ⇒ Array<PolyMetadatumResource> (readonly)
This metadata allows for the flexible extension of study attributes.
46 |
# File 'app/resources/api/v2/study_resource.rb', line 46 has_many :poly_metadata, as: :metadatable, class_name: 'PolyMetadatum' |
#study_metadata ⇒ StudyMetadataResource
Optional relationship.
Returns The metadata associated with this sample, containing additional details like faculty sponsor.
52 |
# File 'app/resources/api/v2/study_resource.rb', line 52 has_one :study_metadata, class_name: 'StudyMetadata', foreign_key_on: :related |
#uuid ⇒ String (readonly)
This identifier is automatically assigned upon creation and cannot be modified.
Returns The UUID of the study.
37 |
# File 'app/resources/api/v2/study_resource.rb', line 37 attribute :uuid |
Instance Method Details
#filter_by_name(name) ⇒ Object
Allows filtering studies by their name.
62 |
# File 'app/resources/api/v2/study_resource.rb', line 62 filter :name |
#filter_by_state(state) ⇒ Object
Allows filtering studies by their state (e.g., active, archived).
68 |
# File 'app/resources/api/v2/study_resource.rb', line 68 filter :state, apply: lambda { |records, value, | records.by_state(value) } |
#filter_by_user(user_id) ⇒ Object
Allows filtering studies by the user who owns or manages them.
74 |
# File 'app/resources/api/v2/study_resource.rb', line 74 filter :user, apply: lambda { |records, value, | records.by_user(value) } |
#filter_by_uuid(uuid) ⇒ Object
A filter to return only studies with the given UUID.
80 |
# File 'app/resources/api/v2/study_resource.rb', line 80 filter :uuid, apply: ->(records, value, ) { records.with_uuid(value) } |