keen 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -1
- data/lib/keen.rb +2 -1
- data/lib/keen/client/maintenance_methods.rb +20 -0
- data/lib/keen/version.rb +1 -1
- data/spec/keen/client/maintenance_methods_spec.rb +12 -2
- metadata +57 -22
- checksums.yaml +0 -7
data/README.md
CHANGED
@@ -139,10 +139,20 @@ Keen.multi_analysis("purchases", analyses: {
|
|
139
139
|
:timeframe => 'today', :group_by => "item.id") # => [{"item.id"=>2, "gross"=>314.49, "customers"=> 8}, { ... }]
|
140
140
|
```
|
141
141
|
|
142
|
-
Many of
|
142
|
+
Many of these queries can be performed with group by, filters, series and intervals. The response is returned as a Ruby Hash or Array.
|
143
143
|
|
144
144
|
Detailed information on available parameters for each API resource can be found on the [API Technical Reference](https://keen.io/docs/api/reference/).
|
145
145
|
|
146
|
+
### Listing collections
|
147
|
+
|
148
|
+
The Keen IO API let you get the event collections for the project set, it includes properties and their type. It also returns links to the collection resource.
|
149
|
+
|
150
|
+
```ruby
|
151
|
+
Keen.event_collections # => [{ "name": "purchases", "properties": { "item.id": "num", ... }, ... }]
|
152
|
+
```
|
153
|
+
|
154
|
+
Getting the list of event collections requires that the `KEEN_MASTER_KEY` is set.
|
155
|
+
|
146
156
|
### Deleting events
|
147
157
|
|
148
158
|
The Keen IO API allows you to [delete events](https://keen.io/docs/maintenance/#deleting-event-collections)
|
@@ -287,6 +297,9 @@ EventMachine itself won't do this because it runs in a different thread. Here's
|
|
287
297
|
|
288
298
|
### Changelog
|
289
299
|
|
300
|
+
##### 0.8.3
|
301
|
+
+ Add support for getting a list of a projects collections
|
302
|
+
|
290
303
|
##### 0.8.2
|
291
304
|
+ Add support for `median` and `percentile` analysis
|
292
305
|
+ Support arrays for extraction `property_names` option
|
data/lib/keen.rb
CHANGED
@@ -26,6 +26,26 @@ module Keen
|
|
26
26
|
response_body = response.body ? response.body.chomp : ''
|
27
27
|
process_response(response.code, response_body)
|
28
28
|
end
|
29
|
+
|
30
|
+
# Runs an events query.
|
31
|
+
# See detailed documentation here:
|
32
|
+
# https://keen.io/docs/api/reference/#event-resource
|
33
|
+
def event_collections
|
34
|
+
ensure_project_id!
|
35
|
+
ensure_master_key!
|
36
|
+
|
37
|
+
begin
|
38
|
+
response = Keen::HTTP::Sync.new(self.api_url, self.proxy_url).get(
|
39
|
+
:path => "/#{api_version}/projects/#{project_id}/events",
|
40
|
+
:headers => api_headers(self.master_key, "sync"))
|
41
|
+
rescue Exception => http_error
|
42
|
+
raise HttpError.new("Couldn't perform events on Keen IO: #{http_error.message}", http_error)
|
43
|
+
end
|
44
|
+
|
45
|
+
response_body = response.body ? response.body.chomp : ''
|
46
|
+
process_response(response.code, response_body)
|
47
|
+
end
|
48
|
+
|
29
49
|
end
|
30
50
|
end
|
31
51
|
end
|
data/lib/keen/version.rb
CHANGED
@@ -19,7 +19,7 @@ describe Keen::Client do
|
|
19
19
|
it 'should not require filters' do
|
20
20
|
url = delete_url(event_collection)
|
21
21
|
stub_keen_delete(url, 204)
|
22
|
-
client.delete(event_collection).should
|
22
|
+
client.delete(event_collection).should == true
|
23
23
|
expect_keen_delete(url, "sync", master_key)
|
24
24
|
end
|
25
25
|
|
@@ -30,9 +30,19 @@ describe Keen::Client do
|
|
30
30
|
]
|
31
31
|
}
|
32
32
|
url = delete_url(event_collection, filters)
|
33
|
-
stub_keen_delete(url, 204)
|
33
|
+
stub_keen_delete(url, 204)
|
34
34
|
client.delete(event_collection, filters)
|
35
35
|
expect_keen_delete(url, "sync", master_key)
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
describe '#event_collections' do
|
40
|
+
let(:events_url) { "#{api_url}/#{api_version}/projects/#{project_id}/events" }
|
41
|
+
|
42
|
+
it "should not require params" do
|
43
|
+
stub_keen_get(events_url, 200, [{ "a" => 1 }, { "b" => 2 }] )
|
44
|
+
client.event_collections.should == [{ "a" => 1 }, { "b" => 2 }]
|
45
|
+
expect_keen_get(events_url, "sync", master_key)
|
46
|
+
end
|
47
|
+
end
|
38
48
|
end
|
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.3
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Kyle Wild
|
@@ -10,11 +11,12 @@ authors:
|
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2014-
|
14
|
+
date: 2014-06-28 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: multi_json
|
17
18
|
requirement: !ruby/object:Gem::Requirement
|
19
|
+
none: false
|
18
20
|
requirements:
|
19
21
|
- - ~>
|
20
22
|
- !ruby/object:Gem::Version
|
@@ -22,6 +24,7 @@ dependencies:
|
|
22
24
|
type: :runtime
|
23
25
|
prerelease: false
|
24
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
25
28
|
requirements:
|
26
29
|
- - ~>
|
27
30
|
- !ruby/object:Gem::Version
|
@@ -29,6 +32,7 @@ dependencies:
|
|
29
32
|
- !ruby/object:Gem::Dependency
|
30
33
|
name: addressable
|
31
34
|
requirement: !ruby/object:Gem::Requirement
|
35
|
+
none: false
|
32
36
|
requirements:
|
33
37
|
- - ~>
|
34
38
|
- !ruby/object:Gem::Version
|
@@ -36,6 +40,7 @@ dependencies:
|
|
36
40
|
type: :runtime
|
37
41
|
prerelease: false
|
38
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
39
44
|
requirements:
|
40
45
|
- - ~>
|
41
46
|
- !ruby/object:Gem::Version
|
@@ -43,99 +48,129 @@ dependencies:
|
|
43
48
|
- !ruby/object:Gem::Dependency
|
44
49
|
name: guard
|
45
50
|
requirement: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
46
52
|
requirements:
|
47
|
-
- - '>='
|
53
|
+
- - ! '>='
|
48
54
|
- !ruby/object:Gem::Version
|
49
55
|
version: '0'
|
50
56
|
type: :development
|
51
57
|
prerelease: false
|
52
58
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
53
60
|
requirements:
|
54
|
-
- - '>='
|
61
|
+
- - ! '>='
|
55
62
|
- !ruby/object:Gem::Version
|
56
63
|
version: '0'
|
57
64
|
- !ruby/object:Gem::Dependency
|
58
65
|
name: guard-rspec
|
59
66
|
requirement: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
60
68
|
requirements:
|
61
|
-
- - '>='
|
69
|
+
- - ! '>='
|
62
70
|
- !ruby/object:Gem::Version
|
63
71
|
version: '0'
|
64
72
|
type: :development
|
65
73
|
prerelease: false
|
66
74
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
67
76
|
requirements:
|
68
|
-
- - '>='
|
77
|
+
- - ! '>='
|
69
78
|
- !ruby/object:Gem::Version
|
70
79
|
version: '0'
|
71
80
|
- !ruby/object:Gem::Dependency
|
72
81
|
name: rb-inotify
|
73
82
|
requirement: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
74
84
|
requirements:
|
75
|
-
- - '>='
|
85
|
+
- - ! '>='
|
76
86
|
- !ruby/object:Gem::Version
|
77
87
|
version: '0'
|
78
88
|
type: :development
|
79
89
|
prerelease: false
|
80
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
81
92
|
requirements:
|
82
|
-
- - '>='
|
93
|
+
- - ! '>='
|
83
94
|
- !ruby/object:Gem::Version
|
84
95
|
version: '0'
|
85
96
|
- !ruby/object:Gem::Dependency
|
86
97
|
name: rb-fsevent
|
87
98
|
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
88
100
|
requirements:
|
89
|
-
- - '>='
|
101
|
+
- - ! '>='
|
90
102
|
- !ruby/object:Gem::Version
|
91
103
|
version: '0'
|
92
104
|
type: :development
|
93
105
|
prerelease: false
|
94
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
95
108
|
requirements:
|
96
|
-
- - '>='
|
109
|
+
- - ! '>='
|
97
110
|
- !ruby/object:Gem::Version
|
98
111
|
version: '0'
|
99
112
|
- !ruby/object:Gem::Dependency
|
100
113
|
name: rb-fchange
|
101
114
|
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
102
116
|
requirements:
|
103
|
-
- - '>='
|
117
|
+
- - ! '>='
|
104
118
|
- !ruby/object:Gem::Version
|
105
119
|
version: '0'
|
106
120
|
type: :development
|
107
121
|
prerelease: false
|
108
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
109
124
|
requirements:
|
110
|
-
- - '>='
|
125
|
+
- - ! '>='
|
111
126
|
- !ruby/object:Gem::Version
|
112
127
|
version: '0'
|
113
128
|
- !ruby/object:Gem::Dependency
|
114
129
|
name: ruby_gntp
|
115
130
|
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
116
132
|
requirements:
|
117
|
-
- - '>='
|
133
|
+
- - ! '>='
|
118
134
|
- !ruby/object:Gem::Version
|
119
135
|
version: '0'
|
120
136
|
type: :development
|
121
137
|
prerelease: false
|
122
138
|
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
123
140
|
requirements:
|
124
|
-
- - '>='
|
141
|
+
- - ! '>='
|
125
142
|
- !ruby/object:Gem::Version
|
126
143
|
version: '0'
|
127
144
|
- !ruby/object:Gem::Dependency
|
128
145
|
name: rb-readline
|
129
146
|
requirement: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
130
148
|
requirements:
|
131
|
-
- - '>='
|
149
|
+
- - ! '>='
|
132
150
|
- !ruby/object:Gem::Version
|
133
151
|
version: '0'
|
134
152
|
type: :development
|
135
153
|
prerelease: false
|
136
154
|
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
137
156
|
requirements:
|
138
|
-
- - '>='
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: debugger
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
none: false
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
type: :development
|
169
|
+
prerelease: false
|
170
|
+
version_requirements: !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
139
174
|
- !ruby/object:Gem::Version
|
140
175
|
version: '0'
|
141
176
|
description: Send events and build analytics features into your Ruby applications.
|
@@ -178,26 +213,27 @@ files:
|
|
178
213
|
homepage: https://github.com/keenlabs/keen-gem
|
179
214
|
licenses:
|
180
215
|
- MIT
|
181
|
-
metadata: {}
|
182
216
|
post_install_message:
|
183
217
|
rdoc_options: []
|
184
218
|
require_paths:
|
185
219
|
- lib
|
186
220
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
|
+
none: false
|
187
222
|
requirements:
|
188
|
-
- - '>='
|
223
|
+
- - ! '>='
|
189
224
|
- !ruby/object:Gem::Version
|
190
225
|
version: '0'
|
191
226
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
227
|
+
none: false
|
192
228
|
requirements:
|
193
|
-
- - '>='
|
229
|
+
- - ! '>='
|
194
230
|
- !ruby/object:Gem::Version
|
195
231
|
version: '0'
|
196
232
|
requirements: []
|
197
233
|
rubyforge_project:
|
198
|
-
rubygems_version:
|
234
|
+
rubygems_version: 1.8.23
|
199
235
|
signing_key:
|
200
|
-
specification_version:
|
236
|
+
specification_version: 3
|
201
237
|
summary: Keen IO API Client
|
202
238
|
test_files:
|
203
239
|
- spec/integration/api_spec.rb
|
@@ -212,4 +248,3 @@ test_files:
|
|
212
248
|
- spec/spec_helper.rb
|
213
249
|
- spec/synchrony/spec_helper.rb
|
214
250
|
- spec/synchrony/synchrony_spec.rb
|
215
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: be248e41731a4f4e86d99397bc780980e468e643
|
4
|
-
data.tar.gz: 5f673b82043892b20214caa66c872266916a6df9
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: ebe7cd7ba80d155daf102d4e77ec18b595cec2640d58c87aa94b05f7c2fe566bd62e61b391a4a8beffb259f5b8fa3b1bab84de0aa4080ccbf38da4afebd21573
|
7
|
-
data.tar.gz: 5ae089f9bc5ac3993962398c0e31f0e715f00c418f313af7990e614d8bcff61da5230f2c544997d56914af3ede4cc4c155a1e8e94c2493221a894f4fd273a316
|