Class: Api::V2::SubmissionResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::SubmissionResource
- Defined in:
- app/resources/api/v2/submission_resource.rb
Overview
Access this resource via the /api/v2/submissions/
endpoint.
This resource cannot be modified after creation; its endpoint does not accept PATCH
requests.
POST /api/v2/submissions/ { “data”: { “type”: “submissions”, “attributes”: { “name”: “name”, “and_submit”: true }, “relationships”: { “orders”: { “data”: [ { “type”: “orders”, “id”: “1” }, { “type”: “orders”, “id”: “2” } ] }, “user”: { “data”: { “type”: “users”, “id”: “1” } } } } }
For more information about JSON:API, see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation.
Instance Attribute Summary collapse
-
#and_submit ⇒ Boolean
writeonly
When set to
true
, the Submission transitions frombuilding
topending
after creation. -
#created_at ⇒ DateTime
readonly
The date and time the Submission was created, formatted as an ISO8601 string.
-
#lanes_of_sequencing ⇒ Integer
The number of lanes of sequencing requested in the Submission.
-
#name ⇒ String
The name of the Submission.
-
#order_uuids ⇒ Void
writeonly
deprecated
Deprecated.
Use the
orders
relationship instead. -
#orders ⇒ Array<Api::V2::OrderResource>
The collection of Order resources associated with the Submission.
-
#state ⇒ String
readonly
The current state of the Submission.
-
#updated_at ⇒ DateTime
readonly
The date and time the Submission was last updated, formatted as an ISO8601 string.
-
#used_tags ⇒ String
Tags used in this Submission.
-
#user ⇒ Api::V2::UserResource
The User who created the Submission.
-
#user_uuid ⇒ Void
writeonly
deprecated
Deprecated.
Use the
user
relationship instead. -
#uuid ⇒ String
readonly
The unique identifier for the Submission.
Instance Method Summary collapse
-
#filter_uuid ⇒ Object
Filter Submission resources by UUID.
- #submit! ⇒ Object
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Attribute Details
#and_submit=(value) ⇒ Boolean (writeonly)
When set to true
, the Submission transitions from building
to pending
after creation.
53 54 55 |
# File 'app/resources/api/v2/submission_resource.rb', line 53 def and_submit=(value) @and_submit = value end |
#created_at ⇒ DateTime (readonly)
Returns The date and time the Submission was created, formatted as an ISO8601 string.
65 |
# File 'app/resources/api/v2/submission_resource.rb', line 65 attribute :created_at, readonly: true |
#lanes_of_sequencing ⇒ Integer
This value can only be set once at creation.
The number of lanes of sequencing requested in the Submission.
75 |
# File 'app/resources/api/v2/submission_resource.rb', line 75 attribute :lanes_of_sequencing, write_once: true |
#name ⇒ String
This value can only be set once at creation.
The name of the Submission.
91 |
# File 'app/resources/api/v2/submission_resource.rb', line 91 attribute :name, write_once: true |
#order_uuids=(value) ⇒ Void (writeonly)
Use the orders
relationship instead.
Convenience attribute to associate orders via UUIDs instead of relationships. If both order_uuids
and orders
are set, the orders
relationship takes precedence.
100 |
# File 'app/resources/api/v2/submission_resource.rb', line 100 attribute :order_uuids, writeonly: true |
#orders ⇒ Array<Api::V2::OrderResource>
The collection of Order resources associated with the Submission. Setting this relationship alongside order_uuids
will override the attribute value.
152 |
# File 'app/resources/api/v2/submission_resource.rb', line 152 has_many :orders, class_name: 'Order' |
#state ⇒ String (readonly)
The current state of the Submission. Possible values: building
, pending
, processing
, ready
, failed
, or cancelled
.
110 |
# File 'app/resources/api/v2/submission_resource.rb', line 110 attribute :state, readonly: true |
#updated_at ⇒ DateTime (readonly)
Returns The date and time the Submission was last updated, formatted as an ISO8601 string.
69 |
# File 'app/resources/api/v2/submission_resource.rb', line 69 attribute :updated_at, readonly: true |
#used_tags ⇒ String
This value can only be set once at creation.
Tags used in this Submission.
116 |
# File 'app/resources/api/v2/submission_resource.rb', line 116 attribute :used_tags, write_once: true |
#user ⇒ Api::V2::UserResource
This relationship is required.
The User who created the Submission. Setting this relationship alongside user_uuid
will override the attribute value.
146 |
# File 'app/resources/api/v2/submission_resource.rb', line 146 has_one :user, class_name: 'User' |
#user_uuid=(value) ⇒ Void (writeonly)
Use the user
relationship instead.
Convenience attribute to associate the submitting user via UUID instead of relationships. If both user_uuid
and user
are set, the user
relationship takes precedence.
125 |
# File 'app/resources/api/v2/submission_resource.rb', line 125 attribute :user_uuid, writeonly: true |
#uuid ⇒ String (readonly)
This value is read-only and is generated automatically.
The unique identifier for the Submission.
135 |
# File 'app/resources/api/v2/submission_resource.rb', line 135 attribute :uuid, readonly: true |
Instance Method Details
#filter_uuid ⇒ Object
Filter Submission resources by UUID.
162 |
# File 'app/resources/api/v2/submission_resource.rb', line 162 filter :uuid, apply: ->(records, value, ) { records.with_uuid(value) } |
#submit! ⇒ Object
170 171 172 173 174 |
# File 'app/resources/api/v2/submission_resource.rb', line 170 def submit! return unless @and_submit @model.built! end |