keen 0.8.10 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/keen/client/maintenance_methods.rb +19 -0
- data/lib/keen/version.rb +1 -1
- data/spec/integration/api_spec.rb +11 -1
- data/spec/keen/client/maintenance_methods_spec.rb +13 -1
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71233f3a2e9ddc96e83f3da3dafa0039cedecda5
|
4
|
+
data.tar.gz: 42310b5093a4e6521f18bd42216054e5559ea0c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba7604df56cd05a57e56d2faa1f357356302d5769c1ceab719047cff3ed9882d192384855e6f3567260724ec535842b901b18b3ba4301cc90c5531d4d3390672
|
7
|
+
data.tar.gz: 3e7b5fb538b3102842823aeec35224c371e7f47cee570bdf5f912645520dcdf0dad44560bf828285d864240b0a8798aa6e7e2fef29b85f3b19733bef2a621599
|
@@ -65,6 +65,25 @@ module Keen
|
|
65
65
|
process_response(response.code, response_body)
|
66
66
|
end
|
67
67
|
|
68
|
+
# Return the named collection for the configured project
|
69
|
+
# See detailed documentation here:
|
70
|
+
# https://keen.io/docs/api/reference/#event-collection-resource
|
71
|
+
def event_collection(event_collection)
|
72
|
+
ensure_project_id!
|
73
|
+
ensure_master_key!
|
74
|
+
|
75
|
+
begin
|
76
|
+
response = http_sync.get(
|
77
|
+
:path => "/#{api_version}/projects/#{project_id}/events/#{event_collection}",
|
78
|
+
:headers => api_headers(self.master_key, "sync"))
|
79
|
+
rescue Exception => http_error
|
80
|
+
raise HttpError.new("Couldn't perform events on Keen IO: #{http_error.message}", http_error)
|
81
|
+
end
|
82
|
+
|
83
|
+
response_body = response.body ? response.body.chomp : ''
|
84
|
+
process_response(response.code, response_body)
|
85
|
+
end
|
86
|
+
|
68
87
|
private
|
69
88
|
|
70
89
|
def http_sync
|
data/lib/keen/version.rb
CHANGED
@@ -280,7 +280,9 @@ describe "Keen IO API" do
|
|
280
280
|
end
|
281
281
|
|
282
282
|
describe "project methods" do
|
283
|
-
|
283
|
+
let(:event_collection) { "test_collection" }
|
284
|
+
|
285
|
+
describe "event_collections" do
|
284
286
|
# requires a project with at least 1 collection
|
285
287
|
it "should return the project's collections as JSON" do
|
286
288
|
first_collection = Keen.event_collections.first
|
@@ -288,6 +290,14 @@ describe "Keen IO API" do
|
|
288
290
|
end
|
289
291
|
end
|
290
292
|
|
293
|
+
describe "event_collection" do
|
294
|
+
# requires a project with at least 1 collection
|
295
|
+
it "should return the project's named collection as JSON" do
|
296
|
+
first_collection = Keen.event_collection(:event_collection)
|
297
|
+
first_collection["properties"]["keen.timestamp"].should == "datetime"
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
291
301
|
describe "project_info" do
|
292
302
|
it "should return the project info as JSON" do
|
293
303
|
Keen.project_info["url"].should =~ Regexp.new(project_id)
|
@@ -5,6 +5,7 @@ describe Keen::Client do
|
|
5
5
|
let(:master_key) { 'pastor_of_muppets' }
|
6
6
|
let(:api_url) { "https://notreal.keen.io" }
|
7
7
|
let(:api_version) { "3.0" }
|
8
|
+
|
8
9
|
let(:client) { Keen::Client.new(
|
9
10
|
:project_id => project_id, :master_key => master_key,
|
10
11
|
:api_url => api_url ) }
|
@@ -46,7 +47,18 @@ describe Keen::Client do
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
|
-
describe '#
|
50
|
+
describe '#event_collection' do
|
51
|
+
let(:event_collection) { "foodstuffs" }
|
52
|
+
let(:events_url) { "#{api_url}/#{api_version}/projects/#{project_id}/events/#{event_collection}" }
|
53
|
+
|
54
|
+
it "should fetch the project's named event resource" do
|
55
|
+
stub_keen_get(events_url, 200, [{ "b" => 2 }] )
|
56
|
+
client.event_collection(event_collection).should == [{ "b" => 2 }]
|
57
|
+
expect_keen_get(events_url, "sync", master_key)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe '#project_info' do
|
50
62
|
let(:project_url) { "#{api_url}/#{api_version}/projects/#{project_id}" }
|
51
63
|
|
52
64
|
it "should fetch the project resource" do
|
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Kleissner
|
@@ -10,132 +10,132 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-
|
13
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|
17
17
|
requirement: !ruby/object:Gem::Requirement
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '1.3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '1.3'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: addressable
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
|
-
- -
|
33
|
+
- - ~>
|
34
34
|
- !ruby/object:Gem::Version
|
35
35
|
version: 2.3.5
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- -
|
40
|
+
- - ~>
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 2.3.5
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: guard
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - '>='
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- -
|
54
|
+
- - '>='
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: guard-rspec
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
|
-
- -
|
61
|
+
- - '>='
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- -
|
68
|
+
- - '>='
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: rb-inotify
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
|
-
- -
|
82
|
+
- - '>='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: rb-fsevent
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- -
|
89
|
+
- - '>='
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '0'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - '>='
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: rb-fchange
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
|
-
- -
|
103
|
+
- - '>='
|
104
104
|
- !ruby/object:Gem::Version
|
105
105
|
version: '0'
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- -
|
110
|
+
- - '>='
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '0'
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: ruby_gntp
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- -
|
117
|
+
- - '>='
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: '0'
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - '>='
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: rb-readline
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
|
-
- -
|
131
|
+
- - '>='
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
|
-
- -
|
138
|
+
- - '>='
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
description: Send events and build analytics features into your Ruby applications.
|
@@ -144,9 +144,9 @@ executables: []
|
|
144
144
|
extensions: []
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
147
|
+
- .gitignore
|
148
|
+
- .rspec
|
149
|
+
- .travis.yml
|
150
150
|
- Gemfile
|
151
151
|
- Guardfile
|
152
152
|
- LICENSE
|
@@ -185,17 +185,17 @@ require_paths:
|
|
185
185
|
- lib
|
186
186
|
required_ruby_version: !ruby/object:Gem::Requirement
|
187
187
|
requirements:
|
188
|
-
- -
|
188
|
+
- - '>='
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
192
|
requirements:
|
193
|
-
- -
|
193
|
+
- - '>='
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
196
|
requirements: []
|
197
197
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.
|
198
|
+
rubygems_version: 2.0.14
|
199
199
|
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Keen IO API Client
|