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 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
- * Use Jeweler!
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
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 2
4
- :patch: 2
3
+ :minor: 3
4
+ :patch: 0
5
5
  :build:
@@ -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.)
@@ -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
- When /^I post (\d+) events$/ do |n|
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
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "keen"
8
- s.version = "0.2.2"
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-10-27"
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 = [
@@ -56,7 +56,13 @@ module Keen
56
56
  event = Keen::Event.new(event_collection, event_properties)
57
57
 
58
58
  # build the request:
59
- url = "#{base_url}/projects/#{project_id}/events/#{event_collection}"
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.2.2
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-10-27 00:00:00 Z
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: -1089062081955943772
135
+ hash: -1792663848985586478
136
136
  segments:
137
137
  - 0
138
138
  version: "0"