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 +4 -4
- data/README.md +10 -0
- data/lib/keen/client.rb +10 -0
- data/lib/keen/version.rb +1 -1
- data/spec/keen/client_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdbd068b61ab3dedb80577d36b86e3a80192e2f2
|
4
|
+
data.tar.gz: b975e45283ce9fb3c3f7abbd568f9dd36b9ab864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
|
data/lib/keen/client.rb
CHANGED
@@ -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
|
data/lib/keen/version.rb
CHANGED
data/spec/keen/client_spec.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2015-07-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|