This gem subscribes to events published by Pupilfirst LMS system, builds the XAPI statements and sends them to LRS endpoint defined using ENV variables. The list of handled Pupilfirst's events is defined here.
Add this line to your application's Gemfile:
gem 'pupilfirst_xapi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install pupilfirst_xapi
Add application initializer file and setup dependencies required by this gem:
Add this line in gem initializer:
PupilfirstXapi.repository = ->(klass, resource_id) { ... }
It could be simple lambda to fetch Pupilfirst's models or
a class with a call(klass, repository_id)
method.
Arguments:
klass
- a symbol from a list defined below representing one of the entities from Pupilfirst's data model,resource_id
- an entity id (Application Record id attribute)
Entity types that are used by this gem:
:course
- Pupilfirst'sCourse
class:target
- Pupilfirst'sTarget
class:user
- Pupilfirst'sUser
class
The result of the lambda or repository class call method must be an Pupilfirst's ActiveRecord object for requested class.
Add this line in gem initializer:
PupilfirstXapi.uri_for = ->(obj) { ... }
Arguments:
obj
- an Pupilfirst's ActiveRecord object
The result of the PupilfirstXapi.uri_for.(obj)
call must be
the unique URI of the object passed as argument.
Set environment variables:
LRS_ENDPOINT
- url of LRS server's XAPI endpointLRS_KEY
- authentication keyLRS_SECRET
- authentication secter
The gem is available as open source under the terms of the GNU GPLv3 License.