class SimpleJsonapi::Node::Errors
@!attribute [r] errors
@return [Array<Object>]
Attributes
errors[R]
Public Class Methods
new(errors:, **options)
click to toggle source
@param errors [Array<Object>] @param options see {Node::Base#initialize} for additional parameters
Calls superclass method
SimpleJsonapi::Node::Base::new
# File lib/simple_jsonapi/node/errors.rb, line 9 def initialize(errors:, **options) super(options) @errors = Array.wrap(errors) @error_nodes = @errors.map do |error| build_child_node(SimpleJsonapi::Node::Error, error: error) end end
Public Instance Methods
as_jsonapi()
click to toggle source
@return [Hash{Symbol => Hash}]
# File lib/simple_jsonapi/node/errors.rb, line 20 def as_jsonapi if @error_nodes.any? { errors: @error_nodes.map(&:as_jsonapi) } else {} end end