mixpanel_client 4.1.6 → 5.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: a0b1c877cdcf416ba164f8e7b9fe9ab31857b090
4
- data.tar.gz: bfd32fe4693da8458500b26fe18e2143dd03359b
2
+ SHA256:
3
+ metadata.gz: 92ce0970f6a065421cf5620447554a5bdebe84fc803a4c440123528179b419ca
4
+ data.tar.gz: 11a1d24d5f9c62a7abb24dfd3b18d8da37d90c7144e0a488c8a02c0ea6d8f5c1
5
5
  SHA512:
6
- metadata.gz: 2b6d2372e919718d682ade39e7edf8740e31685c2e6272418c022e2b3374d53927a47e0dfd5a5c72d39a0df4bde2ad2c18943eed0acf01ea7708634989f372ff
7
- data.tar.gz: 330f9bd86e8436c439944fced484d8919c07279ad7ce1dff5023e15e99a2aa7b9dde581e7cfbb5be71a6029d898be5ab8b9ef7b6cf1489d5cb026c266f82eb65
6
+ metadata.gz: f98b5c85552df0ed4976379f2ad6a480693c1194994f0128600a8953b561834784c4a9dca3f373d443ff67dd9e56a24865b176b59b8f9b6ee43d5988a2ecd418
7
+ data.tar.gz: eed74d9307fd594115302f09e4aec535fcf5b17ee1e7cd0878737c917073f46bc252df9dcc22667009a50c0d57395f22424e363b6ef9b2e4e2f0448e649ff2fa
data/.rubocop.yml CHANGED
@@ -3,7 +3,8 @@
3
3
  #inherit_from: rubocop-todo.yml
4
4
 
5
5
  AllCops:
6
- Includes:
6
+ Include:
7
7
  - Rakefile
