class SimpleJsonapi::Definition::Error

@!attribute [r] member_definitions

@return [Hash{Symbol => Attribute}]

@!attribute [r] source_definition

@return [ErrorSource]

Attributes

member_definitions[R]
source_definition[R]

Public Class Methods

new() click to toggle source
# File lib/simple_jsonapi/definition/error.rb, line 11
def initialize
  super
  @member_definitions = {}
  @source_definition = SimpleJsonapi::Definition::ErrorSource.new
end

Public Instance Methods

code(*args, **options, &block) click to toggle source

@overload code(options = {}, &block) @overload code(value, options = {}) @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 40
def code(*args, **options, &block)
  member_definitions[:code] = SimpleJsonapi::Definition::Attribute.new(:code, *args, **options, &block)
end
detail(*args, **options, &block) click to toggle source

@overload detail(options = {}, &block) @overload detail(value, options = {}) @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 54
def detail(*args, **options, &block)
  member_definitions[:detail] = SimpleJsonapi::Definition::Attribute.new(:detail, *args, **options, &block)
end
id(*args, **options, &block) click to toggle source

@overload id(options = {}, &block) @overload id(value, options = {}) @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 26
def id(*args, **options, &block)
  member_definitions[:id] = SimpleJsonapi::Definition::Attribute.new(:id, *args, **options, &block)
end
source(&block) click to toggle source

@see ErrorSource#initialize @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 67
def source(&block)
  @source_definition = SimpleJsonapi::Definition::ErrorSource.new(&block)
end
status(*args, **options, &block) click to toggle source

@overload status(options = {}, &block) @overload status(value, options = {}) @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 33
def status(*args, **options, &block)
  member_definitions[:status] = SimpleJsonapi::Definition::Attribute.new(:status, *args, **options, &block)
end
title(*args, **options, &block) click to toggle source

@overload title(options = {}, &block) @overload title(value, options = {}) @return [void]

# File lib/simple_jsonapi/definition/error.rb, line 47
def title(*args, **options, &block)
  member_definitions[:title] = SimpleJsonapi::Definition::Attribute.new(:title, *args, **options, &block)
end

Private Instance Methods

initialize_dup(new_def) click to toggle source
# File lib/simple_jsonapi/definition/error.rb, line 17
        def initialize_dup(new_def)
  super
  new_def.instance_variable_set(:@source_definition, @source_definition.dup) unless @source_definition.nil?
  new_def.instance_variable_set(:@member_definitions, @member_definitions.dup) unless @member_definitions.nil?
end