Class: JSONAPI::NewOperation
- Inherits:
-
Operation
- Object
- Operation
- JSONAPI::NewOperation
- Defined in:
- lib/revelry_data/jsonapi_resources_patch.rb
Instance Attribute Summary collapse
-
#include_directives ⇒ Object
readonly
Returns the value of attribute include_directives.
Instance Method Summary collapse
- #apply ⇒ Object
-
#initialize(resource_klass, options = {}) ⇒ NewOperation
constructor
A new instance of NewOperation.
Constructor Details
#initialize(resource_klass, options = {}) ⇒ NewOperation
Returns a new instance of NewOperation.
14 15 16 17 18 |
# File 'lib/revelry_data/jsonapi_resources_patch.rb', line 14 def initialize(resource_klass, = {}) @include_directives = [:include_directives] @transactional = false super(resource_klass, ) end |
Instance Attribute Details
#include_directives ⇒ Object (readonly)
Returns the value of attribute include_directives.
12 13 14 |
# File 'lib/revelry_data/jsonapi_resources_patch.rb', line 12 def include_directives @include_directives end |
Instance Method Details
#apply ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/revelry_data/jsonapi_resources_patch.rb', line 20 def apply resource_record = resource_klass.create(@context) return JSONAPI::ResourceOperationResult.new(:ok, resource_record) rescue JSONAPI::Exceptions::Error => e return JSONAPI::ErrorsOperationResult.new(e.errors[0].code, e.errors) end |