8
- Excludes:
8
+ Exclude:
9
9
  - bin/**
10
+ NewCops: enable
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'rake'
3
5
 
@@ -23,6 +25,7 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
23
25
  spec.rcov = true
24
26
  end
25
27
 
28
+ desc 'Run Rspec test suite'
26
29
  task :spec
27
30
  task default: :spec
28
31
 
data/changelog.md CHANGED
@@ -1,97 +1,131 @@
1
- ### v4.1.6
2
- * Remove deprecated authentication options. Fixes #55.
3
- * Use `expect` rspec syntax
4
- * Added codeclimate config
1
+ # Changelog
5
2
 
6
- ### v4.1.5
7
- * Use new authentication method for mixpanel. Fixes #52.
8
- * Use `expect` rspec syntax
3
+ ## 5.0.0
9
4
 
10
- ### v4.1.4
11
- * Add timeout option: Merged PR #48
5
+ - Removed parallel option in favor of having no runtime dependencies (fixes #58)
6
+ - Updated `expect` to use block instead of an argument
12
7
 
13
- ### v4.1.3
14
- * Make request options optional. Closes #46.
8
+ ## 4.1.6
15
9
 
16
- ### v4.1.2
17
- * Removes typhoeus version lock, fixes a "broken" test
10
+ - Remove deprecated authentication options. Fixes #55
11
+ - Use `expect` rspec syntax
12
+ - Added codeclimate config
18
13
 
19
- ### v4.1.1
20
- * Add raw response
14
+ ## 4.1.5
21
15
 
22
- ### v4.1.0
23
- * Drop support for config keys to be strings. Use symbols instead
24
- * Fixed some rubocop offences
25
- * Require Typhoeus when used
16
+ - Use new authentication method for mixpanel. Fixes #52
17
+ - Use `expect` rspec syntax
26
18
 
27
- ### v4.0.1
28
- * Raise ConfigurationError if api_key or api_secret are not present
19
+ ## 4.1.4
29
20
 
30
- ### v4.0.0
31
- * Dropped support for Ruby 1.8.x
32
- * Code cleanup via rubocop
21
+ - Add timeout option: Merged PR #48
33
22
 
34
- ### v3.1.4
35
- * Updated docs
36
- * Updated to latest typhoeus gem
23
+ ## 4.1.3
37
24
 
38
- ### v3.1.3
39
- * Added support for the import API.
40
- * Allow setting of custom expiry.
25
+ - Make request options optional. Closes #46
41
26
 
42
- ### v3.1.2
43
- * Gem updates
27
+ ## 4.1.2
44
28
 
45
- ### v3.1.1
46
- * Avoid overriding the arg of client.request
47
- * Allow retrieving the request_uri of a Mixpanel request
29
+ - Removes typhoeus version lock, fixes a "broken" test
48
30
 
49
- ### v3.1.0
50
- * Parallel requests option.
31
+ ## 4.1.1
51
32
 
52
- ### v3.0.0
53
- * NOTE: This version breaks backwards compatibility.
54
- * Use a regular ruby hash instead of metaprogramming for mixpanel options.
33
+ - Add raw response
55
34
 
56
- ### v2.2.3
57
- * Added some more options.
35
+ ## 4.1.0
58
36
 
59
- ### v2.2.2
60
- * Added some more options.
37
+ - Drop support for config keys to be strings. Use symbols instead
38
+ - Fixed some rubocop offences
39
+ - Require Typhoeus when used
61
40
 
62
- ### v2.2.1
63
- * Added support for the raw data export API.
41
+ ## 4.0.1
64
42
 
65
- ### v2.2.0
66
- * BASE_URI is now https.
67
- * Changed funnel to funnel_id.
43
+ - Raise ConfigurationError if api_key or api_secret are not present
68
44
 
69
- ### v2.1.0
70
- * Updated json dependency to 1.6.
45
+ ## 4.0.0
71
46
 
72
- ### v2.0.2
73
- * Added timezone to available options.
74
- * All exceptions can be caught under Mixpanel::Error.
47
+ - Dropped support for Ruby 1.8.x
48
+ - Code cleanup via rubocop
75
49
 
76
- ### v2.0.1
77
- * Added options used in segmentation resources.
50
+ ## 3.1.4
78
51
 
79
- ### v2.0.0
80
- * Manually tested compatibility with Mixpanel gem.
52
+ - Updated docs
53
+ - Updated to latest typhoeus gem
81
54
 
82
- ### v2.0.0.beta2
83
- * Added JSON to gemspec for ruby versions less than 1.9.
55
+ ## 3.1.3
84
56
 
85
- ### v2.0.0.beta1
86
- * Reverted to namespacing via module name because it's a better practice.
57
+ - Added support for the import API
58
+ - Allow setting of custom expiry
59
+
60
+ ## v3.1.2
61
+
62
+ - Gem updates
63
+
64
+ ## 3.1.1
65
+
66
+ - Avoid overriding the arg of client.request
67
+ - Allow retrieving the request_uri of a Mixpanel request
68
+
69
+ ## 3.1.0
70
+
71
+ - Parallel requests option
72
+
73
+ ## 3.0.0
74
+
75
+ - NOTE: This version breaks backwards compatibility
76
+ - Use a regular ruby hash instead of metaprogramming for mixpanel options
77
+
78
+ ## 2.2.3
79
+
80
+ - Added some more options
81
+
82
+ ## 2.2.2
83
+
84
+ - Added some more options
85
+
86
+ ## 2.2.1
87
+
88
+ - Added support for the raw data export API
89
+
90
+ ## 2.2.0
91
+
92
+ - BASE_URI is now https
93
+ - Changed funnel to funnel_id
94
+
95
+ ## 2.1.0
96
+
97
+ - Updated json dependency to 1.6
98
+
99
+ ## 2.0.2
100
+
101
+ - Added timezone to available options
102
+ - All exceptions can be caught under `Mixpanel::Error`
103
+
104
+ ## 2.0.1
105
+
106
+ - Added options used in segmentation resources
107
+
108
+ ## 2.0.0
109
+
110
+ - Manually tested compatibility with Mixpanel gem
111
+
112
+ ## 2.0.0.beta2
113
+
114
+ - Added JSON to gemspec for ruby versions less than 1.9
115
+
116
+ ## 2.0.0.beta1
117
+
118
+ - Reverted to namespacing via module name because it's a better practice.
87
119
  I.e. Use `Mixpanel::Client` instead of `MixpanelClient`.
88
- * Added 'values' as an optional parameter
89
- * `gem install mixpanel_client --pre`
120
+ - Added 'values' as an optional parameter
121
+ - `gem install mixpanel_client --pre`
122
+
123
+ ## 1.0.1
124
+
125
+ - Minor housekeeping and organizing
126
+ - Refactored specs
90
127
 
91
- ### v1.0.1
92
- * Minor housekeeping and organizing
93
- * Refactored specs
128
+ ## 1.0.0
94
129
 
95
- ### v1.0.0
96
- * Changed "Mixpanel" class name to "MixpanelClient" to prevent naming collision in other
130
+ - Changed "Mixpanel" class name to "MixpanelClient" to prevent naming collision in other
97
131
  libraries. [a710a84e8ba4b6f018b7](https://github.com/keolo/mixpanel_client/commit/a710a84e8ba4b6f018b7404ab9fabc8f08b4a4f3)
data/development.md ADDED
@@ -0,0 +1,13 @@
1
+ # Development
2
+
3
+ - `cd` to a working directory for this project
4
+ - `git clone [REPOSITORY URL]`
5
+ - Install dependencies with `bundle install`
6
+ - Try `rake -T` to see available commands
7
+ - Try `rake spec` to run the unit tests
8
+ - Make code and test changes
9
+ - Verify code quality using `rubocop`
10
+ - Verify specs pass
11
+ - Run manual tests `lib/mixpanel/manual_test/basic.rb`
12
+ - Run `rake build` to build the gem into the pkg directory
13
+ - Run `rake release[remote]` to build and release to rubygems
@@ -14,7 +14,7 @@ module Mixpanel
14
14
  IMPORT_URI = 'https://api.mixpanel.com'.freeze
15
15
 
16
16
  attr_reader :uri
17
- attr_accessor :api_secret, :parallel, :timeout
17
+ attr_accessor :api_secret, :timeout
18
18
 
19
19
  def self.base_uri_for_resource(resource)
20
20
  if resource == 'export'
@@ -35,7 +35,6 @@ module Mixpanel
35
35
  # @param [Hash] config consisting of an 'api_secret' and additonal options
36
36
  def initialize(config)
37
37
  @api_secret = config[:api_secret]
38
- @parallel = config[:parallel] || false
39
38
  @timeout = config[:timeout] || nil
40
39
 
41
40
  raise ConfigurationError, 'api_secret is required' if @api_secret.nil?
@@ -62,17 +61,7 @@ module Mixpanel
62
61
  # @return [JSON, String] mixpanel response as a JSON object or CSV string
63
62
  def request(resource, options)
64
63
  @uri = request_uri(resource, options)
65
- @parallel ? make_parallel_request : make_normal_request(resource)
66
- end
67
-
68
- def make_parallel_request
69
- require 'typhoeus'
70
- parallel_request = prepare_parallel_request
71
- hydra.queue parallel_request
72
- parallel_request
73
- end
74
64
 
75
- def make_normal_request(resource)
76
65
  response = URI.get(@uri, @timeout, @api_secret)
77
66
 
78
67
  if %w(export import).include?(resource) && @format != 'raw'
@@ -106,43 +95,6 @@ module Mixpanel
106
95
  URI.mixpanel(resource, normalize_options(options))
107
96
  end
108
97
 
109
- # TODO: Extract and refactor
110
- # rubocop:disable MethodLength
111
- def prepare_parallel_request
112
- request = ::Typhoeus::Request.new(@uri, userpwd: "#{@api_secret}:")
113
-
114
- request.on_complete do |response|
115
- if response.success?
116
- Utils.to_hash(response.body, @format)
117
- elsif response.timed_out?
118
- raise TimeoutError
119
- elsif response.code == 0
120
- # Could not get an http response, something's wrong
121
- raise HTTPError, response.curl_error_message
122
- else
123
- # Received a non-successful http response
124
- error_message = if response.body && response.body != ''
125
- JSON.parse(response.body)['error']
126
- else
127
- response.code.to_s
128
- end
129
-
130
- raise HTTPError, error_message
131
- end
132
- end
133
-
134
- request
135
- end
136
- # rubocop:enable MethodLength
137
-
138
- def run_parallel_requests
139
- hydra.run
140
- end
141
-
142
- def hydra
143
- @hydra ||= ::Typhoeus::Hydra.new
144
- end
145
-
146
98
  private
147
99
 
148
100
  # Return a hash of options along with defaults and a generated signature
@@ -16,19 +16,6 @@ module Mixpanel
16
16
  # Copyright (c) 2009+ Keolo Keagy
17
17
  # See LICENSE for details
18
18
  module Utils
19
- # Return a string composed of hashed values specified by the mixpanel
20
- # data API
21
- #
22
- # @return [String] md5 hash signature required by mixpanel data API
23
- def self.generate_signature(args, api_secret)
24
- Digest::MD5.hexdigest(
25
- args.map { |key, val| "#{key}=#{val}" }
26
- .sort
27
- .join +
28
- api_secret
29
- )
30
- end
31
-
32
19
  # Return a JSON object or a string depending on a given format
33
20
  #
34
21
  # @param [String] data either CSV or JSON formatted
@@ -10,6 +10,6 @@ module Mixpanel
10
10
  # Return metrics from Mixpanel Data API
11
11
  class Client
12
12
  # Mixpanel::Client library version
13
- VERSION = '4.1.6'.freeze
13
+ VERSION = '5.0.0'.freeze
14
14
  end
15
15
  end
@@ -19,14 +19,13 @@ Gem::Specification.new do |s|
19
19
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ['lib']
22
- s.add_runtime_dependency('typhoeus')
23
- s.add_development_dependency('bundler', '>=1.5.3')
24
- s.add_development_dependency('rake', '>=10.1.1')
25
- s.add_development_dependency('rdoc', '>=4.1.1')
26
- s.add_development_dependency('rspec', '>=2.5.0')
27
- s.add_development_dependency('webmock', '>=1.17.4')
28
- s.add_development_dependency('pry', '>=0.9.12.6')
29
- s.add_development_dependency('pry-byebug', '>=1.3.2') if RUBY_VERSION >= '2.0'
30
- s.add_development_dependency('pry-stack_explorer', '>=0.4.9')
31
- s.add_development_dependency('rubocop', '>=0.19.0')
22
+ s.add_development_dependency('bundler', '~>2.4')
23
+ s.add_development_dependency('rake', '~>13.0')
24
+ s.add_development_dependency('rdoc', '~>6.5')
25
+ s.add_development_dependency('rspec', '~>3.12')
26
+ s.add_development_dependency('webmock', '~>3.18')
27
+ s.add_development_dependency('pry', '~>0.14')
28
+ s.add_development_dependency('pry-byebug', '~>3.10')
29
+ s.add_development_dependency('pry-stack_explorer', '~>0.6')
30
+ s.add_development_dependency('rubocop', '~>1.41')
32
31
  end
data/readme.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/mixpanel_client.svg)](http://badge.fury.io/rb/mixpanel_client)
4
4
  [![Code Climate](https://codeclimate.com/github/keolo/mixpanel_client/badges/gpa.svg)](https://codeclimate.com/github/keolo/mixpanel_client)
5
- [ ![Codeship Status for keolo/mixpanel_client](https://codeship.com/projects/4d247060-1ad9-0134-e1c3-0e8ad2af7d49/status?branch=master)](https://codeship.com/projects/159479)
6
5
 
7
6
  Ruby access to the [Mixpanel](http://mixpanel.com/) web analytics tool.
8
7
 
@@ -23,80 +22,61 @@ or if you use a Gemfile
23
22
 
24
23
  client = Mixpanel::Client.new(
25
24
  api_secret: 'changeme'
25
+ timeout: 240 # Default is 60 seconds, increase if you get frequent Net::ReadTimeout errors.
26
26
  )
27
27
 
28
28
  data = client.request(
29
29
  'events/properties',
30
- event: 'splash features',
31
- name: 'feature',
32
- values: '["uno", "dos"]',
30
+ event: 'Product Clicked',
31
+ name: 'product-clicked',
32
+ values: '["value1", "value2"]',
33
33
  type: 'unique',
34
34
  unit: 'day',
35
- from_date: '2013-12-1',
36
- to_date: '2014-3-1',
37
- limit: 5
35
+ limit: 5,
36
+ from_date: '2013-12-1', #<- Date range
37
+ to_date: '2014-3-1' #<-
38
38
  )
39
39
 
40
- puts data.inspect
40
+ The API also supports passing a time interval rather than an explicit date range.
41
41
 
42
- # The API also supports passing a time interval rather than an explicit date range
43
42
  data = client.request(
44
43
  'events/properties',
45
- event: 'splash features',
46
- name: 'feature',
47
- values: '["uno", "dos"]',
44
+ event: 'Product Clicked',
45
+ name: 'product-clicked',
46
+ values: '["value1", "value2"]',
48
47
  type: 'unique',
49
48
  unit: 'day',
50
- interval: 7,
51
- limit: 5
49
+ limit: 5,
50
+ interval: 7 #<- Interval
52
51
  )
53
52
 
54
- # Use the import API, which allows one to specify a time in the past, unlike the track API.
55
- # note that you need to include your api token in the data. More details at:
56
- # https://mixpanel.com/docs/api-documentation/importing-events-older-than-31-days
57
- data_to_import = {'event' => 'firstLogin', 'properties' => {'distinct_id' => guid, 'time' => time_as_integer_seconds_since_epoch, 'token' => api_token}}
58
- require 'base64' # co-located with the Base64 call below for clarity
59
- encoded_data = Base64.encode64(data_to_import.to_json)
60
- data = client.request('import', {:data => encoded_data, :api_key => api_key})
61
- # data == [1] # => true # you can only import one event at a time
62
-
63
- ## Parallel
53
+ Use the Import API to specify a time in the past. You'll need to include your
54
+ API token in the data ([docs](https://mixpanel.com/docs/api-documentation/importing-events-older-than-31-days.)).
64
55
 
65
- You may also make requests in parallel by passing in the `parallel: true` option.
66
-
67
- require 'rubygems'
68
- require 'mixpanel_client'
69
-
70
- client = Mixpanel::Client.new(
71
- api_secret: 'changeme',
72
- parallel: true
73
- )
74
-
75
- first_request = client.request(
76
- 'events/properties',
77
- ...
78
- )
56
+ To import, encode the data as JSON and use Base64. Encode the data like this:
79
57
 
80
- second_request = client.request(
81
- 'events/properties',
82
- ...
83
- )
58
+ data_to_import = {
59
+ 'event' => 'firstLogin',
60
+ 'properties' => {
61
+ 'distinct_id' => guid,
62
+ 'time' => time_as_integer_seconds_since_epoch,
63
+ 'token' => api_token
64
+ }
65
+ }
66
+ encoded_data = Base64.encode64(data_to_import.to_json)
84
67
 
85
- third_request = client.request(
86
- 'events/properties',
87
- ...
88
- )
68
+ Then make a request to the API with the given API key, passing in the encoded data:
89
69
 
90
- ...
70
+ data = client.request('import', {:data => encoded_data, :api_key => api_key})
91
71
 
92
- client.run_parallel_requests
72
+ You can only import one event at a time.
93
73
 
94
- puts first_request.response.handled_response
95
- puts second_request.response.handled_response
96
- puts third_request.response.handled_response
74
+ ## Parallel
97
75
 
76
+ The option to make parallel requests has been removed (in v5) so that there are no runtime dependencies.
98
77
 
99
78
  ## Development
79
+
100
80
  List of rake tasks.
101
81
 
102
82
  rake -T
@@ -115,14 +95,13 @@ Run rubocop and fix offences.
115
95
 
116
96
  rubocop
117
97
 
118
-
119
98
  ## Changelog
120
- [Changelog](changelog.md)
121
99
 
100
+ [Changelog](changelog.md)
122
101
 
123
102
  ## Collaborators and Maintainers
124
- [Contributors](https://github.com/keolo/mixpanel_client/graphs/contributors)
125
103
 
104
+ [Contributors](https://github.com/keolo/mixpanel_client/graphs/contributors)
126
105
 
127
106
  ## Copyright
128
107
 
@@ -10,19 +10,6 @@ describe Mixpanel::Client do
10
10
  end
11
11
 
12
12
  context 'when initializing a new Mixpanel::Client' do
13
- it 'should set a parallel option as false by default' do
14
- expect(Mixpanel::Client.new(
15
- api_secret: 'test_secret'
16
- ).parallel).to eq(false)
17
- end
18
-
19
- it 'should be able to set a parallel option when passed' do
20
- expect(Mixpanel::Client.new(
21
- api_secret: 'test_secret',
22
- parallel: true
23
- ).parallel).to eq(true)
24
- end
25
-
26
13
  it 'should set a timeout option as nil by default' do
27
14
  expect(Mixpanel::Client.new(
28
15
  api_secret: 'test_secret'
@@ -54,7 +41,7 @@ describe Mixpanel::Client do
54
41
  body: '{"legend_size": 0, "data": {"series": [], "values": {}}}'
55
42
  )
56
43
 
57
- data = lambda do
44
+ expect {
58
45
  @client.request(
59
46
  nil,
60
47
  :events,
@@ -62,9 +49,7 @@ describe Mixpanel::Client do
62
49
  unit: 'hour',
63
50
  interval: 24
64
51
  )
65
- end
66
-
67
- expect(data).to raise_error(ArgumentError)
52
+ }.to raise_error(ArgumentError)
68
53
  end
69
54
  end
70
55
 
@@ -138,147 +123,6 @@ describe Mixpanel::Client do
138
123
  @client.request('events/top', options)
139
124
  end.to_not change { options }
140
125
  end
141
-
142
- context 'with parallel option enabled' do
143
- before :all do
144
- @parallel_client = Mixpanel::Client.new(
145
- api_secret: 'test_secret',
146
- parallel: true
147
- )
148
- end
149
-
150
- it 'should return Typhoeus::Request' do
151
- # Stub Mixpanel request
152
- stub_request(:get, /^#{@uri}.*/)
153
- .to_return(
154
- body: '{"legend_size": 0, "data": {"series": [], "values": {}}}'
155
- )
156
-
157
- # No endpoint
158
- data = @parallel_client.request(
159
- 'events',
160
- event: '["test-event"]',
161
- unit: 'hour',
162
- interval: 24
163
- )
164
-
165
- expect(data).to be_a Typhoeus::Request
166
- end
167
-
168
- describe '#hydra' do
169
- it 'should return a Typhoeus::Hydra object' do
170
- expect(@parallel_client.hydra).to be_a Typhoeus::Hydra
171
- end
172
- end
173
-
174
- describe '#run_parallel_requests' do
175
- it 'should run queued requests' do
176
- # Stub Mixpanel request
177
- stub_request(:any, /^#{@uri}.*/)
178
- .to_return(
179
- body: '{
180
- "legend_size": 1,
181
- "data": {
182
- "series": ["2010-05-29","2010-05-30","2010-05-31"],
183
- "values": {
184
- "account-page": {"2010-05-30": 1},
185
- "splash features": {
186
- "2010-05-29": 6,
187
- "2010-05-30": 4,
188
- "2010-05-31": 5
189
- }
190
- }
191
- }
192
- }'
193
- )
194
-
195
- stub_request(:any, /^#{@uri}.*secondevent.*/)
196
- .to_return(
197
- body: '{
198
- "legend_size": 2,
199
- "data": {
200
- "series": ["2010-05-29","2010-05-30","2010-05-31"],
201
- "values": {
202
- "account-page": {"2010-05-30": 2},
203
- "splash features": {
204
- "2010-05-29": 8,
205
- "2010-05-30": 6,
206
- "2010-05-31": 7
207
- }
208
- }
209
- }
210
- }'
211
- )
212
-
213
- first_request = @parallel_client.request(
214
- 'events',
215
- event: '["firstevent"]',
216
- unit: 'day'
217
- )
218
-
219
- second_request = @parallel_client.request(
220
- 'events',
221
- event: '["secondevent"]',
222
- unit: 'day'
223
- )
224
-
225
- @parallel_client.run_parallel_requests
226
-
227
- expect(first_request.response.handled_response).to eq(
228
- 'data' => {
229
- 'series' => %w(2010-05-29 2010-05-30 2010-05-31),
230
- 'values' => {
231
- 'splash features' => {
232
- '2010-05-29' => 6,
233
- '2010-05-30' => 4,
234
- '2010-05-31' => 5
235
- },
236
- 'account-page' => {
237
- '2010-05-30' => 1
238
- }
239
- }
240
- },
241
- 'legend_size' => 1
242
- )
243
-
244
- expect(second_request.response.handled_response).to eq(
245
- 'data' => {
246
- 'series' => %w(2010-05-29 2010-05-30 2010-05-31),
247
- 'values' => {
248
- 'splash features' => {
249
- '2010-05-29' => 8,
250
- '2010-05-30' => 6,
251
- '2010-05-31' => 7
252
- },
253
- 'account-page' => {
254
- '2010-05-30' => 2
255
- }
256
- }
257
- },
258
- 'legend_size' => 2
259
- )
260
- end
261
- end
262
- end
263
- end
264
-
265
- describe '#hash_args' do
266
- it 'should return a hashed string alpha sorted by key names.' do
267
- args = { c: 'see', a: 'ey', d: 'dee', b: 'bee' }
268
- args_alpha_sorted = { a: 'ey', b: 'bee', c: 'see', d: 'dee' }
269
-
270
- unsorted_signature = Mixpanel::Client::Utils.generate_signature(
271
- args,
272
- @client.api_secret
273
- )
274
-
275
- sorted_signature = Mixpanel::Client::Utils.generate_signature(
276
- args_alpha_sorted,
277
- @client.api_secret
278
- )
279
-
280
- expect(unsorted_signature).to eq sorted_signature
281
- end
282
126
  end
