Documentation

RubricAssessment extends AbstractBaseApi
in package

RubricAssessment Class

Represents a rubric assessment in Canvas LMS. Rubric assessments are the actual evaluations made using a rubric on a submission. They contain the scores and comments for each criterion in the rubric.

Usage:

// Set course context first
$course = Course::find(123);
RubricAssessment::setCourse($course);

// Creating a rubric assessment (using array)
$assessment = RubricAssessment::create([
    'userId' => 123,
    'assessmentType' => 'grading',
    'criterionData' => [...]
], 456); // rubric_association_id

// Creating using DTO (still supported)
$dto = new CreateRubricAssessmentDTO();
$dto->userId = 123;
$dto->assessmentType = 'grading';
$dto->criterionData = [...];
$assessment = RubricAssessment::create($dto, 456);

// Updating an assessment (using array)
$assessment = RubricAssessment::update(111, [
    'criterionData' => [...]
], 456); // rubric_association_id

// Updating using DTO (still supported)
$updateDto = new UpdateRubricAssessmentDTO();
$updateDto->criterionData = [...];
$assessment = RubricAssessment::update(111, $updateDto, 456);

Table of Contents

Properties

$artifact  : array<string, mixed>|null
The artifact being assessed
$artifactAttempt  : int|null
The current number of attempts made on the object of the assessment
$artifactId  : int|null
The ID of the artifact being assessed
$artifactType  : string|null
The type of the artifact being assessed
$assessmentType  : string|null
The type of assessment Values: 'grading', 'peer_review', or 'provisional_grade'
$assessorId  : int|null
User ID of the person who made the assessment
$assessorName  : string|null
Name of the assessor
$comments  : string|null
Overall comments for the assessment
$createdAt  : string|null
Created timestamp
$criterionData  : array<string, mixed>|null
Criterion data for assessment creation/updates
$data  : array<string, mixed>|null
Full assessment data (when style='full' is requested)
$id  : int|null
The ID of the rubric assessment
$provisionalGradeId  : int|null
Provisional grade ID for moderated grading
$ratings  : array<int, mixed>|null
Additional assessment details
$relatedGroupSubmissionsAndAssessments  : array<int, mixed>|null
Related group submissions and assessments
$rubricAssociationId  : int|null
The ID of the rubric association
$rubricId  : int|null
The ID of the rubric
$score  : float|null
The overall score for this assessment
$updatedAt  : string|null
Updated timestamp
$userId  : int|null
User ID of the person being assessed
$apiClient  : HttpClientInterface
$course  : Course|null
Course context for operations
$methodAliases  : array<string|int, mixed>
Define method aliases

Methods

__callStatic()  : mixed
Magic method to handle function aliases
__construct()  : mixed
Constructor
all()  : array<string|int, static>
Get all pages of results
create()  : self
Create a new rubric assessment
delete()  : self
Delete a rubric assessment
find()  : self
Find a rubric assessment by ID
get()  : array<int, self>
Fetch all rubric assessments
paginate()  : PaginationResult
Get paginated results with metadata
rubric()  : Rubric
Get the associated rubric
rubricAssociation()  : RubricAssociation
Get the rubric association
save()  : self
Save the rubric assessment (create or update)
setApiClient()  : void
Set the API client
setCourse()  : void
Set the course context for rubric assessment operations
update()  : self
Update a rubric assessment
castValue()  : DateTime|mixed
Cast a value to the correct type
checkApiClient()  : void
Check if the API client is set, if not, instantiate a new one
convertPaginatedResponseToModels()  : array<string|int, static>
Helper method to convert paginated response data to model instances
createConfiguredHttpClient()  : HttpClient
Create an HttpClient with configured middleware
createPaginationResult()  : PaginationResult
Helper method to create PaginationResult from paginated response
getEndpoint()  : string
Get the API endpoint for this resource Note: RubricAssessment is a nested resource under RubricAssociation
getPaginatedResponse()  : PaginatedResponse
Helper method to get paginated response from API endpoint
getResourceEndpoint()  : string
Get the resource endpoint
getResourceIdentifier()  : string
Get the resource identifier for API endpoints
populate()  : void
Populate the object with new data
toDtoArray()  : array<string|int, mixed>
Convert the object to an array

Properties

$artifact

The artifact being assessed

public array<string, mixed>|null $artifact = null

$artifactAttempt

The current number of attempts made on the object of the assessment

public int|null $artifactAttempt = null

$artifactId

The ID of the artifact being assessed

public int|null $artifactId = null

$artifactType

The type of the artifact being assessed

