Exception: JSONAPI::Exceptions::InvalidInclude

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, relationship) ⇒ InvalidInclude

Returns a new instance of InvalidInclude.



199
200
201
202
# File 'lib/jsonapi/exceptions.rb', line 199

def initialize(resource, relationship)
  @resource = resource
  @relationship = relationship
end

Instance Attribute Details

#relationshipObject

Returns the value of attribute relationship.



198
199
200
# File 'lib/jsonapi/exceptions.rb', line 198

def relationship
  @relationship
end

#resourceObject

Returns the value of attribute resource.



198
199
200
# File 'lib/jsonapi/exceptions.rb', line 198

def resource
  @resource
end

Instance Method Details

#errorsObject



204
205
206
207
208
209
# File 'lib/jsonapi/exceptions.rb', line 204

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