An open API service indexing awesome lists of open source software.

https://github.com/cored/todoable

Exercise on OOD
https://github.com/cored/todoable

Last synced: about 1 month ago
JSON representation

Exercise on OOD

Awesome Lists containing this project

README

          

# Todoable

Wrapper for the Todoable API

[![Maintainability](https://api.codeclimate.com/v1/badges/2e46f4fbc22fc4170fdc/maintainability)](https://codeclimate.com/github/cored/todoable/maintainability)

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'todoable'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install todoable

## Usage

```ruby
require "todoable"
```

### Authentication

```ruby
# Export the following environment variables
# export TODOABLE_USERNAME=""
# export TODOABLE_PASSWORD=""
# or be explicit it and pass your credentials to the client as so

client = Todoable.authenticate!(username: , password: )
```

### Retrieve lists

```ruby
client.lists
=> #,
#]>
```

### Retrieve a single list

```ruby
list = client.create_list!(name: "For single retrieval")
client.list(id: list.id)
=> #
```

### Create a list

```ruby
Todoable.create_list!(name: "my_new_list")
=> #
```

### Update a list

```ruby
list = client.create_list!(name: "My new list for update")
=> #

client.update_list!(id: list.id, name: "Updating my list")
=> #
```

### Delete a list

```ruby
list = client.list.find_by(name: "For the readme")
Todoable.delete_list!(id: list.id)
=> #
```

### Create a todo item

```ruby
list = client.lists.first
client.create_item!(list_id: list.id, name: "My new item")
=> #
```

### Mark an item as finished

```ruby
list = client.lists.first
=> #
client.create_item!(list_id: list.id, name: "Item to mark as finished")
=> #
client.mark_item_finished!(list_id: list.id, id: "b1568832-21f6-4900-a1ce-b3106c763872")
=> #>
```

### Delete an item from a list

```ruby
list = client.lists.first
=> #
item = client.create_item!(list_id: list.id, name: "Delete me Please!")
=> #
client.delete_item!(list_id: list.id, id: item.id).list(id: list.id).items.include?(item)
=> false
```

## Development

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](https://rubygems.org).

## Contributing

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](http://contributor-covenant.org) code of conduct.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Todoable project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/cored/todoable/blob/master/CODE_OF_CONDUCT.md).