README.md in keen-0.8.8 vs README.md in keen-0.8.9

- old
+ new

@@ -111,34 +111,47 @@ Running queries requires that `KEEN_READ_KEY` is set. Here are some examples of querying with keen-gem. Let's assume you've added some events to the "purchases" collection. ```ruby +# Various analysis types Keen.count("purchases") # => 100 Keen.sum("purchases", :target_property => "price") # => 10000 Keen.minimum("purchases", :target_property => "price") # => 20 Keen.maximum("purchases", :target_property => "price") # => 100 Keen.average("purchases", :target_property => "price") # => 60 Keen.median("purchases", :target_property => "price") # => 60 Keen.percentile("purchases", :target_property => "price", :percentile => 90) # => 100 +Keen.count_unique("purchases", :target_property => "username") # => 3 +Keen.select_unique("purchases", :target_property => "username") # => ["Bob", "Linda", "Travis"] +# Group by's and filters Keen.sum("purchases", :target_property => "price", :group_by => "item.id") # => [{ "item.id": 123, "result": 240 }] Keen.count("purchases", :timeframe => "today", :filters => [{ "property_name" => "referred_by", "operator" => "eq", "property_value" => "harry" }]) # => 2 + +# Relative timeframes +Keen.count("purchases", :timeframe => "today") # => 10 -Keen.count_unique("purchases", :target_property => "username") # => 3 -Keen.select_unique("purchases", :target_property => "username") # => ["Bob", "Linda", "Travis"] +# Absolute timeframes +Keen.count("purchases", :timeframe => { + :start => "2015-01-01T00:00:00Z", + :end => "2015-31-01T00:00:00Z" +}) # => 5 +# Extractions Keen.extraction("purchases") # => [{ "keen" => { "timestamp" => "2014-01-01T00:00:00Z" }, "price" => 20 }] +# Funnels Keen.funnel(:steps => [{ :actor_property => "username", :event_collection => "purchases" }, { :actor_property => "username", :event_collection => "referrals" }]) # => [20, 15] +# Multi-analysis Keen.multi_analysis("purchases", analyses: { :gross => { :analysis_type => "sum", :target_property => "price" }, :customers => { :analysis_type => "count_unique", :target_property => "username" } }, :timeframe => 'today', :group_by => "item.id") # => [{ "item.id" => 2, "gross" => 314.49, "customers" => 8 } }] ``` @@ -268,21 +281,19 @@ ```ruby Keen.project_id = 'xxxxxxxxxxxxxxx' Keen.write_key = 'yyyyyyyyyyyyyyy' Keen.read_key = 'zzzzzzzzzzzzzzz' Keen.master_key = 'aaaaaaaaaaaaaaa' -Keen.read_timeoout = 60 ``` You can also configure unique client instances as follows: ```ruby keen = Keen::Client.new(:project_id => 'xxxxxxxxxxxxxxx', :write_key => 'yyyyyyyyyyyyyyy', :read_key => 'zzzzzzzzzzzzzzz', - :master_key => 'aaaaaaaaaaaaaaa', - :read_timeout => 60) + :master_key => 'aaaaaaaaaaaaaaa') ``` #### em-synchrony keen-gem can be used with [em-synchrony](https://github.com/igrigorik/em-synchrony). @@ -338,18 +349,21 @@ ##### HTTP Read Timeout The default `Net:HTTP` timeout is 60 seconds. That's usually enough, but if you're querying over a large collection you may need to increase it. The timeout on the API side is 300 seconds, so that's as far as you'd want to go. You can configure a read timeout (in seconds) by setting a `KEEN_READ_TIMEOUT` environment variable, or by passing in a `read_timeout` option to the client constructor as follows: -``` +``` ruby keen = Keen::Client.new(:read_timeout => 300) ``` ##### HTTP Proxy -You can set the `KEEN_PROXY_TYPE` and `KEEN_PROXY_URL` environment variables to enable HTTP proxying. `KEEN_PROXY_TYPE` should most likely be set to `socks5`. You can also configure this on client instances by passing in `proxy_type` and `proxy_url` keys. +You can set the `KEEN_PROXY_TYPE` and `KEEN_PROXY_URL` environment variables to enable HTTP proxying. `KEEN_PROXY_TYPE` should be set to `socks5`. You can also configure this on client instances by passing in `proxy_type` and `proxy_url` keys. +``` ruby +keen = Keen::Client.new(:proxy_type => 'socks5', :proxy_url => 'http://localhost:8888') +``` ### Troubleshooting ##### EventMachine @@ -361,9 +375,12 @@ If you write a script that uses `publish_async`, you need to keep the script alive long enough for the call(s) to complete. EventMachine itself won't do this because it runs in a different thread. Here's an [example gist](https://gist.github.com/dzello/7472823) that shows how to exit the process after the event has been recorded. ### Changelog + +##### 0.8.9 ++ Fix proxy support for sync client. Thanks [@nvieirafelipe](https://github.com/nvieirafelipe)! ##### 0.8.8 + Add support for a configurable read timeout ##### 0.8.7