Permalink
Browse files

Updated README and settings example.

  • Loading branch information...
1 parent 2079d2e commit 06a447384e075a8189df560f58f427643c9b8d25 @dogeared committed Jan 3, 2013
Showing with 42 additions and 4 deletions.
  1. +39 −4 README.md
  2. +3 −0 config/environments/test/settings.js.example
View
@@ -1,4 +1,4 @@
-# Some Node.js Trello API examples
+# Node.js Trello API Action Event Handler
[View Trello’s API documentation online][apidocs]. For information on Trello’s API development, visit [their Trello board][trellotrello], of course.
[apidocs]: https://trello.com/docs/
@@ -18,7 +18,17 @@ npm install trello_tools
## Background
-This project uses the [peanut] function testing tool for node.js
+Nearly anything you do on a Trello board is captured as an action. Actions can be queried via the Trello API.
+
+The TrelloEvents library is an EventEmitter. Once you tell it to monitor a board, it will:
+
+* grab the latest batch of actions
+* update an internal ```since``` variable so that the next request results in a fresh batch actions
+* emit an event for each type of action passing in the associated data for the action
+
+All you have to do is bind listeners to the events you care about.
+
+This project uses the [peanut] functional testing tool for node.js
The tests that are included are meant to get you familiar with the Trello API using the [node-trello] project.
@@ -27,7 +37,27 @@ The tests that are included are meant to get you familiar with the Trello API us
Take a look at the code in: ```features/step_definitions``` to see what is going on in each scenario from ```features/trello.feature```
-## Setup
+## Typical usage
+
+```
+var TrelloEventsClass = require('trello_events')
+
+var trelloEvents = TrelloEventsClass(myKey, myToken)
+
+trelloEvents.on('createList', function(data) {
+ // act on the data from the createList event
+})
+
+trelloEvents.on('updateBoard', function(data) {
+ // act on the data from the updateBoard event
+})
+
+trelloEvents.monitor('MyBoard')
+```
+
+A complete list of all the actions exposed via the Trello API can be found [here][apidocs]
+
+## Setup for running the tests
You'll need to create a ```config/environments/test/settings.js``` based on the example file found there.
@@ -41,8 +71,13 @@ Make sure that peanut is installed:
npm install -g peanut
```
-## Running
+## Running the tests
```
make
```
+
+## ToDo/Issues
+
+* The timing of the event loop to check on actions should be configurable
+* While TrelloEvents supports monitoring more than one board, emitted events are not board specific
@@ -1,5 +1,8 @@
module.exports = {
key: 'YOUR PUBLIC KEY',
token: 'YOUR GENERATED TOKEN',
+ // IMPORTANT: This board will have all kinds of WRITE actions
+ // done to it, including archiving all the lists and cards.
+ // Make damn sure it's a test board!
board: 'A NEW BOARD NAME'
}

0 comments on commit 06a4473

Please sign in to comment.