diff --git a/.yardopts b/.yardopts index c73c24f784..fb4a3faf48 100644 --- a/.yardopts +++ b/.yardopts @@ -1,4 +1,6 @@ --asset docs/images:images +--exclude app/controllers/api/v2/[^/]*\.rb +--exclude app/controllers/api/v2/concerns/.* - LICENSE docs/*.md diff --git a/app/controllers/api/v2/tag_group_adapter_types_controller.rb b/app/controllers/api/v2/tag_group_adapter_types_controller.rb new file mode 100644 index 0000000000..e622884326 --- /dev/null +++ b/app/controllers/api/v2/tag_group_adapter_types_controller.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Api + module V2 + # Provides a JSON API controller for TagGroup::AdapterType + # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + class TagGroupAdapterTypesController < JSONAPI::ResourceController + # By default JSONAPI::ResourceController provides most the standard + # behaviour, and in many cases this file may be left empty. + end + end +end diff --git a/app/controllers/api/v2/tube_rack_statuses_controller.rb b/app/controllers/api/v2/tube_rack_statuses_controller.rb new file mode 100644 index 0000000000..e3744f8227 --- /dev/null +++ b/app/controllers/api/v2/tube_rack_statuses_controller.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module Api + module V2 + # Provides a JSON API controller for TubeRackStatus + # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + class TubeRackStatusesController < JSONAPI::ResourceController + # By default JSONAPI::ResourceController provides most the standard + # behaviour, and in many cases this file may be left empty. + end + end +end diff --git a/app/resources/api/v2/aliquot_resource.rb b/app/resources/api/v2/aliquot_resource.rb index 639f081ee7..fae4ea85dd 100644 --- a/app/resources/api/v2/aliquot_resource.rb +++ b/app/resources/api/v2/aliquot_resource.rb @@ -2,11 +2,18 @@ module Api module V2 - # Provides a JSON API representation of aliquot - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/aliquots/` endpoint. + # + # Provides a JSON:API representation of {Aliquot}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class AliquotResource < BaseResource - # immutable # comment to make the resource mutable - default_includes :tag, :tag2 # Associations diff --git a/app/resources/api/v2/asset_audit_resource.rb b/app/resources/api/v2/asset_audit_resource.rb index a68ec83fb0..b224d7d8e6 100644 --- a/app/resources/api/v2/asset_audit_resource.rb +++ b/app/resources/api/v2/asset_audit_resource.rb @@ -2,33 +2,42 @@ module Api module V2 - # Provides a JSON API representation of AssetAudit - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/asset_audits/` endpoint. + # + # Provides a JSON:API representation of {AssetAudit}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class AssetAuditResource < BaseResource model_name 'AssetAudit' # @!attribute key - # @return [String] the key of the asset audit. + # @return [String] the key of the asset audit. attribute :key # @!attribute message - # @return [String] the message of the asset audit. + # @return [String] the message of the asset audit. attribute :message # @!attribute created_by - # @return [String] the user who created the asset audit. + # @return [String] the user who created the asset audit. attribute :created_by # @!attribute asset_uuid - # @return [String] the uuid of the asset associated with the asset audit. + # @return [String] the uuid of the asset associated with the asset audit. attribute :asset_uuid # @!attribute witnessed_by - # @return [String] the user who witnessed the asset audit. + # @return [String] the user who witnessed the asset audit. attribute :witnessed_by # @!attribute metadata - # @return [Hash] the metadata of the asset audit. + # @return [Hash] the metadata of the asset audit. attribute :metadata # Currently known clients (AssetAudits app) are sending null; unsure of the expected format. # Sets the Asset on the model using the UUID provided in the API create/update request. diff --git a/app/resources/api/v2/asset_resource.rb b/app/resources/api/v2/asset_resource.rb index d763e7e6ca..543572da58 100644 --- a/app/resources/api/v2/asset_resource.rb +++ b/app/resources/api/v2/asset_resource.rb @@ -2,7 +2,17 @@ module Api module V2 - # AssetResource + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/assets/` endpoint. + # + # Provides a JSON:API representation of {Asset}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class AssetResource < BaseResource attributes :uuid diff --git a/app/resources/api/v2/base_resource.rb b/app/resources/api/v2/base_resource.rb index a5471641d1..9b43fe9940 100644 --- a/app/resources/api/v2/base_resource.rb +++ b/app/resources/api/v2/base_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides extensions to JSONAPI::Resource as well as global behaviour - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @api V2 + # @abstract + # + # @todo This documentation does not yet include complete descriptions of methods and what this class offers to its + # sub-classes. + # + # Provides a base class for JSON:API representations of {ApplicationRecord} sub-classes. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class BaseResource < JSONAPI::Resource abstract diff --git a/app/resources/api/v2/comment_resource.rb b/app/resources/api/v2/comment_resource.rb index 135513b3e3..19f8a3c9b0 100644 --- a/app/resources/api/v2/comment_resource.rb +++ b/app/resources/api/v2/comment_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of Comment - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/comments/` endpoint. + # + # Provides a JSON:API representation of {Comment}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class CommentResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required # Associations: diff --git a/app/resources/api/v2/custom_metadatum_collection_resource.rb b/app/resources/api/v2/custom_metadatum_collection_resource.rb index 407e60b68b..15739cce22 100644 --- a/app/resources/api/v2/custom_metadatum_collection_resource.rb +++ b/app/resources/api/v2/custom_metadatum_collection_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of custom_metadatum_collection - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/custom_metadatum_collections/` endpoint. + # + # Provides a JSON:API representation of {CustomMetadatumCollection}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class CustomMetadatumCollectionResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object, :custom_metadata diff --git a/app/resources/api/v2/fragment_resource.rb b/app/resources/api/v2/fragment_resource.rb index e7d00e33f0..8d7102c5ae 100644 --- a/app/resources/api/v2/fragment_resource.rb +++ b/app/resources/api/v2/fragment_resource.rb @@ -2,7 +2,17 @@ module Api module V2 - # Fragment + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/fragments/` endpoint. + # + # Provides a JSON:API representation of {Fragment}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class FragmentResource < JSONAPI::Resource attributes :uuid end diff --git a/app/resources/api/v2/labware_resource.rb b/app/resources/api/v2/labware_resource.rb index 9401bffeff..0856dd4f6f 100644 --- a/app/resources/api/v2/labware_resource.rb +++ b/app/resources/api/v2/labware_resource.rb @@ -2,7 +2,17 @@ module Api module V2 - # LabwareResource + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/labware/` endpoint. + # + # Provides a JSON:API representation of {Labware}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class LabwareResource < BaseResource # We import most labware shared behaviour, this includes associations, # attributes and filters. By adding behaviour here we ensure that it diff --git a/app/resources/api/v2/lane_resource.rb b/app/resources/api/v2/lane_resource.rb index 734a6d34eb..e87a2fc3eb 100644 --- a/app/resources/api/v2/lane_resource.rb +++ b/app/resources/api/v2/lane_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of receptacle - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/lanes/` endpoint. + # + # Provides a JSON:API representation of {Lane}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class LaneResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # Associations: has_many :samples diff --git a/app/resources/api/v2/lot_resource.rb b/app/resources/api/v2/lot_resource.rb index 86ad91ef94..20c8ee55b5 100644 --- a/app/resources/api/v2/lot_resource.rb +++ b/app/resources/api/v2/lot_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of Lot - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/lots/` endpoint. + # + # Provides a JSON:API representation of {Lot}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class LotResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/lot_type_resource.rb b/app/resources/api/v2/lot_type_resource.rb index f842daec54..c0eceeccfd 100644 --- a/app/resources/api/v2/lot_type_resource.rb +++ b/app/resources/api/v2/lot_type_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of LotType - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/lot_types/` endpoint. + # + # Provides a JSON:API representation of {LotType}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class LotTypeResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/order_resource.rb b/app/resources/api/v2/order_resource.rb index 08561b164f..e603d7e8a2 100644 --- a/app/resources/api/v2/order_resource.rb +++ b/app/resources/api/v2/order_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of order - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/orders/` endpoint. + # + # Provides a JSON:API representation of {Order}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class OrderResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/pick_list_resource.rb b/app/resources/api/v2/pick_list_resource.rb index 8aa78d5245..874c1e163d 100644 --- a/app/resources/api/v2/pick_list_resource.rb +++ b/app/resources/api/v2/pick_list_resource.rb @@ -2,15 +2,22 @@ module Api module V2 - # Provides a JSON API representation of PickList - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/pick_lists/` endpoint. + # + # Provides a JSON:API representation of {PickList}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PickListResource < BaseResource # Constants... PERMITTED_PICK_ATTRIBUTES = %i[source_receptacle_id study_id project_id].freeze PERMITTED_LABWARE_PICK_ATTRIBUTES = %i[source_labware_id source_labware_barcode study_id project_id].freeze - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required # Associations diff --git a/app/resources/api/v2/plate_purpose_resource.rb b/app/resources/api/v2/plate_purpose_resource.rb index f4ba76f83e..138e929181 100644 --- a/app/resources/api/v2/plate_purpose_resource.rb +++ b/app/resources/api/v2/plate_purpose_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of PlatePurpose - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/plate_purposes/` endpoint. + # + # Provides a JSON:API representation of {PlatePurpose}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PlatePurposeResource < BaseResource model_name 'PlatePurpose' @@ -13,34 +22,34 @@ class PlatePurposeResource < BaseResource # The following attributes are sent by Limber for a new plate purpose. - # @!attribute [rw] - # @return [String] The name of the plate purpose. + # @!attribute [rw] name + # @return [String] the name of the plate purpose. attribute :name - # @!attribute [rw] - # @return [Boolean] Whether the plates of this purpose are stock plates. + # @!attribute [rw] stock_plate + # @return [Boolean] whether the plates of this purpose are stock plates. attribute :stock_plate - # @!attribute [rw] - # @return [Boolean] Whether the plates of this purpose are cherrypickable. + # @!attribute [rw] cherrypickable_target + # @return [Boolean] whether the plates of this purpose are cherrypickable. attribute :cherrypickable_target - # @!attribute [rw] - # @return [Boolean] Whether the plates of this purpose are input plates. + # @!attribute [rw] input_plate + # @return [Boolean] whether the plates of this purpose are input plates. attribute :input_plate - # @!attribute [rw] - # @return [Integer] The size of the plates of this purpose. + # @!attribute [rw] size + # @return [Integer] the size of the plates of this purpose. attribute :size - # @!attribute [rw] - # @return [String] The name of the shape of the plates of this purpose. + # @!attribute [rw] asset_shape + # @return [String] the name of the shape of the plates of this purpose. attribute :asset_shape # The following attribute is required by Limber to store purposes. - # @!attribute [r] - # @return [String] gets the UUID of the plate purpose. + # @!attribute [r] uuid + # @return [String] the UUID of the plate purpose. attribute :uuid # Sets the asset shape of the plate purpose by name if given. diff --git a/app/resources/api/v2/plate_resource.rb b/app/resources/api/v2/plate_resource.rb index 6747f6be0b..9a0cfc13cf 100644 --- a/app/resources/api/v2/plate_resource.rb +++ b/app/resources/api/v2/plate_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of Plate - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/plates/` endpoint. + # + # Provides a JSON:API representation of {Plate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PlateResource < BaseResource # We import most labware shared behaviour, this includes associations, # attributes and filters @@ -13,8 +22,6 @@ class PlateResource < BaseResource # Constants... - # immutable # comment to make the resource mutable - default_includes :uuid_object, :barcodes, :plate_purpose, :transfer_requests # Associations: diff --git a/app/resources/api/v2/plate_template_resource.rb b/app/resources/api/v2/plate_template_resource.rb index 5e4ebef7bd..abdb47375d 100644 --- a/app/resources/api/v2/plate_template_resource.rb +++ b/app/resources/api/v2/plate_template_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of PlateTemplate - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/plate_templates/` endpoint. + # + # Provides a JSON:API representation of {PlateTemplate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PlateTemplateResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/poly_metadatum_resource.rb b/app/resources/api/v2/poly_metadatum_resource.rb index 031f444c6d..32e69b6ece 100644 --- a/app/resources/api/v2/poly_metadatum_resource.rb +++ b/app/resources/api/v2/poly_metadatum_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of PolyMetadatum - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/poly_metadata/` endpoint. + # + # Provides a JSON:API representation of {PolyMetadatum}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PolyMetadatumResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required # Associations: diff --git a/app/resources/api/v2/pre_capture_pool_resource.rb b/app/resources/api/v2/pre_capture_pool_resource.rb index 6d181fe879..c3755d0102 100644 --- a/app/resources/api/v2/pre_capture_pool_resource.rb +++ b/app/resources/api/v2/pre_capture_pool_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of pre_capture_pool - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/pre_capture_pools/` endpoint. + # + # Provides a JSON:API representation of {PreCapturePool}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PreCapturePoolResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/primer_panel_resource.rb b/app/resources/api/v2/primer_panel_resource.rb index aa45bb63ab..f273a97f80 100644 --- a/app/resources/api/v2/primer_panel_resource.rb +++ b/app/resources/api/v2/primer_panel_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of primer_panel - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/primer_panels/` endpoint. + # + # Provides a JSON:API representation of {PrimerPanel}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PrimerPanelResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required attribute :name, readonly: true attribute :programs, readonly: true diff --git a/app/resources/api/v2/project_resource.rb b/app/resources/api/v2/project_resource.rb index 6cb3d19b39..25fdb44d63 100644 --- a/app/resources/api/v2/project_resource.rb +++ b/app/resources/api/v2/project_resource.rb @@ -2,8 +2,20 @@ module Api module V2 + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/projects/` endpoint. + # + # Provides a JSON:API representation of {Project}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class ProjectResource < BaseResource - immutable # comment to make the resource mutable + immutable default_includes :uuid_object diff --git a/app/resources/api/v2/purpose_resource.rb b/app/resources/api/v2/purpose_resource.rb index a9b4a0afcd..0c26a6b88d 100644 --- a/app/resources/api/v2/purpose_resource.rb +++ b/app/resources/api/v2/purpose_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of purpose - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/purposes/` endpoint. + # + # Provides a JSON:API representation of {Purpose}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class PurposeResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/qc_assay_resource.rb b/app/resources/api/v2/qc_assay_resource.rb index 06fdb08bba..7dae2e1d1d 100644 --- a/app/resources/api/v2/qc_assay_resource.rb +++ b/app/resources/api/v2/qc_assay_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of QC Assay - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/qc_assays/` endpoint. + # + # Provides a JSON:API representation of {QcAssay}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class QcAssayResource < BaseResource attribute :lot_number attribute :qc_results diff --git a/app/resources/api/v2/qc_result_resource.rb b/app/resources/api/v2/qc_result_resource.rb index 3a5166ea5b..1e20037179 100644 --- a/app/resources/api/v2/qc_result_resource.rb +++ b/app/resources/api/v2/qc_result_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of QC Result - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/qc_results/` endpoint. + # + # Provides a JSON:API representation of {QcResult}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class QcResultResource < BaseResource attributes :key, :value, :units, :cv, :assay_type, :assay_version diff --git a/app/resources/api/v2/qcable_resource.rb b/app/resources/api/v2/qcable_resource.rb index c1c1d8dfc0..5e9f45e178 100644 --- a/app/resources/api/v2/qcable_resource.rb +++ b/app/resources/api/v2/qcable_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of Qcable - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/qcables/` endpoint. + # + # Provides a JSON:API representation of {Qcable}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class QcableResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object, :barcodes diff --git a/app/resources/api/v2/racked_tube_resource.rb b/app/resources/api/v2/racked_tube_resource.rb index 16e7b2eb5e..452c60fd22 100644 --- a/app/resources/api/v2/racked_tube_resource.rb +++ b/app/resources/api/v2/racked_tube_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of a RackedTube - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/racked_tubes/` endpoint. + # + # Provides a JSON:API representation of {RackedTube}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class RackedTubeResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required # Associations: diff --git a/app/resources/api/v2/receptacle_resource.rb b/app/resources/api/v2/receptacle_resource.rb index be010bc6a1..f42b677e43 100644 --- a/app/resources/api/v2/receptacle_resource.rb +++ b/app/resources/api/v2/receptacle_resource.rb @@ -2,16 +2,23 @@ module Api module V2 - # Provides a JSON API representation of a receptacle - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/receptacles/` endpoint. + # + # Provides a JSON:API representation of {Receptacle}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class ReceptacleResource < BaseResource # We import most receptacle shared behaviour, this includes associations, # attributes and filters. By adding behaviour here we ensure that it # is automatically available on well. include Api::V2::SharedBehaviour::Receptacle - # immutable # uncomment to make the resource immutable - default_includes :uuid_object # Associations: diff --git a/app/resources/api/v2/request_resource.rb b/app/resources/api/v2/request_resource.rb index 968bcba398..1c5788ed2f 100644 --- a/app/resources/api/v2/request_resource.rb +++ b/app/resources/api/v2/request_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of request - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/requests/` endpoint. + # + # Provides a JSON:API representation of {Request}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class RequestResource < BaseResource # Constants... - # immutable # comment to make the resource mutable - # model_name / model_hint if required default_includes :uuid_object, diff --git a/app/resources/api/v2/request_type_resource.rb b/app/resources/api/v2/request_type_resource.rb index ce7d0f3ff0..8b70c4569d 100644 --- a/app/resources/api/v2/request_type_resource.rb +++ b/app/resources/api/v2/request_type_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of request_type - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/request_types/` endpoint. + # + # Provides a JSON:API representation of {RequestType}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class RequestTypeResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/sample_manifest_resource.rb b/app/resources/api/v2/sample_manifest_resource.rb index c8c8d5dd2b..7ca8d7eb9f 100644 --- a/app/resources/api/v2/sample_manifest_resource.rb +++ b/app/resources/api/v2/sample_manifest_resource.rb @@ -2,10 +2,20 @@ module Api module V2 - # Class required by json-api-resources gem to support serving the information from - # a sample manifest. + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/sample_manifests/` endpoint. + # + # Provides a JSON:API representation of {SampleManifest}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class SampleManifestResource < BaseResource - immutable # comment to make the resource mutable + immutable default_includes :uuid_object diff --git a/app/resources/api/v2/sample_metadata_resource.rb b/app/resources/api/v2/sample_metadata_resource.rb index f96d48393e..200bf8c489 100644 --- a/app/resources/api/v2/sample_metadata_resource.rb +++ b/app/resources/api/v2/sample_metadata_resource.rb @@ -2,7 +2,18 @@ module Api module V2 - # SampleMetadataResource + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/sample_metadata/` endpoint. + # + # Provides a JSON:API representation of {Sample::Metadata}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class SampleMetadataResource < BaseResource # Set add_model_hint true to allow updates from Limber, otherwise get a # 500 error as it looks for resource Api::V2::MetadatumResource @@ -12,40 +23,40 @@ class SampleMetadataResource < BaseResource # Attributes ### - # @!attribute [rw] - # @return [String] The sample cohort. + # @!attribute [rw] cohort + # @return [String] the sample cohort. attribute :cohort - # @!attribute [rw] - # @return [String] The name of the body collecting the sample. + # @!attribute [rw] collected_by + # @return [String] the name of the body collecting the sample. attribute :collected_by - # @!attribute [rw] - # @return [String] The sample concentration. + # @!attribute [rw] concentration + # @return [String] the sample concentration. attribute :concentration - # @!attribute [rw] - # @return [String] The ID of the sample donor. + # @!attribute [rw] donor_id + # @return [String] the ID of the sample donor. attribute :donor_id - # @!attribute [rw] - # @return [String] The gender of the organism providing the sample. + # @!attribute [rw] gender + # @return [String] the gender of the organism providing the sample. attribute :gender - # @!attribute [rw] - # @return [String] The common name for the sample. + # @!attribute [rw] sample_common_name + # @return [String] the common name for the sample. attribute :sample_common_name - # @!attribute [rw] - # @return [String] A description of the sample. + # @!attribute [rw] sample_description + # @return [String] a description of the sample. attribute :sample_description - # @!attribute [rw] - # @return [String] The supplier name for the sample. + # @!attribute [rw] supplier_name + # @return [String] the supplier name for the sample. attribute :supplier_name - # @!attribute [rw] - # @return [String] The volume of the sample. + # @!attribute [rw] volume + # @return [String] the volume of the sample. attribute :volume ### diff --git a/app/resources/api/v2/sample_resource.rb b/app/resources/api/v2/sample_resource.rb index bce06ed299..c831493d20 100644 --- a/app/resources/api/v2/sample_resource.rb +++ b/app/resources/api/v2/sample_resource.rb @@ -2,11 +2,18 @@ module Api module V2 - # Class required by json-api-resources gem to be able to read the information of - # a sample + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/samples/` endpoint. + # + # Provides a JSON:API representation of {Sample}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class SampleResource < BaseResource - # immutable # comment to make the resource mutable - default_includes :uuid_object has_one :sample_metadata, class_name: 'SampleMetadata', foreign_key_on: :related diff --git a/app/resources/api/v2/shared_behaviour/labware.rb b/app/resources/api/v2/shared_behaviour/labware.rb index 37417dbdc5..6f0858fa1d 100644 --- a/app/resources/api/v2/shared_behaviour/labware.rb +++ b/app/resources/api/v2/shared_behaviour/labware.rb @@ -7,62 +7,75 @@ # on its effective subclasses (Liskov Substitution Principle) this is especially # true for relationships, as it means we support pre-loading those relationships # on mixed endpoints -module Api::V2::SharedBehaviour::Labware - extend ActiveSupport::Concern +module Api + module V2 + module SharedBehaviour + module Labware + extend ActiveSupport::Concern - included do - # Associations: - has_one :purpose, readonly: true, foreign_key: :plate_purpose_id, class_name: 'Purpose' - has_one :custom_metadatum_collection, foreign_key_on: :related + included do + # Associations: + has_one :purpose, readonly: true, foreign_key: :plate_purpose_id, class_name: 'Purpose' + has_one :custom_metadatum_collection, foreign_key_on: :related - has_many :samples, readonly: true - has_many :studies, readonly: true - has_many :projects, readonly: true - has_many :comments, readonly: true + has_many :samples, readonly: true + has_many :studies, readonly: true + has_many :projects, readonly: true + has_many :comments, readonly: true - # If we are using api/v2/labware to pull back a list of labware, we may - # expect a mix of plates and tubes. If we want to eager load their - # contents we use the generic 'receptacles' association. - has_many :receptacles, readonly: true, polymorphic: true - has_many :ancestors, readonly: true, polymorphic: true - has_many :descendants, readonly: true, polymorphic: true - has_many :parents, readonly: true, polymorphic: true - has_many :children, readonly: true, polymorphic: true - has_many :child_plates, readonly: true - has_many :child_tubes, readonly: true - has_many :direct_submissions, readonly: true - has_many :state_changes, readonly: true + # If we are using api/v2/labware to pull back a list of labware, we may + # expect a mix of plates and tubes. If we want to eager load their + # contents we use the generic 'receptacles' association. + has_many :receptacles, readonly: true, polymorphic: true + has_many :ancestors, readonly: true, polymorphic: true + has_many :descendants, readonly: true, polymorphic: true + has_many :parents, readonly: true, polymorphic: true + has_many :children, readonly: true, polymorphic: true + has_many :child_plates, readonly: true + has_many :child_tubes, readonly: true + has_many :direct_submissions, readonly: true + has_many :state_changes, readonly: true - # Attributes - attribute :uuid, readonly: true - attribute :name, delegate: :display_name, readonly: true - attribute :labware_barcode, readonly: true - attribute :state, readonly: true - attribute :created_at, readonly: true - attribute :updated_at, readonly: true + # Attributes + attribute :uuid, readonly: true + attribute :name, delegate: :display_name, readonly: true + attribute :labware_barcode, readonly: true + attribute :state, readonly: true + attribute :created_at, readonly: true + attribute :updated_at, readonly: true - # Scopes - filter :barcode, apply: ->(records, value, _options) { records.with_barcode(value) } - filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) } - filter :purpose_name, - apply: (lambda { |records, value, _options| records.joins(:purpose).where(plate_purposes: { name: value }) }) - filter :purpose_id, apply: ->(records, value, _options) { records.where(plate_purpose_id: value) } - filter :without_children, apply: ->(records, _value, _options) { records.without_children } - filter :created_at_gt, - apply: (lambda { |records, value, _options| records.where('labware.created_at > ?', value[0].to_date) }) - filter :updated_at_gt, - apply: (lambda { |records, value, _options| records.where('labware.updated_at > ?', value[0].to_date) }) - filter :include_used, apply: ->(records, value, _options) { records.include_labware_with_children(value) } - end + # Scopes + filter :barcode, apply: ->(records, value, _options) { records.with_barcode(value) } + filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) } + filter :purpose_name, + apply: + ( + lambda do |records, value, _options| + records.joins(:purpose).where(plate_purposes: { name: value }) + end + ) + filter :purpose_id, apply: ->(records, value, _options) { records.where(plate_purpose_id: value) } + filter :without_children, apply: ->(records, _value, _options) { records.without_children } + filter :created_at_gt, + apply: + (lambda { |records, value, _options| records.where('labware.created_at > ?', value[0].to_date) }) + filter :updated_at_gt, + apply: + (lambda { |records, value, _options| records.where('labware.updated_at > ?', value[0].to_date) }) + filter :include_used, apply: ->(records, value, _options) { records.include_labware_with_children(value) } + end - # Custom methods - # These shouldn't be used for business logic, and a more about - # I/O and isolating implementation details. - def labware_barcode - { - 'ean13_barcode' => _model.ean13_barcode, - 'machine_barcode' => _model.machine_barcode, - 'human_barcode' => _model.human_barcode - } + # Custom methods + # These shouldn't be used for business logic, and a more about + # I/O and isolating implementation details. + def labware_barcode + { + 'ean13_barcode' => _model.ean13_barcode, + 'machine_barcode' => _model.machine_barcode, + 'human_barcode' => _model.human_barcode + } + end + end + end end end diff --git a/app/resources/api/v2/shared_behaviour/receptacle.rb b/app/resources/api/v2/shared_behaviour/receptacle.rb index b66bc27bb1..0b77436614 100644 --- a/app/resources/api/v2/shared_behaviour/receptacle.rb +++ b/app/resources/api/v2/shared_behaviour/receptacle.rb @@ -6,44 +6,50 @@ # sense to ensure that all methods present on Receptacle are also on Well # (Liskov Substitution Principle) this is especially true for relationships, # as it means we support pre-loading those relationships on mixed endpoints -module Api::V2::SharedBehaviour::Receptacle - extend ActiveSupport::Concern - - included do - ::Tube.descendants.each { |subclass| model_hint model: subclass, resource: :tube } - - # Associations: - has_many :samples, readonly: true - has_many :studies, readonly: true - has_many :projects, readonly: true - - has_many :requests_as_source, readonly: true - has_many :requests_as_target, readonly: true - has_many :qc_results, readonly: true - has_many :aliquots, readonly: true - - has_many :downstream_assets, readonly: true, polymorphic: true - has_many :downstream_wells, readonly: true - has_many :downstream_plates, readonly: true - has_many :downstream_tubes, readonly: true - - has_many :upstream_assets, readonly: true, polymorphic: true - has_many :upstream_wells, readonly: true - has_many :upstream_plates, readonly: true - has_many :upstream_tubes, readonly: true - - has_many :transfer_requests_as_source, readonly: true - has_many :transfer_requests_as_target, readonly: true - - has_one :labware, readonly: true - - # Attributes - attribute :uuid, readonly: true - attribute :name, delegate: :display_name, readonly: true - attributes :pcr_cycles, :submit_for_sequencing, :sub_pool, :coverage, :diluent_volume - attribute :state, readonly: true - - # Filters - filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) } +module Api + module V2 + module SharedBehaviour + module Receptacle + extend ActiveSupport::Concern + + included do + ::Tube.descendants.each { |subclass| model_hint model: subclass, resource: :tube } + + # Associations: + has_many :samples, readonly: true + has_many :studies, readonly: true + has_many :projects, readonly: true + + has_many :requests_as_source, readonly: true + has_many :requests_as_target, readonly: true + has_many :qc_results, readonly: true + has_many :aliquots, readonly: true + + has_many :downstream_assets, readonly: true, polymorphic: true + has_many :downstream_wells, readonly: true + has_many :downstream_plates, readonly: true + has_many :downstream_tubes, readonly: true + + has_many :upstream_assets, readonly: true, polymorphic: true + has_many :upstream_wells, readonly: true + has_many :upstream_plates, readonly: true + has_many :upstream_tubes, readonly: true + + has_many :transfer_requests_as_source, readonly: true + has_many :transfer_requests_as_target, readonly: true + + has_one :labware, readonly: true + + # Attributes + attribute :uuid, readonly: true + attribute :name, delegate: :display_name, readonly: true + attributes :pcr_cycles, :submit_for_sequencing, :sub_pool, :coverage, :diluent_volume + attribute :state, readonly: true + + # Filters + filter :uuid, apply: ->(records, value, _options) { records.with_uuid(value) } + end + end + end end end diff --git a/app/resources/api/v2/state_change_resource.rb b/app/resources/api/v2/state_change_resource.rb index de4c9941ef..b2b6e86182 100644 --- a/app/resources/api/v2/state_change_resource.rb +++ b/app/resources/api/v2/state_change_resource.rb @@ -2,8 +2,20 @@ module Api module V2 + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/state_changes/` endpoint. + # + # Provides a JSON:API representation of {StateChange}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class StateChangeResource < BaseResource - immutable # comment to make the resource mutable + immutable attribute :previous_state attribute :target_state diff --git a/app/resources/api/v2/study_resource.rb b/app/resources/api/v2/study_resource.rb index 8334537498..f36b2bd50c 100644 --- a/app/resources/api/v2/study_resource.rb +++ b/app/resources/api/v2/study_resource.rb @@ -2,8 +2,20 @@ module Api module V2 + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/studies/` endpoint. + # + # Provides a JSON:API representation of {Study}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class StudyResource < BaseResource - immutable # comment to make the resource mutable + immutable attribute :name attribute :uuid diff --git a/app/resources/api/v2/submission_resource.rb b/app/resources/api/v2/submission_resource.rb index b5561f1bb4..f3a5335d65 100644 --- a/app/resources/api/v2/submission_resource.rb +++ b/app/resources/api/v2/submission_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of submission - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/submissions/` endpoint. + # + # Provides a JSON:API representation of {Submission}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class SubmissionResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/submission_template_resource.rb b/app/resources/api/v2/submission_template_resource.rb index f72d3fbaa7..cee638c27d 100644 --- a/app/resources/api/v2/submission_template_resource.rb +++ b/app/resources/api/v2/submission_template_resource.rb @@ -2,8 +2,18 @@ module Api module V2 - # Provides a JSON API representation of a submission template. - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/submission_templates/` endpoint. + # + # Provides a JSON:API representation of {SubmissionTemplate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class SubmissionTemplateResource < BaseResource immutable @@ -13,12 +23,12 @@ class SubmissionTemplateResource < BaseResource # Attributes ### - # @!attribute [r] - # @return [String] The name of the submission template. + # @!attribute [rw] name + # @return [String] the name of the submission template. attribute :name - # @!attribute [r] - # @return [String] The UUID of the submission template. + # @!attribute [r] uuid + # @return [String] the UUID of the submission template. attribute :uuid, readonly: true end end diff --git a/app/resources/api/v2/tag_group_adapter_type_resource.rb b/app/resources/api/v2/tag_group_adapter_type_resource.rb index 78cd6bf8e3..fc2cb5047e 100644 --- a/app/resources/api/v2/tag_group_adapter_type_resource.rb +++ b/app/resources/api/v2/tag_group_adapter_type_resource.rb @@ -2,17 +2,22 @@ module Api module V2 - # Provides a JSON API representation of a tag group AdapterType - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/tag_group_adapter_types/` endpoint. + # + # Provides a JSON:API representation of {TagGroup::AdapterType}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TagGroupAdapterTypeResource < BaseResource - model_name 'TagGroup::AdapterType', add_model_hint: false + model_name 'TagGroup::AdapterType' # Constants... - # immutable # uncomment to make the resource immutable - - # model_name / model_hint if required - # Associations: has_many :tag_groups, readonly: true, class_name: 'TagGroup' diff --git a/app/resources/api/v2/tag_group_resource.rb b/app/resources/api/v2/tag_group_resource.rb index 4552cd6ed9..7b2409b61f 100644 --- a/app/resources/api/v2/tag_group_resource.rb +++ b/app/resources/api/v2/tag_group_resource.rb @@ -2,13 +2,20 @@ module Api module V2 - # Provides a JSON API representation of TagGroup - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/tag_groups/` endpoint. + # + # Provides a JSON:API representation of {TagGroup}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TagGroupResource < BaseResource # Constants... - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object, :tags diff --git a/app/resources/api/v2/tag_layout_template_resource.rb b/app/resources/api/v2/tag_layout_template_resource.rb index ab633c4429..4dd63a48a2 100644 --- a/app/resources/api/v2/tag_layout_template_resource.rb +++ b/app/resources/api/v2/tag_layout_template_resource.rb @@ -2,27 +2,65 @@ module Api module V2 - # Provides a JSON API representation of TagLayoutTemplate - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/tag_layout_templates/` endpoint. + # + # Provides a JSON:API representation of {TagLayoutTemplate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TagLayoutTemplateResource < BaseResource # Constants... # immutable # uncomment to make the resource immutable - # model_name / model_hint if required - - default_includes :uuid_object - - # Associations: + # @!attribute [r] tag_group + # A relationship for the primary tag group associated with the tag layout template. + # @return [Api::V2::TagGroupResource] has_one :tag_group has_one :tag2_group + # @!attribute [r] tag2_group + # A relationship for the secondary tag group associated with the tag layout template. + # This is used during dual indexing, but will not be found during single indexing. + # @return [Api::V2::TagGroupResource] + has_one :tag2_group, class_name: 'TagGroup' + + ### # Attributes + ### + + # @!attribute [r] uuid + # The UUID of the tag layout template. + # @return [String] attribute :uuid, readonly: true + + # @!attribute [r] name + # The display name of the tag layout template. + # @return [String] + attribute :name, readonly: true + + # @!attribute [r] direction + # The name of the algorithm defining the direction of the tag layout. + # @return [String] attribute :direction, readonly: true + + # @!attribute [r] walking_by + # The name of the algorithm defining the way of walking through the tag layout. + # @return [String] attribute :walking_by, readonly: true # Filters + ### + + # @!method enabled + # A filter to return only enabled tag layout templates. + # Set by default to `true`. filter :enabled, default: true # Custom methods diff --git a/app/resources/api/v2/tag_resource.rb b/app/resources/api/v2/tag_resource.rb index 3f1048f559..4c75af8311 100644 --- a/app/resources/api/v2/tag_resource.rb +++ b/app/resources/api/v2/tag_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of aliquot - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/tags/` endpoint. + # + # Provides a JSON:API representation of {Tag}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TagResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/template_resource.rb b/app/resources/api/v2/template_resource.rb index bdee319f56..a462ec61c9 100644 --- a/app/resources/api/v2/template_resource.rb +++ b/app/resources/api/v2/template_resource.rb @@ -2,6 +2,8 @@ module Api module V2 + # @abstract + # # This stub class is here to appease a problem with JSONAPI v0.9 # and polymorphic relationships. Also stubbing the TemplatesController. class TemplateResource < BaseResource diff --git a/app/resources/api/v2/transfer_request_resource.rb b/app/resources/api/v2/transfer_request_resource.rb index 9034f9f5a7..084f34a07c 100644 --- a/app/resources/api/v2/transfer_request_resource.rb +++ b/app/resources/api/v2/transfer_request_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of TransferRequest - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/transfer_requests/` endpoint. + # + # Provides a JSON:API representation of {TransferRequest}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TransferRequestResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/transfer_template_resource.rb b/app/resources/api/v2/transfer_template_resource.rb index 6a41f76373..4439e74191 100644 --- a/app/resources/api/v2/transfer_template_resource.rb +++ b/app/resources/api/v2/transfer_template_resource.rb @@ -2,8 +2,18 @@ module Api module V2 - # Provides a JSON API representation of a transfer template. - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/transfer_templates/` endpoint. + # + # Provides a JSON:API representation of {TransferTemplate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TransferTemplateResource < BaseResource immutable @@ -13,12 +23,12 @@ class TransferTemplateResource < BaseResource # Attributes ### - # @!attribute [r] - # @return [String] The name of the transfer template. + # @!attribute [r] name + # @return [String] the name of the transfer template. attribute :name - # @!attribute [r] - # @return [String] The UUID of the transfer template. + # @!attribute [r] uuid + # @return [String] the UUID of the transfer template. attribute :uuid, readonly: true end end diff --git a/app/resources/api/v2/tube_purpose_resource.rb b/app/resources/api/v2/tube_purpose_resource.rb index aa08d628d1..44f34e4345 100644 --- a/app/resources/api/v2/tube_purpose_resource.rb +++ b/app/resources/api/v2/tube_purpose_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of a tube purpose. - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/tube_purposes/` endpoint. + # + # Provides a JSON:API representation of {Tube::Purpose}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TubePurposeResource < BaseResource model_name 'Tube::Purpose' @@ -11,21 +20,21 @@ class TubePurposeResource < BaseResource # Attributes ##### - # @!attribute [rw] - # @return [String] The name of the tube purpose. + # @!attribute [rw] name + # @return [String] the name of the tube purpose. attribute :name - # @!attribute [rw] - # @return [String] The purpose type. This is mapped to the type attribute on the model. + # @!attribute [rw] purpose_type + # @return [String] the purpose type. This is mapped to the type attribute on the model. attribute :purpose_type, delegate: :type - # @!attribute [rw] - # @return [String] The target type. + # @!attribute [rw] target_type + # @return [String] the target type. attribute :target_type - # @!attribute [r] - # @return [String] The UUID of the tube purpose. - attribute :uuid + # @!attribute [r] uuid + # @return [String] the UUID of the tube purpose. + attribute :uuid, readonly: true # Gets the list of fields which are creatable on a TubePurpose. # @@ -42,6 +51,8 @@ def self.creatable_fields(_context) def self.updatable_fields(_context) super - %i[uuid] # Do not allow creating with any readonly fields end + + filter :type, default: 'Tube::Purpose' end end end diff --git a/app/resources/api/v2/tube_rack_resource.rb b/app/resources/api/v2/tube_rack_resource.rb index e2b35aa8bc..72004ae850 100644 --- a/app/resources/api/v2/tube_rack_resource.rb +++ b/app/resources/api/v2/tube_rack_resource.rb @@ -2,8 +2,17 @@ module Api module V2 - # Provides a JSON API representation of TubeRack - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/tube_racks/` endpoint. + # + # Provides a JSON:API representation of {TubeRack}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TubeRackResource < BaseResource # Constants... @@ -13,8 +22,6 @@ class TubeRackResource < BaseResource # Instead this should be done as part of adding authentication to # the API in the security OKR. - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object, :barcodes diff --git a/app/resources/api/v2/tube_rack_status_resource.rb b/app/resources/api/v2/tube_rack_status_resource.rb index 0c70d83346..eedfa63f02 100644 --- a/app/resources/api/v2/tube_rack_status_resource.rb +++ b/app/resources/api/v2/tube_rack_status_resource.rb @@ -2,11 +2,18 @@ module Api module V2 - # Provides a JSON API representation of TubeRackStatus - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/tube_rack_statuses/` endpoint. + # + # Provides a JSON:API representation of {TubeRackStatus}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TubeRackStatusResource < BaseResource - # immutable # uncomment to make the resource immutable - # model_name / model_hint if required default_includes :uuid_object diff --git a/app/resources/api/v2/tube_resource.rb b/app/resources/api/v2/tube_resource.rb index 88b78c1cdc..69bf38c62a 100644 --- a/app/resources/api/v2/tube_resource.rb +++ b/app/resources/api/v2/tube_resource.rb @@ -2,14 +2,24 @@ module Api module V2 - # Provides a JSON API representation of Tube - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/tubes/` endpoint. + # + # Provides a JSON:API representation of {Tube}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class TubeResource < BaseResource include Api::V2::SharedBehaviour::Labware # Constants... - immutable # comment to make the resource mutable + immutable default_includes :uuid_object, :barcodes, :transfer_requests_as_target diff --git a/app/resources/api/v2/user_resource.rb b/app/resources/api/v2/user_resource.rb index 228a83f6e5..c899c32d57 100644 --- a/app/resources/api/v2/user_resource.rb +++ b/app/resources/api/v2/user_resource.rb @@ -2,12 +2,22 @@ module Api module V2 - # Provides a JSON API representation of user - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note This resource is immutable: its endpoint will not accept `POST`, `PATCH`, or `DELETE` requests. + # @note Access this resource via the `/api/v2/users/` endpoint. + # + # Provides a JSON:API representation of {User}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class UserResource < BaseResource # Constants... - immutable # comment to make the resource mutable + immutable # model_name / model_hint if required diff --git a/app/resources/api/v2/volume_update_resource.rb b/app/resources/api/v2/volume_update_resource.rb index 9c8ea04f0c..7d4b558f8b 100644 --- a/app/resources/api/v2/volume_update_resource.rb +++ b/app/resources/api/v2/volume_update_resource.rb @@ -2,21 +2,30 @@ module Api module V2 - # Provides a JSON API representation of VolumeUpdate - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/volume_updates/` endpoint. + # + # Provides a JSON:API representation of {VolumeUpdate}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class VolumeUpdateResource < BaseResource model_name 'VolumeUpdate' # @!attribute created_by - # @return [String] the user who created the volume update. + # @return [String] the user who created the volume update. attribute :created_by # @!attribute asset_uuid - # @return [String] the uuid of the target labware associated with the volume update. + # @return [String] the uuid of the target labware associated with the volume update. attribute :target_uuid # @!attribute witnessed_by - # @return [Float] the volume change that occured on the target labware. + # @return [Float] the volume change that occured on the target labware. attribute :volume_change # Sets the target Labware on the model using the UUID provided in the API create/update request. diff --git a/app/resources/api/v2/well_resource.rb b/app/resources/api/v2/well_resource.rb index 32e5469405..d3f69d1e3b 100644 --- a/app/resources/api/v2/well_resource.rb +++ b/app/resources/api/v2/well_resource.rb @@ -2,15 +2,22 @@ module Api module V2 - # Provides a JSON API representation of a well - # See: http://jsonapi-resources.com/ for JSONAPI::Resource documentation + # @todo This documentation does not yet include a detailed description of what this resource represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. + # + # @note Access this resource via the `/api/v2/wells/` endpoint. + # + # Provides a JSON:API representation of {Well}. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. class WellResource < BaseResource include Api::V2::SharedBehaviour::Receptacle # Constants... - # immutable # uncomment to make the resource immutable - default_includes :uuid_object, :map, :transfer_requests_as_target, plate: :barcodes # Associations: diff --git a/app/resources/api/v2/work_order_resource.rb b/app/resources/api/v2/work_order_resource.rb index aca53e5660..fa7274aa2e 100644 --- a/app/resources/api/v2/work_order_resource.rb +++ b/app/resources/api/v2/work_order_resource.rb @@ -4,13 +4,20 @@ module Api module V2 + # @todo This documentation does not yet include a detailed description of what this resource (really) represents. + # @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters. + # @todo This documentation does not yet include any example usage of the API via cURL or similar. # - # Class WorkOrderResource provides an abstraction of - # request for exposure to external applications. It - # is intended to allow us to update the internal - # representation, while maintaining an external - # interface + # @note Access this resource via the `/api/v2/work_orders/` endpoint. # + # Provides a JSON:API representation of {WorkOrder}. + # Work orders provide an abstraction of requests for exposure to external applications. + # They are intended to allow us to update the internal representation, while maintaining an external interface. + # + # For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/) + # or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package for Sequencescape's implementation + # of the JSON:API standard. + class WorkOrderResource < BaseResource IGNORED_METADATA_FIELDS = %w[id request_id created_at updated_at].freeze diff --git a/config/routes.rb b/config/routes.rb index 036d3cb635..41d0b2485f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -50,8 +50,10 @@ jsonapi_resources :studies jsonapi_resources :submission_templates jsonapi_resources :submissions + jsonapi_resources :tag_group_adapter_types jsonapi_resources :tag_groups jsonapi_resources :tag_layout_templates + jsonapi_resources :tags jsonapi_resources :transfer_requests jsonapi_resources :transfer_templates jsonapi_resources :tube_purposes