Class: Api::V2::SubmissionResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/submission_resource.rb

Overview

Note:

Access this resource via the /api/v2/submissions/ endpoint.

Note:

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.

Examples:

GET request for all Submission resources

GET /api/v2/submissions/

GET request for a specific Submission by ID

GET /api/v2/submissions/123/

POST request with orders and user

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Returns:

  • (Boolean)


53
54
55
# File 'app/resources/api/v2/submission_resource.rb', line 53

def and_submit=(value)
  @and_submit = value
end

#created_atDateTime (readonly)

Returns The date and time the Submission was created, formatted as an ISO8601 string.

Returns:

  • (DateTime)

    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_sequencingInteger

Note:

This value can only be set once at creation.

The number of lanes of sequencing requested in the Submission.

Returns:

  • (Integer)


75
# File 'app/resources/api/v2/submission_resource.rb', line 75

attribute :lanes_of_sequencing, write_once: true

#nameString

Note:

This value can only be set once at creation.

The name of the Submission.

Returns:

  • (String)


91
# File 'app/resources/api/v2/submission_resource.rb', line 91

attribute :name, write_once: true

#order_uuids=(value) ⇒ Void (writeonly)

Deprecated.

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.

Parameters:

  • value (Array<String>)

    Array of UUIDs of Order resources associated with this Submission.

Returns:

  • (Void)

See Also:



100
# File 'app/resources/api/v2/submission_resource.rb', line 100

attribute :order_uuids, writeonly: true

#ordersArray<Api::V2::OrderResource>

The collection of Order resources associated with the Submission. Setting this relationship alongside order_uuids will override the attribute value.

Returns:



152
# File 'app/resources/api/v2/submission_resource.rb', line 152

has_many :orders, class_name: 'Order'

#stateString (readonly)

The current state of the Submission. Possible values: building, pending, processing, ready, failed, or cancelled.

Returns:

  • (String)


110
# File 'app/resources/api/v2/submission_resource.rb', line 110

attribute :state, readonly: true

#updated_atDateTime (readonly)

Returns The date and time the Submission was last updated, formatted as an ISO8601 string.

Returns:

  • (DateTime)

    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_tagsString

Note:

This value can only be set once at creation.

Tags used in this Submission.

Returns:

  • (String)


116
# File 'app/resources/api/v2/submission_resource.rb', line 116

attribute :used_tags, write_once: true

#userApi::V2::UserResource

Note:

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)

Deprecated.

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.

Parameters:

Returns:

  • (Void)

See Also:



125
# File 'app/resources/api/v2/submission_resource.rb', line 125

attribute :user_uuid, writeonly: true

#uuidString (readonly)

Note:

This value is read-only and is generated automatically.

The unique identifier for the Submission.

Returns:

  • (String)


135
# File 'app/resources/api/v2/submission_resource.rb', line 135

attribute :uuid, readonly: true

Instance Method Details

#filter_uuidObject

Filter Submission resources by UUID.

Examples:

GET request using UUID filter

GET /api/v2/submissions?filter[uuid]=12345678-1234-1234-1234-123456789012


162
# File 'app/resources/api/v2/submission_resource.rb', line 162

filter :uuid, apply: ->(records, value, _options) { 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