Project

rubykhan

0.01
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the Khan Academy API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

~> 1.8
 Project Readme

RubyKhan: a Khan Academy API gem

Gem Version

Coverage Status

Build Status

This is a wrapper for the Khan Academy API. It is a work in progress, and only supports part of the API. Any assistance with implementing extra calls would be appreciated!

Installation

Add this line to your application's Gemfile:

gem 'rubykhan'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rubykhan

Usage

So far, this gem only accesses the publically available parts of the API. For authentication, try Khan Academy OmniAuth gem.

In your main.rb file:

require 'rubykhan'

Information from Khan academy's API is accessed through topic keywords called "slugs" that you can use in your API requests. Topics are arranged hierarchically from the most general (e.g. "math", "science", "humanities") to the very specific.

To see an array of all the nested topic slugs (which you can use for future queries):

KhanAcademy::Topic.all

You can always pass in a key if you are looking for different information:

KhanAcademy::Topic.all('slug')
KhanAcademy::Topic.all('title')
KhanAcademy::Topic.all('node_slug')

You can get a Topic object by directly calling .retrieve:

algebra = KhanAcademy::Topic.retrieve("algebra")
algebra.title
algebra.description

More specific topics (e.g. "differential-equations", "buddhist-art", "blood-vessels") can return exercises and videos:

buddhist_art = KhanAcademy::Topic.get_exercises("buddhist-art").first
buddhist_art.title
buddhist_art.ka_url
blood_vessels_videos = KhanAcademy::Topic.get_videos("blood-vessels").first
blood_vessels_videos.description
blood_vessels_videos.title
blood_vessels_videos.ka_url

You can also get a list of all Exercises:

exercises = KhanAcademy::Exercise.all

More information about the Khan Academy API can be found at the Khan Academy API Explorer.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Please make sure the tests pass (rake spec) and add your own before asking for a pull request.

FAQ:

Q: What's up with the name?

A: It's a pun on Crossing the Rubicon. Julius Caesar would've used Ruby in his conquest of Gaul, and we want you to be able to use Ruby in your Khan Academy app. :)