Class: Api::V2::WorkOrderResource
- Inherits:
-
BaseResource
- Object
- JSONAPI::Resource
- BaseResource
- Api::V2::WorkOrderResource
- Defined in:
- app/resources/api/v2/work_order_resource.rb
Overview
Class WorkOrderResource provides an abstraction of request for exposure to external applications. It is intended to allow us to update the internal representation, while maintaining an external interface
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
- #source_receptacle_id ⇒ Object
-
#study_id ⇒ Object
JSONAPI::Resource doesn't support has_one through relationships by default.
Methods inherited from BaseResource
apply_includes, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations, updatable_fields
Instance Method Details
#options ⇒ Object
60 61 62 63 64 |
# File 'app/resources/api/v2/work_order_resource.rb', line 60 def _model.example_request..attributes.reject do |key, value| IGNORED_METADATA_FIELDS.include?(key) || value.blank? end end |
#order_type ⇒ Object
56 57 58 |
# File 'app/resources/api/v2/work_order_resource.rb', line 56 def order_type _model.work_order_type.name end |
#project_id ⇒ Object
JSONAPI::Resource doesn't support has_one through relationships by default
48 49 50 |
# File 'app/resources/api/v2/work_order_resource.rb', line 48 def project_id _model.example_request.initial_project_id end |
#quantity ⇒ Object
35 36 37 38 39 40 |
# File 'app/resources/api/v2/work_order_resource.rb', line 35 def quantity { number: _model.quantity_value, unit_of_measurement: _model.quantity_units } end |
#source_receptacle_id ⇒ Object
52 53 54 |
# File 'app/resources/api/v2/work_order_resource.rb', line 52 def source_receptacle_id _model.example_request.asset_id end |
#study_id ⇒ Object
JSONAPI::Resource doesn't support has_one through relationships by default
43 44 45 |
# File 'app/resources/api/v2/work_order_resource.rb', line 43 def study_id _model.example_request.initial_study_id end |