Ruby toolkit for the Trello API... a work-in-progress. Design and philosophy inspired by ocktokit.rb
This is Taco.
Add this line to your application"s Gemfile:
... or install it yourself as:
$ gem install tacokit
Configure the client with public-read application credentials:
# View an app key and secret on Trello .get_app_key # Configure the client .configure do |c| c.app_key = "4ppk3y" end
Make requests to Trello API methods using module-level configuration or as client instance methods.
# Fetch the current member .member # Fetch another member .member "tacokit" # Configure a separate client client = ::. app_key: "4ppk3y" # Fetch a member client.member "tacokit"
Trello supports application-level client authorization via an application key and application token.
Tacokit provides a simple way to retrieve your application key:
# Install the `launchy` gem to load the Trello page automatically .get_app_key
Your application key are available by logging into Trello and visiting the app key page. This page also provides your application secret that can be used to generate OAuth token access (see below).
The application token, generated separately from the app key, can be associated with a
expiration. See the Trello authorization docs for more info on token params.
Tacokit provides a simple way to generate a new app token:
# Full permissions for 30 days . scope: %w[ read write account ], expiration: "30days" # Authorize a custom application and a different app key . name: "My Trello App", key: "4ppk3y2" # Read only permissions for custom app forever . scope: "read", expiration: "never", name: "My Trello App"
Your Tacokit client can now be configured to make requests:
# Configure the client .configure do |c| c.app_key = "4ppk3y" c.app_token = "4ppt0k3n" end
More information is available in the Trello docs.
The Trello API provides OAuth 1.0 credentials through the typical OAuth web flow. Tacokit clients can therefore be configured separately to make requests on behalf of different members:
client = ::. app_key: "4ppk3y", oauth_token: "04utht0k3n"
To experiment with OAuth tokens for development, visit the Tacokit Sandbox and enter your Trello app key and app secret.
For more information on setting up Trello OAuth for your web application
- Using OmniAuth? Try adding omniauth-trello
- To roll your own, see how the sandbox works: Tacokit sandbox source
- Check out the Trello OAuth docs
Using ENV variables
Default Tacokit client values can be set by values in ENV:
TRELLO_APP_KEY=4ppk3y TRELLO_APP_SECRET=4pps3cr3t TRELLO_APP_TOKEN=4ppt0k3n
Working with boards
client.boards client.boards("rossta") board_id = "swezQ9XS" # short link to "Test Board" for Tacokit board = client.board(board_id) board.name = "Ice Box" client.update_board(board.id, name: "TODO")
Working with cards
client.cards client.cards("rossta") client.board_cards(board_id) card_id = "SpbauOpX" # short link to card on "Test Board" card.name = "Shopping List" client.update_card(card.id, name: "Wish List") client.move_card(card.id, list_id: list_id)
Working with lists
client.lists(board_id) list = client.list(list_id) list.name = "Work in Progress" client.update_list(list.id, name: "Done")
- Fork it ( https://github.com/[my-github-username]/tacokit/fork )
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am "Add some feature")
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request