Class: JSONAPI::OperationsProcessor
- Inherits:
-
Object
- Object
- JSONAPI::OperationsProcessor
show all
- Defined in:
- lib/jsonapi/operations_processor.rb
Instance Method Summary
collapse
Instance Method Details
#after_operation(context, result) ⇒ Object
32
33
|
# File 'lib/jsonapi/operations_processor.rb', line 32
def after_operation(context, result)
end
|
#before_operation(context, operation) ⇒ Object
29
30
|
# File 'lib/jsonapi/operations_processor.rb', line 29
def before_operation(context, operation)
end
|
#process(request) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/jsonapi/operations_processor.rb', line 6
def process(request)
@results = []
@resources = []
context = request.context
transaction {
request.operations.each do |operation|
before_operation(context, operation)
result = operation.apply(context)
after_operation(context, result)
@results.push(result)
if result.has_errors?
rollback
end
end
}
@results
end
|