class Served::Serializers::JsonApi::Error

Error object

Attributes

attrs[R]

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/served/serializers/json_api/error.rb, line 11
def initialize(attrs = {})
  @attrs = (attrs || {}).with_indifferent_access
end

Public Instance Methods

code() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 23
def code
  attrs[:code]
end
detail() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 31
def detail
  attrs[:detail]
end
id() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 15
def id
  attrs[:id]
end
source() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 47
def source
  res = attrs.fetch(:source, {})
  res ? res : {}
end
source_parameter() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 35
def source_parameter
  source.fetch(:parameter) do
    source[:pointer] ? source[:pointer].split('/').last : nil
  end
end
source_pointer() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 41
def source_pointer
  source.fetch(:pointer) do
    source[:parameter] ? "/data/attributes/#{source[:parameter]}" : nil
  end
end
status() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 19
def status
  attrs[:status]
end
title() click to toggle source
# File lib/served/serializers/json_api/error.rb, line 27
def title
  attrs[:title]
end