Based on scripts from my colleague, Jason Miller - Notification Setter and Stat Scraper, this ruby script loops through 'account_id' columns in a Canvas CSV provisioning report of accounts, and connects to the Canvas-LMS API for Get department-level statistics to report all statistics for all accounts.
The first time you use this script, you will need to install required gems using Bundler.
$ bundle install
Next you will need to copy the contents of config.example.yml into a new file named config.yml.
$ cp config.example.yml config.yml
To properly authenticate with the Canvas LMS system you are using this script with, you'll need to generate an API access token for your user account and then insert that token into the 'config.yml' file as the 'admin_token'.
This script will work with any list of canvas course ids that the user is authorized to access. Ideally, you can use a provisioning report for accounts which will result in a file that includes the 'canvas_account_id'.
This script is really intended for Canvas Admins.
From the command line simply run the 'main.rb' script.
$ ./main.rb