Class: V1::AnnotationResource

Inherits:
JSONAPI::Resource
  • Object
show all
Defined in:
app/resources/v1/annotation_resource.rb

Overview

Note:

This endpoint can’t be directly accessed via the /v1/annotations/ endpoint

Provides a JSON:API resource of Annotation.

as it is not currently used.

Direct Known Subclasses

Pacbio::Runs::AnnotationResource

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotatable_idInteger

Returns the ID of the resource this annotation is attached to.

Returns:

  • (Integer)

    the ID of the resource this annotation is attached to



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

#annotatable_typeString

Returns the type of the resource this annotation is attached to.

Returns:

  • (String)

    the type of the resource this annotation is attached to



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

#annotation_type_idInteger

Returns the ID of the annotation type.

Returns:

  • (Integer)

    the ID of the annotation type



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

#commentString

Returns the annotation text (required, max 500 chars).

Returns:

  • (String)

    the annotation text (required, max 500 chars)



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

#created_atDateTime

Returns the timestamp when the annotation was created.

Returns:

  • (DateTime)

    the timestamp when the annotation was created



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

#userString

Returns the user who created the annotation (required, max 10 chars).

Returns:

  • (String)

    the user who created the annotation (required, max 10 chars)



25
# File 'app/resources/v1/annotation_resource.rb', line 25

attributes :comment, :user, :created_at, :annotation_type_id, :annotatable_type, :annotatable_id

Instance Method Details

#removeObject

Raises:

  • (JSONAPI::Exceptions::RecordLocked)


38
39
40
# File 'app/resources/v1/annotation_resource.rb', line 38

def remove
  raise JSONAPI::Exceptions::RecordLocked, 'Annotations cannot be deleted'
end

#replace_fields(_fields) ⇒ Object

Prevent updates and deletes through the API

Raises:

  • (JSONAPI::Exceptions::RecordLocked)


34
35
36
# File 'app/resources/v1/annotation_resource.rb', line 34

def replace_fields(_fields)
  raise JSONAPI::Exceptions::RecordLocked, 'Annotations cannot be updated'
end