keen 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -226,6 +226,9 @@ To track email opens, simply add an image to your email template that points to
|
|
226
226
|
|
227
227
|
### Changelog
|
228
228
|
|
229
|
+
##### 0.7.5
|
230
|
+
+ Use `CGI.escape` instead of `URI.escape` to get accurate URL encoding for certain characters
|
231
|
+
|
229
232
|
##### 0.7.4
|
230
233
|
+ Add support for deletes (thanks again [cbartlett](https://github.com/cbartlett)!)
|
231
234
|
+ Allow event collection names for publishing/deleting methods to be symbols
|
data/lib/keen/client.rb
CHANGED
@@ -89,7 +89,7 @@ module Keen
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def api_event_collection_resource_path(event_collection)
|
92
|
-
"/#{api_version}/projects/#{project_id}/events/#{
|
92
|
+
"/#{api_version}/projects/#{project_id}/events/#{CGI.escape(event_collection.to_s)}"
|
93
93
|
end
|
94
94
|
|
95
95
|
def preprocess_params(params)
|
@@ -111,7 +111,7 @@ module Keen
|
|
111
111
|
|
112
112
|
query_params = ""
|
113
113
|
params.each do |param, value|
|
114
|
-
query_params << "#{param}=#{
|
114
|
+
query_params << "#{param}=#{CGI.escape(value)}&"
|
115
115
|
end
|
116
116
|
|
117
117
|
query_params.chop!
|
data/lib/keen/version.rb
CHANGED
@@ -10,7 +10,7 @@ describe Keen::Client do
|
|
10
10
|
:api_url => api_url ) }
|
11
11
|
|
12
12
|
def delete_url(event_collection, filter_params=nil)
|
13
|
-
"#{api_url}/#{api_version}/projects/#{project_id}/events/#{event_collection}#{filter_params ? "?filters=#{
|
13
|
+
"#{api_url}/#{api_version}/projects/#{project_id}/events/#{event_collection}#{filter_params ? "?filters=#{CGI.escape(MultiJson.encode(filter_params[:filters]))}" : ""}"
|
14
14
|
end
|
15
15
|
|
16
16
|
describe '#delete' do
|
@@ -37,9 +37,9 @@ describe Keen::Client::PublishingMethods do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should url encode the event collection" do
|
40
|
-
stub_keen_post(api_event_collection_resource_url(api_url, "foo
|
40
|
+
stub_keen_post(api_event_collection_resource_url(api_url, "foo+bar"), 201, "")
|
41
41
|
client.publish("foo bar", event_properties)
|
42
|
-
expect_keen_post(api_event_collection_resource_url(api_url, "foo
|
42
|
+
expect_keen_post(api_event_collection_resource_url(api_url, "foo+bar"), event_properties, "sync", write_key)
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should wrap exceptions" do
|
@@ -137,12 +137,12 @@ describe Keen::Client::PublishingMethods do
|
|
137
137
|
}
|
138
138
|
end
|
139
139
|
|
140
|
-
it "should
|
141
|
-
stub_keen_post(api_event_collection_resource_url(api_url, "foo
|
140
|
+
it "should url encode the event collection" do
|
141
|
+
stub_keen_post(api_event_collection_resource_url(api_url, "foo+bar"), 201, api_success)
|
142
142
|
EM.run {
|
143
143
|
client.publish_async("foo bar", event_properties).callback {
|
144
144
|
begin
|
145
|
-
expect_keen_post(api_event_collection_resource_url(api_url, "foo
|
145
|
+
expect_keen_post(api_event_collection_resource_url(api_url, "foo+bar"), event_properties, "async", write_key)
|
146
146
|
ensure
|
147
147
|
EM.stop
|
148
148
|
end
|
@@ -68,29 +68,29 @@ describe Keen::Client do
|
|
68
68
|
|
69
69
|
it "should encode filters properly" do
|
70
70
|
filters = [{
|
71
|
-
:property_name => "animal",
|
71
|
+
:property_name => "the+animal",
|
72
72
|
:operator => "eq",
|
73
73
|
:property_value => "dogs"
|
74
74
|
}]
|
75
|
-
filter_str = MultiJson.encode(filters)
|
75
|
+
filter_str = CGI.escape(MultiJson.encode(filters))
|
76
76
|
test_query("&filters=#{filter_str}", :filters => filters)
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should encode absolute timeframes properly" do
|
80
80
|
timeframe = {
|
81
|
-
:start => "2012-08-13T19:00Z",
|
82
|
-
:end => "2012-08-13T19:00Z",
|
81
|
+
:start => "2012-08-13T19:00Z+00:00",
|
82
|
+
:end => "2012-08-13T19:00Z+00:00",
|
83
83
|
}
|
84
|
-
timeframe_str = MultiJson.encode(timeframe)
|
84
|
+
timeframe_str = CGI.escape(MultiJson.encode(timeframe))
|
85
85
|
test_query("&timeframe=#{timeframe_str}", :timeframe => timeframe)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should encode steps properly" do
|
89
89
|
steps = [{
|
90
|
-
:event_collection => "
|
90
|
+
:event_collection => "sign ups",
|
91
91
|
:actor_property => "user.id"
|
92
92
|
}]
|
93
|
-
steps_str = MultiJson.encode(steps)
|
93
|
+
steps_str = CGI.escape(MultiJson.encode(steps))
|
94
94
|
test_query("&steps=#{steps_str}", :steps => steps)
|
95
95
|
end
|
96
96
|
|
metadata
CHANGED
@@ -1,40 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: keen
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
- 5
|
10
|
+
version: 0.7.5
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Kyle Wild
|
9
14
|
- Josh Dzielak
|
10
15
|
- Daniel Kador
|
11
16
|
autorequire:
|
12
17
|
bindir: bin
|
13
18
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
19
|
+
|
20
|
+
date: 2013-06-11 00:00:00 -07:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
17
24
|
name: multi_json
|
18
|
-
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
|
-
requirements:
|
21
|
-
- - ~>
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '1.0'
|
24
|
-
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
|
26
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
27
27
|
none: false
|
28
|
-
requirements:
|
28
|
+
requirements:
|
29
29
|
- - ~>
|
30
|
-
- !ruby/object:Gem::Version
|
31
|
-
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
hash: 15
|
32
|
+
segments:
|
33
|
+
- 1
|
34
|
+
- 0
|
35
|
+
version: "1.0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
32
38
|
description: Send events and build analytics features into your Ruby applications.
|
33
39
|
email: josh@keen.io
|
34
40
|
executables: []
|
41
|
+
|
35
42
|
extensions: []
|
43
|
+
|
36
44
|
extra_rdoc_files: []
|
37
|
-
|
45
|
+
|
46
|
+
files:
|
38
47
|
- .gitignore
|
39
48
|
- .rspec
|
40
49
|
- .travis.yml
|
@@ -64,31 +73,41 @@ files:
|
|
64
73
|
- spec/spec_helper.rb
|
65
74
|
- spec/synchrony/spec_helper.rb
|
66
75
|
- spec/synchrony/synchrony_spec.rb
|
76
|
+
has_rdoc: true
|
67
77
|
homepage: https://github.com/keenlabs/keen-gem
|
68
78
|
licenses: []
|
79
|
+
|
69
80
|
post_install_message:
|
70
81
|
rdoc_options: []
|
71
|
-
|
82
|
+
|
83
|
+
require_paths:
|
72
84
|
- lib
|
73
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
86
|
none: false
|
75
|
-
requirements:
|
76
|
-
- -
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
|
79
|
-
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
95
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
85
103
|
requirements: []
|
104
|
+
|
86
105
|
rubyforge_project:
|
87
|
-
rubygems_version: 1.
|
106
|
+
rubygems_version: 1.6.2
|
88
107
|
signing_key:
|
89
108
|
specification_version: 3
|
90
109
|
summary: Keen IO API Client
|
91
|
-
test_files:
|
110
|
+
test_files:
|
92
111
|
- spec/integration/api_spec.rb
|
93
112
|
- spec/integration/spec_helper.rb
|
94
113
|
- spec/keen/client/maintenance_methods_spec.rb
|