Class: Api::V2::WorkOrderResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::WorkOrderResource
- Defined in:
- app/resources/api/v2/work_order_resource.rb
Overview
This documentation does not yet include a detailed description of what this resource (really) represents.
This documentation does not yet include detailed descriptions for relationships, attributes and filters.
This documentation does not yet include any example usage of the API via cURL or similar.
Access this resource via the /api/v2/work_orders/
endpoint.
Provides a JSON:API representation of WorkOrder. Work orders provide an abstraction of requests for exposure to external applications. They are intended to allow us to update the internal representation, while maintaining an external interface.
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.
Constant Summary collapse
- IGNORED_METADATA_FIELDS =
%w[id request_id created_at updated_at].freeze
Instance Method Summary collapse
- #options ⇒ Object
- #order_type ⇒ Object
-
#project_id ⇒ Object
JSONAPI::Resource doesn’t support has_one through relationships by default.
-
#quantity ⇒ Object
Field Methods.
- #source_receptacle_id ⇒ Object
-
#study_id ⇒ Object
JSONAPI::Resource doesn’t support has_one through relationships by default.
Methods inherited from BaseResource
apply_includes, creatable_fields, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Method Details
#options ⇒ Object
70 71 72 73 74 |
# File 'app/resources/api/v2/work_order_resource.rb', line 70 def _model.example_request..attributes.reject do |key, value| IGNORED_METADATA_FIELDS.include?(key) || value.blank? end end |
#order_type ⇒ Object
66 67 68 |
# File 'app/resources/api/v2/work_order_resource.rb', line 66 def order_type _model.work_order_type.name end |
#project_id ⇒ Object
JSONAPI::Resource doesn’t support has_one through relationships by default
58 59 60 |
# File 'app/resources/api/v2/work_order_resource.rb', line 58 def project_id _model.example_request.initial_project_id end |
#quantity ⇒ Object
Field Methods
48 49 50 |
# File 'app/resources/api/v2/work_order_resource.rb', line 48 def quantity { number: _model.quantity_value, unit_of_measurement: _model.quantity_units } end |
#source_receptacle_id ⇒ Object
62 63 64 |
# File 'app/resources/api/v2/work_order_resource.rb', line 62 def source_receptacle_id _model.example_request.asset_id end |
#study_id ⇒ Object
JSONAPI::Resource doesn’t support has_one through relationships by default
53 54 55 |
# File 'app/resources/api/v2/work_order_resource.rb', line 53 def study_id _model.example_request.initial_study_id end |