Class: Api::V2::TubeRackPurposeResource

Inherits:
BaseResource
  • Object
show all
Defined in:
app/resources/api/v2/tube_rack_purpose_resource.rb

Overview

Note:

Access this resource via the /api/v2/tube_rack_purposes/ endpoint.

This resource represents the API structure for the TubeRack::Purpose model. This purpose is used by Limber for config generation.

Provides a JSON:API representation of TubeRack::Purpose.

For more information about JSON:API see the JSON:API Specifications or look at the JSONAPI::Resources package for Sequencescape's implementation of the JSON:API standard.

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from BaseResource

apply_includes, default_includes, #fetchable_fields, inclusions, resolve_relationship_names_to_relations

Instance Attribute Details

#nameString

Returns the name of the tube rack purpose.

Returns:

  • (String)

    the name of the tube rack purpose.



24
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 24

attribute :name

#purpose_typeString

Returns the purpose type. This is mapped to the type attribute on the model.

Returns:

  • (String)

    the purpose type. This is mapped to the type attribute on the model.



32
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 32

attribute :purpose_type, delegate: :type

#sizeInteger

Returns the size of the tube rack purpose.

Returns:

  • (Integer)

    the size of the tube rack purpose.



28
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 28

attribute :size

#target_typeString

Returns the target type.

Returns:

  • (String)

    the target type.



36
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 36

attribute :target_type

#uuidString (readonly)

Returns the UUID of the tube rack purpose.

Returns:

  • (String)

    the UUID of the tube rack purpose.



40
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 40

attribute :uuid, readonly: true

Class Method Details

.creatable_fields(_context) ⇒ Array<Symbol>

Gets the list of fields which are creatable on a TubeRackPurpose.

Parameters:

  • _context (JSONAPI::Resource::Context)

    not used

Returns:

  • (Array<Symbol>)

    the list of creatable fields.



46
47
48
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 46

def self.creatable_fields(_context)
  super - %i[uuid] # Do not allow creating with any readonly fields
end

.updatable_fields(_context) ⇒ Array<Symbol>

Gets the list of fields which are updatable on an existing TubeRackPurpose.

Parameters:

  • _context (JSONAPI::Resource::Context)

    not used

Returns:

  • (Array<Symbol>)

    the list of updatable fields.



54
55
56
# File 'app/resources/api/v2/tube_rack_purpose_resource.rb', line 54

def self.updatable_fields(_context)
  super - %i[uuid] # Do not allow creating with any readonly fields
end