class JSONAPI::Document::Error

An individual errors member in a jsonapi's document top level 'errors' member array

Public Class Methods

new(err_members = []) click to toggle source

@param err_members [Array<JSONAPI::Document::Error::ErrorMember>]

The error members that belong to this specific error.
Calls superclass method JSONAPI::NameValuePairCollection::new
# File lib/easy/jsonapi/document/error.rb, line 14
def initialize(err_members = [])
  super(err_members, item_type: JSONAPI::Document::Error::ErrorMember)
end

Public Instance Methods

<<(error_mem) click to toggle source

Another way to call add @param (see add)

Calls superclass method JSONAPI::NameValuePairCollection#<<
# File lib/easy/jsonapi/document/error.rb, line 29
def <<(error_mem)
  super(error_mem, &:name)
end
add(error_mem) click to toggle source

Add a error to the collection using it's name @param error_mem [JSONAPI::Document::Error::ErrorMember]

Calls superclass method JSONAPI::NameValuePairCollection#add
# File lib/easy/jsonapi/document/error.rb, line 23
def add(error_mem)
  super(error_mem, &:name)
end
to_h() click to toggle source

Represent an Error as a hash

# File lib/easy/jsonapi/document/error.rb, line 42
def to_h
  JSONAPI::Utility.to_h_collection(self)
end