Class: Api::V2::WorkOrderResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::WorkOrderResource
- Defined in:
- app/resources/api/v2/work_order_resource.rb
Overview
the below example is currently broken, as work_order_type
is a required attribute in the model
Provides a JSON:API representation of WorkOrder for managing work orders within the application.
A Work order groups requests together based on Submission and Asset providing a unified interface for external applications.
This resource can be accessed via the /api/v2/work_orders/
endpoint.
For more information about JSON:API, see the JSON:API Specifications or refer to the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.
Constant Summary collapse
- IGNORED_METADATA_FIELDS =
%w[id request_id created_at updated_at].freeze
Instance Attribute Summary collapse
-
#at_risk ⇒ Boolean
Indicates whether the customer accepts responsibility.
- #options ⇒ Object readonly
- #order_type ⇒ Object
-
#project ⇒ ProjectResource
The project associated with the work order.
- #quantity ⇒ Object
-
#samples ⇒ Array<SampleResource>
The samples related to the work order.
-
#source_receptacle ⇒ PolymorphicResource
The source receptacle from which the work order originates.
-
#state(: state) ⇒ Object
Filters work orders by their state.
-
#study ⇒ StudyResource
The study associated with the work order.
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
#at_risk ⇒ Boolean
This attribute is optional.
Indicates whether the customer accepts responsibility
50 |
# File 'app/resources/api/v2/work_order_resource.rb', line 50 attribute :at_risk |
#options ⇒ Object (readonly)
57 |
# File 'app/resources/api/v2/work_order_resource.rb', line 57 attribute :options, readonly: true |
#order_type ⇒ Object
65 |
# File 'app/resources/api/v2/work_order_resource.rb', line 65 attribute :order_type, write_once: true |
#project ⇒ ProjectResource
This relationship is write-once and cannot be modified after creation.
The project associated with the work order.
94 |
# File 'app/resources/api/v2/work_order_resource.rb', line 94 has_one :project, write_once: true |
#quantity ⇒ Object
72 |
# File 'app/resources/api/v2/work_order_resource.rb', line 72 attribute :quantity, write_once: true |
#samples ⇒ Array<SampleResource>
This relationship is write-once and cannot be modified after creation.
The samples related to the work order.
106 |
# File 'app/resources/api/v2/work_order_resource.rb', line 106 has_many :samples, write_once: true |
#source_receptacle ⇒ PolymorphicResource
This relationship is write-once and cannot be modified after creation.
The source receptacle from which the work order originates.
100 |
# File 'app/resources/api/v2/work_order_resource.rb', line 100 has_one :source_receptacle, write_once: true, polymorphic: true |
#state(: state) ⇒ Object
Filters work orders by their state.
78 |
# File 'app/resources/api/v2/work_order_resource.rb', line 78 attribute :state |
#study ⇒ StudyResource
This relationship is write-once and cannot be modified after creation.
The study associated with the work order.
88 |
# File 'app/resources/api/v2/work_order_resource.rb', line 88 has_one :study, write_once: true |
Instance Method Details
#project_id ⇒ Object
152 153 154 |
# File 'app/resources/api/v2/work_order_resource.rb', line 152 def project_id _model.example_request.initial_project_id end |
#source_receptacle_id ⇒ Object
159 160 161 |
# File 'app/resources/api/v2/work_order_resource.rb', line 159 def source_receptacle_id _model.example_request.asset_id end |
#study_id ⇒ Object
145 146 147 |
# File 'app/resources/api/v2/work_order_resource.rb', line 145 def study_id _model.example_request.initial_study_id end |