Class: JSONAPI::ErrorsOperationResult

Inherits:
OperationResult show all
Defined in:
lib/jsonapi/operation_result.rb

Instance Attribute Summary collapse

Attributes inherited from OperationResult

#code, #links, #meta, #options, #warnings

Instance Method Summary collapse

Constructor Details

#initialize(code, errors, options = {}) ⇒ ErrorsOperationResult

Returns a new instance of ErrorsOperationResult.


25
26
27
28
# File 'lib/jsonapi/operation_result.rb', line 25

def initialize(code, errors, options = {})
  @errors = errors
  super(code, options)
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors


23
24
25
# File 'lib/jsonapi/operation_result.rb', line 23

def errors
  @errors
end

Instance Method Details

#to_hash(serializer = nil) ⇒ Object


30
31
32
33
34
35
36
37
38
# File 'lib/jsonapi/operation_result.rb', line 30

def to_hash(serializer = nil)
  {
      errors: errors.collect do |error|
        # :nocov:
        error.to_hash
        # :nocov:
      end
  }
end