razorbacks/blackboard-rest-api-wrapper

Lightweight wrapper for https://developer.blackboard.com/portal/displayApi

0.2.0 2017-10-23 19:36 UTC

This package is not auto-updated.

Last update: 2024-11-14 05:38:03 UTC


README

Lightweight wrapper for https://developer.blackboard.com/portal/displayApi

See also https://razorbacks.github.io/blackboard-rest-api-wrapper/

Inspired by https://github.com/blackboard/BBDN-REST-Demo-PHP

Installation

via composer:

composer require razorbacks/blackboard-rest-api-wrapper

Usage

// setup
require_once __DIR__.'/vendor/autoload.php';

use razorbacks\blackboard\rest\Api;

$server = 'https://learn.uark.edu';
$applicationId = 'your-application-id';
$secret = 'secret';

$blackboard = new Api($server, $applicationId, $secret);

// create a new manual grade column for a course
$courseId = '_123_1';
$gradeColumn = [
    'name' => 'Example Assignment',
    'description' => 'This is something we did for course credit.',
    'score' => [
        'possible' => 10,
    ],
    'availability' => [
        'available' => 'Yes',
    ],
];

// create and hydrate the model with new ID
$gradeColumn = $blackboard->post("/courses/{$courseId}/gradebook/columns", $gradeColumn);

// assign a grade to a student
$username = 'jdoe';
$endpoint = "/courses/{$courseId}/gradebook/columns/{$gradeColumn['id']}/users/userName:$username";
$blackboard->patch($endpoint, [
    'score' => 9,
]);

See the tests for more examples.

Testing

The test suite is composed of integration tests making real network calls. See the documentation for setting up a vagrant virtual machine server.