A Ruby library for implementing Tin Can API (Experience API).
For more information about the Tin Can API visit:
Please regard this as alpha software. It was created to solve an urgent problem and has not been fully tested in a live environment.
Add this line to your application's Gemfile:
gem'tin_can_api'And then execute:
$ bundle
Or install it yourself as:
$ gem install tin_can_api
Create a remote LRS using basic auth
remote_lrs=TinCanApi::RemoteLRS.newdo |c|
c.end_point='https://some.endpoint.com'c.user_name='user'c.password='password'endConnect to the 'about' endpoint to get version information
# use the remote LRS from aboveresponse=remote_lrs.about# check if it is successfulifresponse.success# access the TinCanApi::About instanceresponse.contentendCreate a statement
agent=TinCanApi::Agent.new(mbox: 'mailto:info@tincanapi.com')verb=TinCanApi::Verb.new(id: 'http://adlnet.gov/expapi/verbs/attempted')activity=TinCanApi::Activity.new(id: 'http://pwcoleman.github.com/TinCanRuby')statement=TinCanApi::Statement.newdo |s|
s.actor=agents.verb=verbs.object=activityendresponse=remote_lrs.save_statement(statement)ifresponse.success# access the statementresponse.contentendFor more API calls check out the TinCanApi::RemoteLRS class