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.
-
#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.
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' |
#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.
56 |
# File 'app/resources/api/v2/study_resource.rb', line 56 filter :name |
#filter_by_state(state) ⇒ Object
Allows filtering studies by their state (e.g., active, archived).
62 |
# File 'app/resources/api/v2/study_resource.rb', line 62 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.
68 |
# File 'app/resources/api/v2/study_resource.rb', line 68 filter :user, apply: lambda { |records, value, | records.by_user(value) } |