This is a gem that wraps an API that's written by the awesome team at Teachable!
Basic auth credentials from Teachable are needed to use this gem. Doing so returns a token that can be used for subsequent requests. This token expires every 20 minutes, but the gem automatically retrieves a new token should it expire. It does so by leveraging a custom middleware that's plugged into the Faraday client.
This gem is not on rubygems and must be built locally!
gem build todoable.gemspec
gem install todoable-1.0.0.gemIf you want to include the gem in IRB you will need to require todoable.
require 'todoable'In IRB, you can initialize this gem like so:
Todoable.configure do |c|
c.username = 'yourusername'
c.password = 'yourpassword'
endGET /lists
Retrieves all lists. The lists in this response do not include todo items.
lists = Todoable::List.allPOST /lists
Creates a list. Currently, the API only supports name
list = Todoable::List.new(name: 'My List')
list.createGET /lists/:list_id
Retrieve list information. This includes the todo items in the list.
list = Todoable::List.find(list_id)PATCH /lists/:list_id
Once a list is retrieved, you can update it by altering its attributes (currently only name) like so:
list.name = 'New Name'
list.updateDELETE /lists/:list_id
Once a list is retrieved, you can delete it like so:
list.destroyAlternatively, you can destroy based off identifier
Todoable::List.destroy(list_id)POST /lists/:list_id/items
Add an item to a given list. This can be done in two ways
list.add_item('Name of Item')
# OR
Todoable::Item.new(list: list, name: 'Name of Item').createPUT /lists/:list_id/items/:item_id/finish
Marks an item as finished.
If you've fetched a list via Todoable::List.find you have access to its items:
list = Todoable::List.find(list_id)
item = list.items.first
item.finish!DELETE /lists/:list_id/items/:item_id
Deletes the item.
item.destroyTests can be found in the spec directory, and can be run via rspec:
cd path/to/todoable
bundle exec rspec spec