Wrapper for the Todoable API
Add this line to your application's Gemfile:
gem 'todoable'
And then execute:
$ bundle
Or install it yourself as:
$ gem install todoable
require "todoable"
# Export the following environment variables
# export TODOABLE_USERNAME="<your_user_name>"
# export TODOABLE_PASSWORD="<your_password>"
# or be explicit it and pass your credentials to the client as so
client = Todoable.authenticate!(username: <your_username>, password: <your_password>)
client.lists
=> #<Todoable::Resources::Lists lists=[
#<Todoable::Resources::List
name="My new List"
id="7ad41da8-1e81-4636-ae7f-5f2905974c31"
src="http://todoable.teachable.tech/api/lists/7ad41da8-1e81-4636-ae7f-5f2905974c31">,
#<Todoable::Resources::List
name="Testing List"
id="929bda84-b2e2-459f-b62d-4d76f58e96f0"
src="http://todoable.teachable.tech/api/lists/929bda84-b2e2-459f-b62d-4d76f58e96f0">]>
list = client.create_list!(name: "For single retrieval")
client.list(id: list.id)
=> #<Todoable::Resources::List name="For single retrieval" id=nil src=nil>
Todoable.create_list!(name: "my_new_list")
=> #<Todoable::Resources::List
name="For the readme"
id="1e87973c-61b3-42ce-8e2c-e3021b1d4500"
src="http://todoable.teachable.tech/api/lists/1e87973c-61b3-42ce-8e2c-e3021b1d4500">
list = client.create_list!(name: "My new list for update")
=> #<Todoable::Resources::List
name="My new list for update"
id="71b21943-acea-4512-be7f-9770546783e2"
src="http://todoable.teachable.tech/api/lists/71b21943-acea-4512-be7f-9770546783e2"
items=[]>
client.update_list!(id: list.id, name: "Updating my list")
=> #<Todoable::Resources::List
name="Updating my list"
id="71b21943-acea-4512-be7f-9770546783e2"
src="http://todoable.teachable.tech/api/lists/71b21943-acea-4512-be7f-9770546783e2"
items=[]>
list = client.list.find_by(name: "For the readme")
Todoable.delete_list!(id: list.id)
=> #<Todoable::Client:0x00007fe23d02de70 ...>
list = client.lists.first
client.create_item!(list_id: list.id, name: "My new item")
=> #<Todoable::Resources::Item
name="My new item"
id="69bf4828-2cb4-4f96-bced-37fa928c8fb2"
src="http://todoable.teachable.tech/api/lists/7ad41da8-1e81-4636-ae7f-5f2905974c31/items/69bf4828-2cb4-4f96-bced-37fa928c8fb2"
finished_at=nil>
list = client.lists.first
=> #<Todoable::Resources::List
name="List 1"
id="9718d581-4b06-4db8-adae-ae8db28dc1da"
src="http://todoable.teachable.tech/api/lists/9718d581-4b06-4db8-adae-ae8db28dc1da"
items=[]>
client.create_item!(list_id: list.id, name: "Item to mark as finished")
=> #<Todoable::Resources::Item
name="Item to mark as finished"
id="b1568832-21f6-4900-a1ce-b3106c763872"
src="http://todoable.teachable.tech/api/lists/9718d581-4b06-4db8-adae-ae8db28dc1da/items/b1568832-21f6-4900-a1ce-b3106c763872"
list_id="9718d581-4b06-4db8-adae-ae8db28dc1da" finished_at=nil>
client.mark_item_finished!(list_id: list.id, id: "b1568832-21f6-4900-a1ce-b3106c763872")
=> #<Todoable::Resources::Item
name="Item to mark as finished"
id="b1568832-21f6-4900-a1ce-b3106c763872"
src="http://todoable.teachable.tech/api/lists/9718d581-4b06-4db8-adae-ae8db28dc1da/items/b1568832-21f6-4900-a1ce-b3106c763872"
list_id="9718d581-4b06-4db8-adae-ae8db28dc1da"
finished_at=#<Date: 2018-10-18 ((2458410j,0s,0n),+0s,2299161j)>>
list = client.lists.first
=> #<Todoable::Resources::List
name="List 1"
id="9718d581-4b06-4db8-adae-ae8db28dc1da"
src="http://todoable.teachable.tech/api/lists/9718d581-4b06-4db8-adae-ae8db28dc1da"
items=[]>
item = client.create_item!(list_id: list.id, name: "Delete me Please!")
=> #<Todoable::Resources::Item
name="Delete me Please!"
id="7012cc3c-ea5e-437c-aaac-9f33ea0ad7b2"
src="http://todoable.teachable.tech/api/lists/9718d581-4b06-4db8-adae-ae8db28dc1da/items/7012cc3c-ea5e-437c-aaac-9f33ea0ad7b2"
list_id="9718d581-4b06-4db8-adae-ae8db28dc1da"
finished_at=nil>
client.delete_item!(list_id: list.id, id: item.id).list(id: list.id).items.include?(item)
=> false
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/cored/todoable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Todoable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.