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 but order_type
is specified in the example. There is a mismatch on presence and requirement.
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
52 |
# File 'app/resources/api/v2/work_order_resource.rb', line 52 attribute :at_risk |
#options ⇒ Object (readonly)
59 |
# File 'app/resources/api/v2/work_order_resource.rb', line 59 attribute :options, readonly: true |
#order_type ⇒ Object
67 |
# File 'app/resources/api/v2/work_order_resource.rb', line 67 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.
96 |
# File 'app/resources/api/v2/work_order_resource.rb', line 96 has_one :project, write_once: true |
#quantity ⇒ Object
74 |
# File 'app/resources/api/v2/work_order_resource.rb', line 74 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.
108 |
# File 'app/resources/api/v2/work_order_resource.rb', line 108 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.
102 |
# File 'app/resources/api/v2/work_order_resource.rb', line 102 has_one :source_receptacle, write_once: true, polymorphic: true |
#state(: state) ⇒ Object
Filters work orders by their state.
80 |
# File 'app/resources/api/v2/work_order_resource.rb', line 80 attribute :state |
#study ⇒ StudyResource
This relationship is write-once and cannot be modified after creation.
The study associated with the work order.
90 |
# File 'app/resources/api/v2/work_order_resource.rb', line 90 has_one :study, write_once: true |
Instance Method Details
#project_id ⇒ Object
154 155 156 |
# File 'app/resources/api/v2/work_order_resource.rb', line 154 def project_id _model.example_request.initial_project_id end |
#source_receptacle_id ⇒ Object
161 162 163 |
# File 'app/resources/api/v2/work_order_resource.rb', line 161 def source_receptacle_id _model.example_request.asset_id end |
#study_id ⇒ Object
147 148 149 |
# File 'app/resources/api/v2/work_order_resource.rb', line 147 def study_id _model.example_request.initial_study_id end |