Class: JSONAPI::OperationsProcessor
- Inherits:
-
Object
- Object
- JSONAPI::OperationsProcessor
show all
- Includes:
- Callbacks
- Defined in:
- lib/jsonapi/operations_processor.rb
Instance Method Summary
collapse
Methods included from Callbacks
included
Instance Method Details
#process(request) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/jsonapi/operations_processor.rb', line 9
def process(request)
@results = []
@request = request
@context = request.context
@operations = request.operations
run_callbacks :operations do
transaction do
@operations.each do |operation|
@operation = operation
@result = nil
run_callbacks :operation do
@result = @operation.apply(@context)
@results.push(@result)
if @result.has_errors?
rollback
end
end
end
end
end
@results
end
|