keen 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f3ca87ca38420ae7e1f6a5eedb518cd15ea8dff
4
- data.tar.gz: 80f93a25b21544455b44e72201ce0aad31b71300
3
+ metadata.gz: cdbd068b61ab3dedb80577d36b86e3a80192e2f2
4
+ data.tar.gz: b975e45283ce9fb3c3f7abbd568f9dd36b9ab864
5
5
  SHA512:
6
- metadata.gz: 3ed597078e79fc3ea6f039b9932f3272d60bf14982fe71276d163bd4b250699410a4cc05ca07f1864d74c30235675726784bff7338d6508248980d60b3e7a18c
7
- data.tar.gz: 400daed8bfbbc1cc4a978650a6e435655c35943169bd15089f4a83179eed3443b80b62880fb521dd2c7382600194b25de43713d34e0cb41e8129a9cf702e074c
6
+ metadata.gz: ee3203515f0d95858f42991177e0006687c9ce36c20522014e2b7e77bd3b88d915eafe4d4ce30eb4d78e787f2163a005227e17fb3047b244070cbcf5f8880af1
7
+ data.tar.gz: 87131eec33c57530f95e64032166764f6416be47e323ba784590694a3f27a79a8a6b367bbba744a09cf9626a115afbcb798ef58c066154958ffbd31fb2ad3993
data/README.md CHANGED
@@ -177,6 +177,10 @@ Each query method or alias takes an optional hash of options as an additional pa
177
177
  `:response` – Set to `:all_keys` to return the full API response (usually only the value of the `"result"` key is returned).
178
178
  `:method` - Set to `:post` to enable post body based query (https://keen.io/docs/data-analysis/post-queries/).
179
179
 
180
+ ##### Query Caching
181
+
182
+ You can specify a `max_age` parameter as part of your query request, but make sure you send the request as a `:post` request.
183
+
180
184
  ##### Getting Query URLs
181
185
 
182
186
  Sometimes you just want the URL for a query, but don't actually need to run it. Maybe to paste into a dashboard, or open in your browser. In that case, use the `query_url` method:
@@ -387,6 +391,12 @@ If you want some bot protection, check out the [Voight-Kampff](https://github.co
387
391
 
388
392
  ### Changelog
389
393
 
394
+ ##### 0.9.2
395
+ + Added support for max_age as an integer.
396
+
397
+ ##### 0.9.1
398
+ + Added support for setting an IV for scoped keys. Thanks [@anatolydwnld](https://github.com/anatolydwnld)
399
+
390
400
  ##### 0.8.10
391
401
  + Added support for posting queries. Thanks [@soloman1124](https://github.com/soloman1124).
392
402
 
@@ -104,6 +104,7 @@ module Keen
104
104
 
105
105
  preprocess_encodables(params)
106
106
  preprocess_timeframe(params)
107
+ preprocess_max_age(params)
107
108
  preprocess_group_by(params)
108
109
  preprocess_percentile(params)
109
110
  preprocess_property_names(params)
@@ -133,6 +134,15 @@ module Keen
133
134
  end
134
135
  end
135
136
 
137
+ def preprocess_max_age(params)
138
+ max_age = params[:max_age]
139
+ if max_age.is_a? Numeric
140
+ params[:max_age] = params[:max_age].to_s
141
+ else
142
+ params.delete(:max_age)
143
+ end
144
+ end
145
+
136
146
  def preprocess_percentile(params)
137
147
  if params.key?(:percentile)
138
148
  params[:percentile] = params[:percentile].to_s
@@ -1,3 +1,3 @@
1
1
  module Keen
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
@@ -103,6 +103,22 @@ describe Keen::Client do
103
103
  end
104
104
  end
105
105
 
106
+ describe "preprocess_max_age" do
107
+ it "stringifies numbers" do
108
+ params = { :group_by => "foo.bar", :max_age => 3000 }
109
+ expect(
110
+ client.instance_eval{preprocess_params(params)}
111
+ ).to eq("group_by=foo.bar&max_age=3000")
112
+ end
113
+
114
+ it "ignores non-numbers" do
115
+ params = { :max_age => 'one hundred', :group_by => "foo.bar" }
116
+ expect(
117
+ client.instance_eval{preprocess_params(params)}
118
+ ).to eq("group_by=foo.bar")
119
+ end
120
+ end
121
+
106
122
  describe "preprocess_timeframe" do
107
123
  it "does nothing for string values" do
108
124
  params = { :timeframe => 'this_3_days' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kleissner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-07 00:00:00.000000000 Z
12
+ date: 2015-07-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json