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.



7
8
9
# File 'lib/jsonapi/exceptions.rb', line 7

def initialize(resource)
  @resource = resource
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



6
7
8
# File 'lib/jsonapi/exceptions.rb', line 6

def resource
  @resource
end

Instance Method Details

#errorsObject



11
12
13
14
15
16
# File 'lib/jsonapi/exceptions.rb', line 11

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