public string|null $artifactType = null

$assessmentType

The type of assessment Values: 'grading', 'peer_review', or 'provisional_grade'

public string|null $assessmentType = null

$assessorId

User ID of the person who made the assessment

public int|null $assessorId = null

$assessorName

Name of the assessor

public string|null $assessorName = null

$comments

Overall comments for the assessment

public string|null $comments = null

$criterionData

Criterion data for assessment creation/updates

public array<string, mixed>|null $criterionData = null

$data

Full assessment data (when style='full' is requested)

public array<string, mixed>|null $data = null

$provisionalGradeId

Provisional grade ID for moderated grading

public int|null $provisionalGradeId = null

$ratings

Additional assessment details

public array<int, mixed>|null $ratings = null

$relatedGroupSubmissionsAndAssessments

Related group submissions and assessments

public array<int, mixed>|null $relatedGroupSubmissionsAndAssessments = null

$rubricAssociationId

The ID of the rubric association

public int|null $rubricAssociationId = null

$score

The overall score for this assessment

public float|null $score = null

$userId

User ID of the person being assessed

public int|null $userId = null

$methodAliases

Define method aliases

protected static array<string|int, mixed> $methodAliases = ['get' => ['fetch', 'list', 'fetchAll'], 'all' => ['fetchAllPages', 'getAll'], 'paginate' => ['getPaginated', 'withPagination', 'fetchPage'], 'find' => ['one', 'getOne']]

Methods

__callStatic()

Magic method to handle function aliases

public static __callStatic(string $name, array<string|int, mixed> $arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Tags
throws
InvalidArgumentException

__construct()

Constructor

public __construct([array<string, mixed> $data = [] ]) : mixed
Parameters
$data : array<string, mixed> = []

all()

Get all pages of results

public static all([array<string, mixed> $params = [] ]) : array<string|int, static>
Parameters
$params : array<string, mixed> = []

Query parameters

Return values
array<string|int, static>

find()

Find a rubric assessment by ID

public static find(int $id[, array<string|int, mixed> $params = [] ]) : self

Note: Canvas API does not support fetching individual rubric assessments

Parameters
$id : int

The assessment ID

$params : array<string|int, mixed> = []

Optional query parameters

Tags
throws
CanvasApiException
Return values
self

get()

Fetch all rubric assessments

public static get([array<string, mixed> $params = [] ]) : array<int, self>

Note: Canvas API does not support listing all rubric assessments directly

Parameters
$params : array<string, mixed> = []

Query parameters

Tags
throws
CanvasApiException
Return values
array<int, self>

save()

Save the rubric assessment (create or update)

public save([int|null $rubricAssociationId = null ]) : self
Parameters
$rubricAssociationId : int|null = null

Required for create operation

Tags
throws
CanvasApiException
Return values
self

setCourse()

Set the course context for rubric assessment operations

public static setCourse(Course|null $course) : void
Parameters
$course : Course|null

castValue()

Cast a value to the correct type

protected castValue(string $key, mixed $value) : DateTime|mixed
Parameters
$key : string
$value : mixed
Tags
throws
Exception
Return values
DateTime|mixed

checkApiClient()

Check if the API client is set, if not, instantiate a new one

protected static checkApiClient() : void

convertPaginatedResponseToModels()

Helper method to convert paginated response data to model instances

protected static convertPaginatedResponseToModels(PaginatedResponse $paginatedResponse) : array<string|int, static>
Parameters
$paginatedResponse : PaginatedResponse
Return values
array<string|int, static>

getEndpoint()

Get the API endpoint for this resource Note: RubricAssessment is a nested resource under RubricAssociation

protected static getEndpoint() : string
Tags
throws
CanvasApiException
Return values
string

getPaginatedResponse()

Helper method to get paginated response from API endpoint

protected static getPaginatedResponse(string $endpoint[, array<string|int, mixed> $params = [] ]) : PaginatedResponse
Parameters
$endpoint : string

The API endpoint path

$params : array<string|int, mixed> = []

Query parameters for the request

Return values
PaginatedResponse

getResourceEndpoint()

Get the resource endpoint

protected static getResourceEndpoint(int $rubricAssociationId) : string
Parameters
$rubricAssociationId : int

The rubric association ID

Tags
throws
CanvasApiException
Return values
string

getResourceIdentifier()

Get the resource identifier for API endpoints

protected static getResourceIdentifier() : string
Return values
string

populate()

Populate the object with new data

protected populate(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

toDtoArray()

Convert the object to an array

protected toDtoArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results