mixpanel_client 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +5 -0
- data/bin/autospec +16 -0
- data/bin/htmldiff +16 -0
- data/bin/ldiff +16 -0
- data/bin/rake +16 -0
- data/bin/ri +16 -0
- data/bin/rspec +16 -0
- data/lib/mixpanel/client.rb +26 -4
- data/lib/mixpanel/version.rb +1 -1
- data/spec/mixpanel_client/mixpanel_client_spec.rb +10 -0
- metadata +76 -126
data/README.md
CHANGED
@@ -94,6 +94,9 @@ Create tag v2.0.2 and build and push mixpanel_client-2.0.2.gem to Rubygems
|
|
94
94
|
|
95
95
|
## Changelog
|
96
96
|
|
97
|
+
### v3.1.1
|
98
|
+
* Avoid overriding the arg of client.request
|
99
|
+
* Allow retrieving the request_uri of a Mixpanel request
|
97
100
|
|
98
101
|
### v3.1.0
|
99
102
|
* Parallel requests option.
|
@@ -149,6 +152,8 @@ Create tag v2.0.2 and build and push mixpanel_client-2.0.2.gem to Rubygems
|
|
149
152
|
Feel free to add your name and link here.
|
150
153
|
|
151
154
|
[Keolo Keagy](http://github.com/keolo) (Author)
|
155
|
+
[Hiroshige Umino](https://github.com/yaotti)
|
156
|
+
[Gabor Ratky](https://github.com/rgabo)
|
152
157
|
[Bill DeRusha](https://github.com/bderusha)
|
153
158
|
[Jason Logsdon](https://github.com/jasonlogsdon)
|
154
159
|
[James R](https://github.com/Cev)
|
data/bin/autospec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'autospec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'autospec')
|
data/bin/htmldiff
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'htmldiff' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/ldiff
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'ldiff' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('diff-lcs', 'ldiff')
|
data/bin/rake
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rake' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rake', 'rake')
|
data/bin/ri
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'ri' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rdoc', 'ri')
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'pathname'
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require 'rubygems'
|
14
|
+
require 'bundler/setup'
|
15
|
+
|
16
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/lib/mixpanel/client.rb
CHANGED
@@ -46,8 +46,7 @@ module Mixpanel
|
|
46
46
|
# @options [Hash] options variables used to make a specific request for mixpanel data
|
47
47
|
# @return [JSON, String] mixpanel response as a JSON object or CSV string
|
48
48
|
def request(resource, options)
|
49
|
-
@
|
50
|
-
@uri = URI.mixpanel(resource, normalize_options(options))
|
49
|
+
@uri = request_uri(resource, options)
|
51
50
|
if @parallel
|
52
51
|
parallel_request = prepare_parallel_request
|
53
52
|
hydra.queue parallel_request
|
@@ -59,6 +58,28 @@ module Mixpanel
|
|
59
58
|
end
|
60
59
|
end
|
61
60
|
|
61
|
+
# Return mixpanel URI to the data
|
62
|
+
#
|
63
|
+
# @example
|
64
|
+
# uri = client.request_uri('events/properties', {
|
65
|
+
# event: '["test-event"]',
|
66
|
+
# name: 'hello',
|
67
|
+
# values: '["uno", "dos"]',
|
68
|
+
# type: 'general',
|
69
|
+
# unit: 'hour',
|
70
|
+
# interval: 24,
|
71
|
+
# limit: 5,
|
72
|
+
# bucket: 'contents'
|
73
|
+
# })
|
74
|
+
#
|
75
|
+
# @resource [String] mixpanel api resource endpoint
|
76
|
+
# @options [Hash] options variables used to make a specific request for mixpanel data
|
77
|
+
# @return [JSON, String] mixpanel response as a JSON object or CSV string
|
78
|
+
def request_uri(resource, options)
|
79
|
+
@format = options[:format] || :json
|
80
|
+
URI.mixpanel(resource, normalize_options(options))
|
81
|
+
end
|
82
|
+
|
62
83
|
def prepare_parallel_request
|
63
84
|
request = ::Typhoeus::Request.new(@uri)
|
64
85
|
request.on_complete do |response|
|
@@ -91,11 +112,12 @@ module Mixpanel
|
|
91
112
|
#
|
92
113
|
# @return [Hash] collection of options including defaults and generated signature
|
93
114
|
def normalize_options(options)
|
94
|
-
options.
|
115
|
+
normalized_options = options.dup
|
116
|
+
normalized_options.merge!(
|
95
117
|
:format => @format,
|
96
118
|
:api_key => @api_key,
|
97
119
|
:expire => Time.now.to_i + 600 # Grant this request 10 minutes
|
98
|
-
).merge!(:sig => Utils.generate_signature(
|
120
|
+
).merge!(:sig => Utils.generate_signature(normalized_options, @api_secret))
|
99
121
|
end
|
100
122
|
|
101
123
|
def self.base_uri_for_resource(resource)
|
data/lib/mixpanel/version.rb
CHANGED
@@ -59,6 +59,16 @@ describe Mixpanel::Client do
|
|
59
59
|
data.should == {"events"=>[], "type"=>"general"}
|
60
60
|
end
|
61
61
|
|
62
|
+
it 'does not modify the provided options' do
|
63
|
+
options = { foo: 'bar' }
|
64
|
+
# Stub Mixpanel request
|
65
|
+
stub_request(:get, /^#{@uri}.*/).to_return(:body => '{"events": [], "type": "general"}')
|
66
|
+
expect {
|
67
|
+
@client.request('events/top', options)
|
68
|
+
}.to_not change { options }
|
69
|
+
end
|
70
|
+
|
71
|
+
|
62
72
|
context "with parallel option enabled" do
|
63
73
|
before :all do
|
64
74
|
@parallel_client = Mixpanel::Client.new(:api_key => 'test_key', :api_secret => 'test_secret', :parallel => true)
|
metadata
CHANGED
@@ -1,142 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixpanel_client
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.1.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 3
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 3.1.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Keolo Keagy
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: json
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 6
|
32
|
-
version: "1.6"
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
36
15
|
name: typhoeus
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70281989507260 !ruby/object:Gem::Requirement
|
39
17
|
none: false
|
40
|
-
requirements:
|
18
|
+
requirements:
|
41
19
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
- 5
|
47
|
-
- 4
|
20
|
+
- !ruby/object:Gem::Version
|
48
21
|
version: 0.5.4
|
49
22
|
type: :runtime
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: bundler
|
53
23
|
prerelease: false
|
54
|
-
|
24
|
+
version_requirements: *70281989507260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &70281989506700 !ruby/object:Gem::Requirement
|
55
28
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 1
|
62
|
-
- 2
|
63
|
-
version: "1.2"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.2'
|
64
33
|
type: :development
|
65
|
-
version_requirements: *id003
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: rake
|
68
34
|
prerelease: false
|
69
|
-
|
35
|
+
version_requirements: *70281989506700
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &70281989506160 !ruby/object:Gem::Requirement
|
70
39
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 11
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
- 9
|
78
|
-
- 2
|
79
|
-
- 2
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
80
43
|
version: 0.9.2.2
|
81
44
|
type: :development
|
82
|
-
version_requirements: *id004
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rdoc
|
85
45
|
prerelease: false
|
86
|
-
|
46
|
+
version_requirements: *70281989506160
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rdoc
|
49
|
+
requirement: &70281989505660 !ruby/object:Gem::Requirement
|
87
50
|
none: false
|
88
|
-
requirements:
|
89
|
-
- -
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
|
92
|
-
segments:
|
93
|
-
- 3
|
94
|
-
- 11
|
95
|
-
version: "3.11"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.11'
|
96
55
|
type: :development
|
97
|
-
version_requirements: *id005
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rspec
|
100
56
|
prerelease: false
|
101
|
-
|
57
|
+
version_requirements: *70281989505660
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &70281989505140 !ruby/object:Gem::Requirement
|
102
61
|
none: false
|
103
|
-
requirements:
|
104
|
-
- -
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
hash: 27
|
107
|
-
segments:
|
108
|
-
- 2
|
109
|
-
- 5
|
110
|
-
- 0
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
111
65
|
version: 2.5.0
|
112
66
|
type: :development
|
113
|
-
version_requirements: *id006
|
114
|
-
- !ruby/object:Gem::Dependency
|
115
|
-
name: webmock
|
116
67
|
prerelease: false
|
117
|
-
|
68
|
+
version_requirements: *70281989505140
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: &70281989504660 !ruby/object:Gem::Requirement
|
118
72
|
none: false
|
119
|
-
requirements:
|
120
|
-
- -
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
hash: 51
|
123
|
-
segments:
|
124
|
-
- 1
|
125
|
-
- 9
|
126
|
-
- 0
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
127
76
|
version: 1.9.0
|
128
77
|
type: :development
|
129
|
-
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70281989504660
|
130
80
|
description: Simple ruby client interface to the Mixpanel API.
|
131
|
-
email:
|
81
|
+
email:
|
132
82
|
- keolo@dreampointmedia.com
|
133
|
-
executables:
|
134
|
-
|
83
|
+
executables:
|
84
|
+
- autospec
|
85
|
+
- htmldiff
|
86
|
+
- ldiff
|
87
|
+
- rake
|
88
|
+
- ri
|
89
|
+
- rspec
|
135
90
|
extensions: []
|
136
|
-
|
137
91
|
extra_rdoc_files: []
|
138
|
-
|
139
|
-
files:
|
92
|
+
files:
|
140
93
|
- .document
|
141
94
|
- .gitignore
|
142
95
|
- .rvmrc
|
@@ -144,6 +97,12 @@ files:
|
|
144
97
|
- LICENSE
|
145
98
|
- README.md
|
146
99
|
- Rakefile
|
100
|
+
- bin/autospec
|
101
|
+
- bin/htmldiff
|
102
|
+
- bin/ldiff
|
103
|
+
- bin/rake
|
104
|
+
- bin/ri
|
105
|
+
- bin/rspec
|
147
106
|
- config/mixpanel.template.yml
|
148
107
|
- lib/mixpanel/client.rb
|
149
108
|
- lib/mixpanel/exceptions.rb
|
@@ -161,38 +120,29 @@ files:
|
|
161
120
|
- spec/spec_helper.rb
|
162
121
|
homepage: http://github.com/keolo/mixpanel_client
|
163
122
|
licenses: []
|
164
|
-
|
165
123
|
post_install_message:
|
166
124
|
rdoc_options: []
|
167
|
-
|
168
|
-
require_paths:
|
125
|
+
require_paths:
|
169
126
|
- lib
|
170
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
171
128
|
none: false
|
172
|
-
requirements:
|
173
|
-
- -
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
|
176
|
-
|
177
|
-
- 0
|
178
|
-
version: "0"
|
179
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ! '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
134
|
none: false
|
181
|
-
requirements:
|
182
|
-
- -
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
|
185
|
-
segments:
|
186
|
-
- 0
|
187
|
-
version: "0"
|
135
|
+
requirements:
|
136
|
+
- - ! '>='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
188
139
|
requirements: []
|
189
|
-
|
190
140
|
rubyforge_project: mixpanel_client
|
191
141
|
rubygems_version: 1.8.15
|
192
142
|
signing_key:
|
193
143
|
specification_version: 3
|
194
144
|
summary: Ruby Mixpanel API Client Library
|
195
|
-
test_files:
|
145
|
+
test_files:
|
196
146
|
- spec/mixpanel_client/events_externalspec.rb
|
197
147
|
- spec/mixpanel_client/mixpanel_client_spec.rb
|
198
148
|
- spec/mixpanel_client/properties_externalspec.rb
|