Exception: JSONAPI::Exceptions::InvalidResource

Inherits:
Error
  • Object
show all
Defined in:
lib/jsonapi/exceptions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource) ⇒ InvalidResource

Returns a new instance of InvalidResource.



22
23
24
# File 'lib/jsonapi/exceptions.rb', line 22

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



21
22
23
# File 'lib/jsonapi/exceptions.rb', line 21

def resource
  @resource
end

Instance Method Details

#errorsObject



26
27
28
29
30
31
# File 'lib/jsonapi/exceptions.rb', line 26

def errors
  [JSONAPI::Error.new(code: JSONAPI::INVALID_RESOURCE,
                      status: :bad_request,
                      title: 'Invalid resource',
                      detail: "#{resource} is not a valid resource.")]
end