Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 17, 2025

This PR implements comprehensive support for retrieving rubrics data from the Canvas LMS API, addressing the request in issue #19.

Changes Made

Added four new functions following the established package patterns:

Course-Level Rubrics

  • get_rubrics(canvas, course_id, per_page = 100) - Retrieves list of rubrics for a specific course
  • get_rubric(canvas, course_id, rubric_id) - Retrieves a single rubric by ID from a course

Account-Level Rubrics

  • get_account_rubrics(canvas, account_id, per_page = 100) - Retrieves list of rubrics for a specific account
  • get_account_rubric(canvas, account_id, rubric_id) - Retrieves a single rubric by ID from an account

Implementation Details

All functions follow the established vvcanvas package conventions:

  • ✅ Proper roxygen2 documentation with @export tags
  • ✅ Consistent error handling with informative messages
  • ✅ Uses httr::GET for HTTP requests and jsonlite::fromJSON for parsing
  • ✅ Follows Canvas API authentication patterns with Bearer tokens
  • ✅ Includes pagination support where appropriate (per_page parameter)
  • ✅ Comprehensive parameter validation

API Endpoints Covered

These functions implement the following Canvas API endpoints:

  • GET /api/v1/courses/:course_id/rubrics
  • GET /api/v1/courses/:course_id/rubrics/:id
  • GET /api/v1/accounts/:account_id/rubrics
  • GET /api/v1/accounts/:account_id/rubrics/:id

Usage Example

# Set up authentication
canvas <- list(
  api_key = "your_api_key_here",
  base_url = "https://your-canvas-instance.com"
)

# Get all rubrics for a course
rubrics <- get_rubrics(canvas, course_id = "12345")

# Get a specific rubric
rubric <- get_rubric(canvas, course_id = "12345", rubric_id = "67890")

# Get all rubrics for an account
account_rubrics <- get_account_rubrics(canvas, account_id = "1")

Files Added

  • R/get_rubrics.R - Course rubrics list function
  • R/get_rubric.R - Single course rubric function
  • R/get_account_rubrics.R - Account rubrics list function
  • R/get_account_rubric.R - Single account rubric function

Updated TODO.md to mark the corresponding rubrics endpoints as implemented.

Fixes #19.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>
Copilot AI changed the title [WIP] [FEATURE] Implement Rubrics methods Implement Rubrics methods for Canvas LMS API Jul 17, 2025
Copilot AI requested a review from tin900 July 17, 2025 17:01
Copy link
Contributor

@tin900 tin900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update pkdown too

Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 17, 2025

Update pkdown too

Updated pkgdown configuration and documentation. Added rubrics functions to NAMESPACE exports, created manual pages (.Rd files), and updated _pkgdown.yml with new rubrics section. The functions are now properly documented and will appear on the pkgdown website. (commit 453d600)

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cloud.r-project.org
    • Triggering command: /usr/lib/R/bin/exec/R -e install.packages(c(&#39;roxygen2&#39;,~&#43;~&#39;devtools&#39;),~&#43;~repos=&#39;REDACTED&#39;) (dns block)
    • Triggering command: /usr/lib/R/bin/exec/R -e install.packages(c(&#39;htm2txt&#39;,~&#43;~&#39;httr&#39;,~&#43;~&#39;jsonlite&#39;,~&#43;~&#39;magrittr&#39;,~&#43;~&#39;dplyr&#39;,~&#43;~&#39;rlang&#39;,~&#43;~&#39;stringr&#39;,~&#43;~&#39;tidyr&#39;,~&#43;~&#39;purrr&#39;,~&#43;~&#39;mime&#39;),~&#43;~dependencies~&#43;~=~&#43;~TRUE) (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from tin900 July 17, 2025 17:14
Copy link
Contributor

@tin900 tin900 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use the new paginate function see other functions how to use it

Co-authored-by: tin900 <113692500+tin900@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 23, 2025

@copilot use the new paginate function see other functions how to use it

Updated both get_rubrics() and get_account_rubrics() functions to use the new paginate() helper function following the same pattern as other list functions in the codebase like get_assignments() and get_course_pages(). The functions now properly handle multiple pages of results using paginate(), lapply(), and dplyr::bind_rows(). (commit 8b0ad8e)

Copilot AI requested a review from tin900 July 23, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement Rubrics methods

2 participants