283
127
 
284
128
  describe '#to_hash' do
metadata CHANGED
@@ -1,155 +1,141 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixpanel_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.6
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keolo Keagy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-30 00:00:00.000000000 Z
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: typhoeus
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
- - - ">="
17
+ - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: 1.5.3
19
+ version: '2.4'
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
- - - ">="
24
+ - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: 1.5.3
26
+ version: '2.4'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: rake
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ">="
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
- version: 10.1.1
33
+ version: '13.0'
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ">="
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
- version: 10.1.1
40
+ version: '13.0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: rdoc
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - ">="
45
+ - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 4.1.1
47
+ version: '6.5'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ">="
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 4.1.1
54
+ version: '6.5'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rspec
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ">="
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 2.5.0
61
+ version: '3.12'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ">="
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 2.5.0
68
+ version: '3.12'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: webmock
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ">="
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: 1.17.4
75
+ version: '3.18'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - ">="
80
+ - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: 1.17.4
82
+ version: '3.18'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: pry
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - ">="
87
+ - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: 0.9.12.6
89
+ version: '0.14'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - ">="
94
+ - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: 0.9.12.6
96
+ version: '0.14'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: pry-byebug
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - ">="
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
- version: 1.3.2
103
+ version: '3.10'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - ">="
108
+ - - "~>"
123
109
  - !ruby/object:Gem::Version
