Skip to content

Repository files navigation

TinCanApi

A Ruby library for implementing Tin Can API (Experience API).

For more information about the Tin Can API visit:

http://tincanapi.com/

Warning

Please regard this as alpha software. It was created to solve an urgent problem and has not been fully tested in a live environment.

Installation

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

Usage

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'end

Connect 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.contentend

Create 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.contentend

For more API calls check out the TinCanApi::RemoteLRS class

About

Tin Can ruby client library

Resources

Contributing

Stars

13 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages