keen 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION.yml +2 -2
- data/examples.rb +13 -0
- data/features/add_event.feature +5 -0
- data/features/step_definitions/keen_steps.rb +7 -5
- data/keen.gemspec +2 -2
- data/lib/keen/client.rb +7 -3
- metadata +3 -3
data/README.md
CHANGED
@@ -14,7 +14,7 @@ see Also the Cucumber and Rspec stuff in /features/ for usage details)
|
|
14
14
|
Contributing to keen
|
15
15
|
--------------------
|
16
16
|
|
17
|
-
*
|
17
|
+
* If you have gem release access, use Jeweler to increase version & release:
|
18
18
|
* rake version:bump:major
|
19
19
|
* rake release
|
20
20
|
* Make sure all tests pass in 1.9.2 and 1.9.3
|
data/VERSION.yml
CHANGED
data/examples.rb
CHANGED
@@ -23,5 +23,18 @@ keen.add_event("pageviews", {
|
|
23
23
|
:session => @session.hashify,
|
24
24
|
})
|
25
25
|
|
26
|
+
keen.add_event("purchases", [{
|
27
|
+
:quantity => @quantity1,
|
28
|
+
:user => @user1.hashify,
|
29
|
+
:item => @item1.hashify,
|
30
|
+
:session => @session1.hashify,
|
31
|
+
},{
|
32
|
+
:quantity => @quantity2,
|
33
|
+
:user => @user2.hashify,
|
34
|
+
:item => @item2.hashify,
|
35
|
+
:session => @session2.hashify,
|
36
|
+
}])
|
37
|
+
|
38
|
+
|
26
39
|
# (These examples pretend your important objects all have a method called
|
27
40
|
# "hashify", and that method serializes state information you wish to track.)
|
data/features/add_event.feature
CHANGED
@@ -8,3 +8,8 @@ Feature: AddEvent
|
|
8
8
|
Given a Keen Client in Direct Send mode
|
9
9
|
When I post an event
|
10
10
|
Then the response from the server should be good.
|
11
|
+
|
12
|
+
Scenario: Send Multiple Event directly to Keen
|
13
|
+
Given a Keen Client in Direct Send mode
|
14
|
+
When I post mulitple events
|
15
|
+
Then the response from the server should be good for each event
|
@@ -18,9 +18,11 @@ Then /^the response from the server should be good\.$/ do
|
|
18
18
|
response.should == {"created" => true}
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
n.to_i.times do
|
24
|
-
@client.add_event("cucumber_events", {:hi_from => "cucumber!", :keen_version => Keen::VERSION})
|
25
|
-
end
|
21
|
+
When /^I post mulitple events$/ do
|
22
|
+
@result = @client.add_event("cucumber_events", [{:hi_from => "cucumber 1!", :keen_version => Keen::VERSION},{:hi_from => "cucumber 2!", :keen_version => Keen::VERSION}])
|
26
23
|
end
|
24
|
+
|
25
|
+
Then /^the response from the server should be good for each event$/ do
|
26
|
+
response = @result
|
27
|
+
response.should == {"cucumber_events" => [{"success" => true},{"success" => true}]}
|
28
|
+
end
|
data/keen.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "keen"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["dorkitude"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-11-26"
|
13
13
|
s.description = "See the github repo or examples.rb for usage information."
|
14
14
|
s.email = "kyle@keen.io"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/keen/client.rb
CHANGED
@@ -56,7 +56,13 @@ module Keen
|
|
56
56
|
event = Keen::Event.new(event_collection, event_properties)
|
57
57
|
|
58
58
|
# build the request:
|
59
|
-
|
59
|
+
if event.properties.is_a?(Array)
|
60
|
+
url = "#{base_url}/projects/#{project_id}/events"
|
61
|
+
body = {event_collection => event.properties}
|
62
|
+
else
|
63
|
+
url = "#{base_url}/projects/#{project_id}/events/#{event_collection}"
|
64
|
+
body = event.properties
|
65
|
+
end
|
60
66
|
uri = URI.parse(url)
|
61
67
|
http = Net::HTTP.new(uri.host, uri.port)
|
62
68
|
http.use_ssl = true
|
@@ -66,8 +72,6 @@ module Keen
|
|
66
72
|
|
67
73
|
request = Net::HTTP::Post.new(uri.path)
|
68
74
|
|
69
|
-
body = event.properties
|
70
|
-
|
71
75
|
if timestamp
|
72
76
|
request.body[:keen] = {
|
73
77
|
:timestamp => timestamp
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: keen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- dorkitude
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-11-26 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
132
132
|
requirements:
|
133
133
|
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
hash: -
|
135
|
+
hash: -1792663848985586478
|
136
136
|
segments:
|
137
137
|
- 0
|
138
138
|
version: "0"
|