124
- version: 1.3.2
110
+ version: '3.10'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: pry-stack_explorer
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - ">="
115
+ - - "~>"
130
116
  - !ruby/object:Gem::Version
131
- version: 0.4.9
117
+ version: '0.6'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
- - - ">="
122
+ - - "~>"
137
123
  - !ruby/object:Gem::Version
138
- version: 0.4.9
124
+ version: '0.6'
139
125
  - !ruby/object:Gem::Dependency
140
126
  name: rubocop
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
- - - ">="
129
+ - - "~>"
144
130
  - !ruby/object:Gem::Version
145
- version: 0.19.0
131
+ version: '1.41'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
- - - ">="
136
+ - - "~>"
151
137
  - !ruby/object:Gem::Version
152
- version: 0.19.0
138
+ version: '1.41'
153
139
  description: Simple ruby client interface to the Mixpanel Data API.
154
140
  email:
155
141
  - keolo@kea.gy
@@ -167,6 +153,7 @@ files:
167
153
  - Rakefile
168
154
  - changelog.md
169
155
  - config/mixpanel.template.yml
156
+ - development.md
170
157
  - lib/mixpanel/client.rb
171
158
  - lib/mixpanel/exceptions.rb
172
159
  - lib/mixpanel/uri.rb
@@ -175,7 +162,6 @@ files:
175
162
  - lib/mixpanel_client.rb
