Skip to content

Commit 3426327

Browse files
authored
Merge pull request #1670 from sanger/update-ont-request-resource
Update ont request resource
2 parents dab8ba6 + de2a9f5 commit 3426327

1 file changed

Lines changed: 51 additions & 5 deletions

File tree

app/resources/v1/ont/request_resource.rb

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,63 @@
22

33
module V1
44
module Ont
5-
# @todo This documentation does not yet include a detailed description of what this resource represents.
6-
# @todo This documentation does not yet include detailed descriptions for relationships, attributes and filters.
7-
# @todo This documentation does not yet include any example usage of the API via cURL or similar.
5+
# Provides a JSON:API representation of {Ont::Request}.
86
#
97
# @note Access this resource via the `/v1/ont/requests/` endpoint.
108
#
11-
# Provides a JSON:API representation of {Ont::Request}.
12-
#
139
# For more information about JSON:API see the [JSON:API Specifications](https://jsonapi.org/format/)
1410
# or look at the [JSONAPI::Resources](http://jsonapi-resources.com/) package
1511
# for the service implementation of the JSON:API standard.
12+
# This resource represents an ONT Request and can return all requests, a single request or
13+
# multiple requests along with their relationships.
14+
#
15+
# ## Filters:
16+
#
17+
# * sample_name
18+
# * source_identifier
19+
#
20+
# @example
21+
#
22+
# # Get a single request
23+
# curl -X GET http://localhost:3000/v1/ont/requests/1
24+
#
25+
# # Get all requests
26+
# curl -X GET http://localhost:3000/v1/ont/requests/
27+
#
28+
# # Filter requests by sample name or source identifier
29+
# curl -X GET "http://localhost:3000/v1/ont/requests?filter[sample_name]=sample_name"
30+
# curl -X GET "http://localhost:3000/v1/ont/requests?filter[source_identifier]=mock-plate-2:B12"
31+
# curl -X GET "http://localhost:3000/v1/ont/requests?filter[source_identifier]=mock-plate-2:B12,mock-plate-3:A1"
32+
#
33+
# # Create a new ONT request
34+
# curl -X POST http://localhost:3000/v1/ont/requests \
35+
# -H "Content-Type: application/vnd.api+json" \
36+
# -d '{
37+
# "data": {
38+
# "type": "requests",
39+
# "attributes": {
40+
# "library_type": "ONT",
41+
# "data_type": "Basecalling",
42+
# "cost_code": "S12345",
43+
# "external_study_id": "EXT-001",
44+
# "number_of_flowcells": 2,
45+
# "sample_name": "Sample 1"
46+
# }
47+
# }
48+
# }'
49+
#
50+
# # Update an existing ONT request
51+
# curl -X PATCH http://localhost:3000/v1/ont/requests/1 \
52+
# -H "Content-Type: application/vnd.api+json" \
53+
# -d '{
54+
# "data": {
55+
# "id": "1",
56+
# "type": "requests",
57+
# "attributes": {
58+
# "cost_code": "S54321"
59+
# }
60+
# }
61+
#
1662
class RequestResource < JSONAPI::Resource
1763
include Shared::SourceIdentifierFilterable
1864
model_name 'Ont::Request', add_model_hint: false

0 commit comments

Comments
 (0)