Class: Api::V2::TubeFromPlateCreationResource

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

Overview

Note:

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

Note:

This resource cannot be modified after creation: its endpoint will not accept PATCH requests.

Provides a JSON:API representation of TubeFromPlateCreation for the creation of a single child tube from a single parent plate. Creation of this resource via a POST request will create the new child tube with the parent as an ancestor. The created child will have the specified purpose and can be accessed via the #child relationship.

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.

Examples:

POST request with child purpose and parent plate specified by UUID (deprecated)

POST /api/v2/tube_from_tube_creations/
{
  "data": {
    "type": "tube_from_plate_creations",
    "attributes": {
      "child_purpose_uuid": "11111111-2222-3333-4444-555555666666",
      "parent_uuid": "33333333-4444-5555-6666-777777888888",
      "user_uuid": "99999999-0000-1111-2222-333333444444"
    }
  }
}

POST request with child purpose and parent plate specified by relationship

POST /api/v2/tube_from_plate_creations/
{
  "data": {
    "type": "tube_from_plate_creations",
    "attributes": {},
    "relationships": {
      "child_purpose": {
        "data": { "type": "tube_purposes", "id": "256" }
      },
      "parent": {
        "data": { "type": "plates", "id": "456" }
      },
      "user": {
        "data": { "type": "users", "id": "2" }
      }
    }
  }
}

GET request for all TubeFromCreation resources

GET /api/v2/tube_from_plate_creations/

GET request for a TubeFromTubeCreation with ID 123

GET /api/v2/tube_from_plate_creations/123/

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseResource

apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields

Instance Attribute Details

#childTubeResource (readonly)

Returns The child tube which was created.

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 111

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#child_purposeTubePurposeResource

Note:

This relationship is required.

Setting this relationship alongside the child_purpose_uuid attribute will override the attribute value.

Returns:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 117

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#child_purpose_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the child_purpose relationship instead.

This is declared for convenience where child purpose is not available to set as a relationship. Setting this attribute alongside the child_purpose relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of a child purpose to use in the creation of the child tube.

Returns:

  • (Void)

See Also:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 68

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#parentPateResource

Note:

This relationship is required.

Setting this relationship alongside the parent_uuid attribute will override the attribute value.

Returns:

  • (PateResource)

    The parent plate of the tube being created.



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 123

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#parent_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the parent relationship instead.

This is declared for convenience where parent is not available to set as a relationship. Setting this attribute alongside the parent relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of tube that will be the parent for the created tube.

Returns:

  • (Void)

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 81

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#userUserResource

Note:

This relationship is required.

Setting this relationship alongside the user_uuid attribute will override the attribute value.

Returns:

  • (UserResource)

    The user who initiated the creation of the tube.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 129

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#user_uuid=(value) ⇒ Void (writeonly)

Deprecated.

Use the user relationship instead. See Y25-236.

This is declared for convenience where the user is not available to set as a relationship. Setting this attribute alongside the user relationship will prefer the relationship value.

Parameters:

  • value (String)

    The UUID of the user who initiated the creation of this tube from a parent tube.

Returns:

  • (Void)

See Also:



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 95

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end

#uuidString (readonly)

Returns The UUID of the tube from plate creation.

Returns:

  • (String)

    The UUID of the tube from plate creation.



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'app/resources/api/v2/tube_from_plate_creation_resource.rb', line 103

 do
  # NOTE: The following attribute is not required for Microarray Genotyping.
  # I think this might be broken and suggests that there should be separate classes for project: one for
  # next-gen sequencing that includes this attribute in it's metadata, and one for microarray genotyping
  # that doesn't.
  include ProjectManager::Associations
  include BudgetDivision::Associations

  custom_attribute(:project_cost_code, required: true)
  custom_attribute(:funding_comments)
  custom_attribute(:collaborators)
  custom_attribute(:external_funding_source)
  custom_attribute(:sequencing_budget_cost_centre)
  custom_attribute(:project_funding_model, in: PROJECT_FUNDING_MODELS)
  custom_attribute(:gt_committee_tracking_id)

  before_validation do |record|
    record.project_cost_code = nil if record.project_cost_code.blank?
    record.project_funding_model = nil if record.project_funding_model.blank?
  end
end