176
163
  - license
177
164
  - manual_test/basic.rb
178
- - manual_test/parallel.rb
179
165
  - mixpanel_client.gemspec
180
166
  - readme.md
181
167
  - spec/mixpanel_client/events_externalspec.rb
@@ -202,14 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
188
  - !ruby/object:Gem::Version
203
189
  version: '0'
204
190
  requirements: []
205
- rubyforge_project: mixpanel_client
206
- rubygems_version: 2.5.1
191
+ rubygems_version: 3.3.26
207
192
  signing_key:
208
193
  specification_version: 4
209
194
  summary: Ruby Mixpanel API Client Library
210
- test_files:
211
- - spec/mixpanel_client/events_externalspec.rb
212
- - spec/mixpanel_client/mixpanel_client_spec.rb
213
- - spec/mixpanel_client/properties_externalspec.rb
214
- - spec/mixpanel_client/uri_spec.rb
215
- - spec/spec_helper.rb
195
+ test_files: []
@@ -1,35 +0,0 @@
1
- $LOAD_PATH.unshift(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'rubygems'
4
- require 'mixpanel_client'
5
- require 'yaml'
6
- require 'typhoeus'
7
-
8
- config = YAML.load_file(
9
- File.join(
10
- File.dirname(__FILE__),
11
- '..',
12
- 'config',
13
- 'mixpanel.yml'
14
- )
15
- )['mixpanel']
16
-
17
- client = Mixpanel::Client.new(
18
- api_secret: config[:api_secret],
19
- parallel: true
20
- )
21
-
22
- uno = client.request(
23
- 'events/top',
24
- type: 'general'
25
- )
26
-
27
- dos = client.request(
28
- 'events/names',
29
- type: 'general'
30
- )
31
-
32
- client.run_parallel_requests
33
-
34
- puts uno.response.handled_response.inspect
35
- puts dos.response.handled_response.inspect