0.02
No release in over 3 years
Low commit activity in last 3 years
A Ruby library for interacting with a Learning Record Store (LRS) using the Tin Can API (Experience API)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 0.10
~> 10.0
~> 3.2
~> 1.20

Runtime

 Project Readme

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.new do |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 above
response = remote_lrs.about
# check if it is successful
if response.success
    # access the TinCanApi::About instance
    response.content
end

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.new do |s|
  s.actor = agent
  s.verb = verb
  s.object = activity
end

response = remote_lrs.save_statement(statement)
if response.success
  # access the statement
  response.content
end

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