README.md in keen-0.4.2 vs README.md in keen-0.4.3

- old
+ new

@@ -21,11 +21,11 @@ * Rubinius * jRuby (except for asynchronous methods - no TLS support for EM on jRuby) ### Usage -Before making any API calls, you must supply the keen gem with a Project ID and an API Key. +Before making any API calls, you must supply keen-gem with a Project ID and an API Key. (If you need a Keen IO account, [sign up here](https://keen.io/) - it's free.) The recommended way to do this is to set `KEEN_PROJECT_ID` and `KEEN_API_KEY` in your environment. If you're using [foreman](http://ddollar.github.com/foreman/), add this to your `.env` file: @@ -78,28 +78,49 @@ This will schedule the network call into the event loop and allow your request thread to resume processing immediately. ### Other code examples -##### Authentication +#### Authentication -To configure the keen gem credentials in code, do as follows: +To configure keen-gem credentials in code, do as follows: Keen.project_id = 'your-project-id' Keen.api_key = 'your-api-key' You can also configure individual client instances as follows: - keen = new Keen::Client.new(:project_id => 'your-project-id', - :api_key => 'your-api-key') + keen = Keen::Client.new(:project_id => 'your-project-id', + :api_key => 'your-api-key') -##### On keen.io +#### em-synchrony +keen-gem can be used with [em-synchrony](https://github.com/igrigorik/em-synchrony). +If you call `publish_async` and `EM::Synchrony` is defined the method will return the response +directly. (It does not return the deferrable on which to register callbacks.) Likewise, it will raise +exceptions 'synchronously' should they happen. -For more information and examples visit the -Keen IO [Ruby Usage Guide](https://keen.io/docs/clients/ruby/usage-guide/). +#### Beacon URL's +It's possible to publish events to your Keen IO project using the HTTP GET method. +This is useful for situations like tracking email opens using [image beacons](http://en.wikipedia.org/wiki/Web_bug). + +In this situation, the JSON event data is passed by encoding it base-64 and adding it as a request parameter called `data`. +The `beacon_url` method found on the `Keen::Client` does this for you. Here's an example: + + keen = Keen::Client.new(:project_id => '12345', + :api_key => 'abcde') + + keen.beacon_url("sign_ups", :recipient => "foo@foo.com") + # => "https://api.keen.io/3.0/projects/50e5ffa6897a2c319b000000/events/ \ + email_opens?api_key=f806128f31c349fda124b62d1f4cf4b2&data=eyJyZWNpcGllbnQiOiJmb29AZm9vLmNvbSJ9" + +To track email opens, simply add an image to your email template that points to this URL. + ### Questions & Support If you have any questions, bugs, or suggestions, please report them via Github Issues. Or, come chat with us anytime at [users.keen.io](http://users.keen.io). We'd love to hear your feedback and ideas! +### Contributing +keen-gem is an open source project and we welcome your contributions. +Fire away with issues and pull requests!