mixpanel-ruby 3.3.0 → 3.5.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
2
  SHA256:
3
- metadata.gz: 1be60e96a1c17bd58aa1e6a1b9c17228a2b4934966c95bd893efa66d6a4a4f54
4
- data.tar.gz: 8081213f4003791117e588c7afa479d249dd79ec219e16f109dda5ef26a0224c
3
+ metadata.gz: b34915624a379f24601a62eab94dc46c75ef297383157081a9e58e7368dbc237
4
+ data.tar.gz: 368e6ff3920627844c1d9df24efab69979444950f4b254f3c161d8123d9b7f91
5
5
  SHA512:
6
- metadata.gz: f11a900846a56ab4d2ff879c23af112a086bee115e0b12aae4f5fb65ba9f37f6bb65959554e48da90d632e2e5a24070ed4e1867ef213db970d990caa2adc25c5
7
- data.tar.gz: c7f2e19753de2dc9d55dcf93a798074ff1dc4cc82a5b2b33ce78dd765a33e98f6fc357d994580b38ac1ea2a92a9b942287f92ed3b34a4262f9bc75f476adc496
6
+ metadata.gz: 59cd675026bc735a00230cfbe42551ebafabfb603b31f2ee5464335a15bdab8710da8d10c9c47ad6fe6f1c522b4847fe8b1cb55b936c3c323ecab865cc248017
7
+ data.tar.gz: 8ff8e085d684765c4e76953663913f467bedf6cd2cba8b640c88860dbaaca7aa1e863720e8f19fa1fbc896fa8a4df45f0979a241e051f0e8941e49a9bef5193f
@@ -104,7 +104,7 @@ jobs:
104
104
  echo "Version confirmed: $FILE_VERSION"
105
105
 
106
106
  - name: Set up Ruby
107
- uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0
107
+ uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
108
108
  with:
109
109
  ruby-version: '3.3'
110
110
  bundler-cache: false
@@ -11,8 +11,11 @@ permissions:
11
11
  jobs:
12
12
  test:
13
13
 
14
- runs-on: ubuntu-latest
14
+ # Pinned to 24.04: ubuntu-latest (26.04) only has prebuilt CRuby >= 3.2,
15
+ # and this matrix still covers 3.0/3.1.
16
+ runs-on: ubuntu-24.04
15
17
  strategy:
18
+ fail-fast: false
16
19
  matrix:
17
20
  ruby-version:
18
21
  - '3.0'
@@ -24,7 +27,7 @@ jobs:
24
27
  steps:
25
28
  - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
26
29
  - name: Set up Ruby
27
- uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0
30
+ uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
28
31
  with:
29
32
  ruby-version: ${{ matrix.ruby-version }}
30
33
  bundler-cache: true # runs 'bundle install' and caches installed gems automatically
@@ -38,8 +41,11 @@ jobs:
38
41
 
39
42
  test-openfeature:
40
43
 
41
- runs-on: ubuntu-latest
44
+ # Pinned to 24.04: ubuntu-latest (26.04) only has prebuilt CRuby >= 3.2,
45
+ # and this matrix still covers 3.1.
46
+ runs-on: ubuntu-24.04
42
47
  strategy:
48
+ fail-fast: false
43
49
  matrix:
44
50
  ruby-version:
45
51
  - '3.1'
@@ -50,7 +56,7 @@ jobs:
50
56
  steps:
51
57
  - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
52
58
  - name: Set up Ruby
53
- uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0
59
+ uses: ruby/setup-ruby@b3aaceaef7e0ee231b499e7b5f49c03fc1d32199 # v1.338.0
54
60
  with:
55
61
  ruby-version: ${{ matrix.ruby-version }}
56
62
  - name: Install dependencies
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.5.0](https://github.com/mixpanel/mixpanel-ruby/tree/v3.5.0) (2026-11-23)
4
+
5
+ ### Features
6
+ - tag OpenFeature exposures with $openfeature_provider (SDK-448) ([#181](https://github.com/mixpanel/mixpanel-ruby/pull/181))
7
+
8
+ ### Fixes
9
+ - surface failed imports instead of failing silently (SDK-395) ([#177](https://github.com/mixpanel/mixpanel-ruby/pull/177))
10
+ - bump json-logic-rb minimum to 0.3 ([#175](https://github.com/mixpanel/mixpanel-ruby/pull/175))
11
+
12
+ ### Chores
13
+ - explain which credential import needs (SDK-388) ([#179](https://github.com/mixpanel/mixpanel-ruby/pull/179))
14
+
15
+ [Full Changelog](https://github.com/mixpanel/mixpanel-ruby/compare/v3.4.0...v3.5.0)
16
+
17
+ ## [v3.4.0](https://github.com/mixpanel/mixpanel-ruby/tree/v3.4.0) (2026-09-01)
18
+
19
+ ### Features
20
+ - Implement semver and date custom ops for flags runtime props ([#171](https://github.com/mixpanel/mixpanel-ruby/pull/171))
21
+
22
+ [Full Changelog](https://github.com/mixpanel/mixpanel-ruby/compare/v3.3.0...v3.4.0)
23
+
3
24
  ## [v3.3.0](https://github.com/mixpanel/mixpanel-ruby/tree/v3.3.0) (2026-07-24)
4
25
 
5
26
  ### Fixes
data/Readme.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = mixpanel-ruby: The official Mixpanel Ruby library
2
2
 
3
- ##### _July 24, 2026_ - [v3.3.0](https://github.com/mixpanel/mixpanel-ruby/releases/tag/v3.3.0)
3
+ ##### _November 23, 2026_ - [v3.5.0](https://github.com/mixpanel/mixpanel-ruby/releases/tag/v3.5.0)
4
4
 
5
5
  mixpanel-ruby is a library for tracking events and sending \Mixpanel profile
6
6
  updates to \Mixpanel from your ruby applications.
@@ -34,6 +34,23 @@ right away.
34
34
  Service accounts provide secure server-to-server authentication and are recommended over
35
35
  API keys for import operations and feature flags.
36
36
 
37
+ === Which credential do I need?
38
+
39
+ \Mixpanel uses different credentials for different calls, and they are not interchangeable:
40
+
41
+ [Project token]
42
+ Passed to Mixpanel::Tracker.new and used for track, people and groups calls. It is
43
+ public (it ships in client-side code) and does not authenticate import.
44
+ [Service account username and secret, plus project ID]
45
+ Required for import_events (and import without an API key). Create a service account in your \Mixpanel
46
+ organization settings
47
+ (see https://docs.mixpanel.com/docs/orgs-and-projects/service-accounts), then pass it
48
+ to Mixpanel::Tracker.new as a Mixpanel::ServiceAccountCredentials. The project ID is
49
+ shown in your project settings.
50
+ [API key]
51
+ The legacy credential taken by <tt>import("API_KEY", ...)</tt>. It is not your project
52
+ token. See "Import with API Key (deprecated)" below.
53
+
37
54
  === Import with Service Account (Recommended)
38
55
 
39
56
  require 'mixpanel-ruby'
@@ -61,14 +78,28 @@ API keys for import operations and feature flags.
61
78
  'Source' => 'Import'
62
79
  })
63
80
 
64
- === Import with API Key (Legacy)
81
+ import_events returns true when the request completed without a \Mixpanel error, and false
82
+ when a Mixpanel::MixpanelError was raised. With a custom consumer block, such as a queue, true
83
+ only means the handoff to that block succeeded. A false result does not always mean the event
84
+ was lost: after a timeout, \Mixpanel may still have stored it, so set a unique
85
+ <tt>$insert_id</tt> property if you retry, and \Mixpanel will drop the duplicate.
65
86
 
66
- # Legacy approach with API key string
67
- tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN)
68
- tracker.import("API_KEY", 'User1', 'Past Event', {
69
- 'time' => 1369353600,
70
- 'Source' => 'Import'
71
- })
87
+ With the default error handler, a failed import also prints a warning to stderr. To handle
88
+ failures yourself, for example to retry or alert, pass a Mixpanel::ErrorHandler subclass:
89
+
90
+ class ImportErrorHandler < Mixpanel::ErrorHandler
91
+ def handle(error)
92
+ Rails.logger.error("Mixpanel import failed: #{error.message}")
93
+ end
94
+ end
95
+
96
+ tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN, ImportErrorHandler.new, credentials: credentials)
97
+
98
+ === Import with API Key (deprecated)
99
+
100
+ Passing an API key as the first argument to import, as in
101
+ <tt>tracker.import("API_KEY", ...)</tt>, is deprecated, and \Mixpanel's /import endpoint
102
+ may reject these requests. Use service account credentials with import_events, as shown above.
72
103
 
73
104
  === Feature Flags with Service Account
74
105
 
@@ -107,7 +107,7 @@ module Mixpanel
107
107
  def import(api_key, distinct_id, event, properties={}, ip=nil)
108
108
  # Warn about deprecated API key usage
109
109
  if api_key && !api_key.to_s.empty?
110
- warn '[DEPRECATION] Passing api_key to import() is deprecated. Use ServiceAccountCredentials in the constructor instead. See https://docs.mixpanel.com/docs/tracking-methods/sdks/ruby#service-account-authentication'
110
+ warn '[DEPRECATION] Passing api_key to import() is deprecated and may be rejected by Mixpanel\'s /import endpoint. Use ServiceAccountCredentials in the constructor with import_events() instead. See https://docs.mixpanel.com/docs/tracking-methods/sdks/ruby#service-account-authentication'
111
111
  end
112
112
 
113
113
  # Warn when using import(nil, ...) - recommend import_events instead
@@ -181,6 +181,21 @@ module Mixpanel
181
181
  begin
182
182
  @sink.call(:import, message.to_json)
183
183
  rescue MixpanelError => e
184
+ # The default ErrorHandler silences all errors, which makes a rejected
185
+ # import (for example a 401 from bad credentials) indistinguishable from
186
+ # a successful one unless the caller checks the return value. Print the
187
+ # first failure per tracker to stderr when no custom handler is configured
188
+ # (once only, so a failing backfill doesn't flood stderr).
189
+ if @error_handler.instance_of?(ErrorHandler) && !@import_failure_warned
190
+ @import_failure_warned = true
191
+ # The outcome is not always known: a read timeout, a 5xx, or an unreadable
192
+ # 200 response can all follow a successful write. Don't claim the event was
193
+ # rejected; the message carries the status and server reply when there is one.
194
+ detail = e.message.to_s.gsub(/\s+/, ' ').strip[0, 200].chomp('.')
195
+ warn "[Mixpanel] import failed; the event may not have been stored: #{detail}. " \
196
+ 'Further import failures will not be printed. ' \
197
+ 'Pass a Mixpanel::ErrorHandler to Tracker.new to handle import errors yourself.'
198
+ end
184
199
  @error_handler.handle(e)
185
200
  ret = false
186
201
  end
@@ -0,0 +1,207 @@
1
+ require 'date'
2
+ require 'time'
3
+ require 'json_logic'
4
+
5
+ module Mixpanel
6
+ module Flags
7
+ module CustomOperators
8
+ # Using the official semantic versioning 2.0.0 regular expression to handle cross-platform validation
9
+ # differences on other SDK's. For example, some platforms allow leading zeros even though it is not valid
10
+ # as part of the Semver 2.0.0 spec. See https://semver.org/
11
+ SEMVER_STRICT = /\A(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?\z/
12
+
13
+ # Strict RFC3339 guard for datetime strings. The date and hour fields are captured so the
14
+ # calendar can be validated separately; the pattern only constrains their shape.
15
+ RFC3339_STRICT = /\A(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})\z/
16
+
17
+ # SemVer 2.0.0 requires major.minor.patch; partial versions are zero-padded to this.
18
+ SEMVER_PARTS = 3
19
+
20
+ # Longest operand the semver regex is allowed to see. A real version never approaches this; the
21
+ # bound matches MAX_LENGTH in node-semver, and keeps an arbitrarily long property value off the
22
+ # regex regardless of how the engine schedules backtracking.
23
+ MAX_SEMVER_LENGTH = 256
24
+
25
+ # Epoch milliseconds are compared as int64 elsewhere, so anything at or beyond this is out of range.
26
+ MAX_EPOCH_MS = 2**63
27
+
28
+ module_function
29
+
30
+ # Implements a custom operation for semantic versioning comparison that conforms to the
31
+ # semver 2.0.0 standard. Prior to comparison, any leading version prefix is stripped.
32
+ def semver_compare(values)
33
+ unpacked = operands(values)
34
+ return false unless unpacked
35
+
36
+ actual, symbol, target = unpacked
37
+ return false unless actual.is_a?(String) && target.is_a?(String)
38
+ return false if actual.length > MAX_SEMVER_LENGTH || target.length > MAX_SEMVER_LENGTH
39
+
40
+ actual_version = normalize_semver(actual)
41
+ target_version = normalize_semver(target)
42
+ return false unless actual_version.match?(SEMVER_STRICT) && target_version.match?(SEMVER_STRICT)
43
+
44
+ cmp = compare_semver(actual_version, target_version)
45
+ comparator_matches?(cmp, symbol)
46
+ end
47
+
48
+ # Strip optional build metadata and separate the core version from pre-release identifiers
49
+ def split_semver(version)
50
+ plus = version.index('+')
51
+ version = version[0, plus] if plus
52
+ dash = version.index('-')
53
+ return [version.split('.'), []] unless dash
54
+
55
+ [version[0, dash].split('.'), version[(dash + 1)..-1].split('.')]
56
+ end
57
+
58
+ def numeric_identifier?(identifier)
59
+ identifier.match?(/\A[0-9]+\z/)
60
+ end
61
+
62
+ # Numeric identifiers carry no leading zeros, so the longer run of digits is the larger number.
63
+ # Comparing them as digits rather than parsing to a fixed-width integer keeps versions that
64
+ # overflow a 64-bit integer ordered correctly.
65
+ def compare_numeric(a, b)
66
+ return a.length <=> b.length unless a.length == b.length
67
+
68
+ a <=> b
69
+ end
70
+
71
+ # SemVer 2.0.0 section 11.4: digits compare numerically, a numeric identifier ranks below an
72
+ # alphanumeric one, and anything else compares by ASCII order.
73
+ def compare_prerelease_identifier(a, b)
74
+ a_numeric = numeric_identifier?(a)
75
+ b_numeric = numeric_identifier?(b)
76
+ return compare_numeric(a, b) if a_numeric && b_numeric
77
+ return -1 if a_numeric
78
+ return 1 if b_numeric
79
+
80
+ a <=> b
81
+ end
82
+
83
+ # Ordering per SemVer 2.0.0 section 11. Both operands have already been normalized and matched
84
+ # against the official regex, so the core holds exactly three numeric identifiers and every
85
+ # prerelease field is well-formed; the split needs no error path.
86
+ def compare_semver(actual, target)
87
+ actual_core, actual_prerelease = split_semver(actual)
88
+ target_core, target_prerelease = split_semver(target)
89
+
90
+ actual_core.each_with_index do |part, index|
91
+ result = compare_numeric(part, target_core[index])
92
+ return result unless result.zero?
93
+ end
94
+
95
+ # A prerelease ranks below the release it belongs to (section 11.3).
96
+ return 0 if actual_prerelease.empty? && target_prerelease.empty?
97
+ return 1 if actual_prerelease.empty?
98
+ return -1 if target_prerelease.empty?
99
+
100
+ [actual_prerelease.length, target_prerelease.length].min.times do |index|
101
+ result = compare_prerelease_identifier(actual_prerelease[index], target_prerelease[index])
102
+ return result unless result.zero?
103
+ end
104
+ # Every field so far is equal, so the longer list wins (section 11.4.4).
105
+ actual_prerelease.length <=> target_prerelease.length
106
+ end
107
+
108
+ # Implements a custom operation for datetime comparison. The target value stored on the
109
+ # feature flag is the millisecond epoch, whereas the actual value provided at evaluation
110
+ # time must be RFC-3339 formatted.
111
+ def datetime_compare(values)
112
+ unpacked = operands(values)
113
+ return false unless unpacked
114
+
115
+ actual, symbol, target = unpacked
116
+ actual_sec = convert_rfc3339_to_unix_seconds(actual)
117
+ target_sec = convert_unix_milliseconds_to_seconds(target)
118
+ return false unless actual_sec && target_sec
119
+
120
+ cmp = actual_sec - target_sec
121
+ comparator_matches?(cmp, symbol)
122
+ end
123
+
124
+ def operands(values)
125
+ return nil unless values.length == 3
126
+
127
+ actual, symbol, target = values
128
+ return nil unless symbol.is_a?(String)
129
+
130
+ [actual, symbol, target]
131
+ end
132
+
133
+ def comparator_matches?(cmp, symbol)
134
+ case symbol
135
+ when '===' then cmp.zero?
136
+ when '!==' then !cmp.zero?
137
+ when '<' then cmp < 0
138
+ when '<=' then cmp <= 0
139
+ when '>' then cmp > 0
140
+ when '>=' then cmp >= 0
141
+ else false
142
+ end
143
+ end
144
+
145
+ def normalize_semver(str)
146
+ stripped = str.strip
147
+ stripped = stripped[1..] if stripped =~ /\Av/i
148
+
149
+ suffix_start = stripped.length
150
+ ['-', '+'].each do |separator|
151
+ index = stripped.index(separator)
152
+ suffix_start = index if index && index < suffix_start
153
+ end
154
+
155
+ core = stripped[0, suffix_start]
156
+ suffix = stripped[suffix_start..] || ''
157
+
158
+ # split(-1) keeps trailing empty fields, so "1." and "1.2.3." stay malformed instead of
159
+ # silently padding to a valid version. Returning the input unchanged lets the validator reject it.
160
+ segments = core.split('.', -1)
161
+ return stripped unless segments.length.between?(1, SEMVER_PARTS) && segments.all? { |seg| seg.match?(/\A\d+\z/) }
162
+
163
+ segments += ['0'] * (SEMVER_PARTS - segments.length)
164
+ segments.join('.') + suffix
165
+ end
166
+
167
+ # The pattern constrains each field to two digits, which still admits a date that cannot exist,
168
+ # such as 2026-02-30 or 29 February in a common year. Time.iso8601 rolls those forward into a
169
+ # real instant instead of raising, and hour 24 likewise becomes the following midnight, so the
170
+ # calendar is checked here. RFC 3339 section 5.6 allows hours 00 through 23.
171
+ def real_calendar_date?(year, month, day, hour)
172
+ hour <= 23 && Date.valid_date?(year, month, day)
173
+ end
174
+
175
+ def convert_rfc3339_to_unix_seconds(value)
176
+ return nil unless value.is_a?(String)
177
+
178
+ normalized = value.strip.upcase
179
+ fields = RFC3339_STRICT.match(normalized)
180
+ return nil unless fields
181
+ return nil unless real_calendar_date?(fields[1].to_i, fields[2].to_i, fields[3].to_i, fields[4].to_i)
182
+
183
+ parsed = Time.iso8601(normalized)
184
+ parsed.to_i
185
+ rescue ArgumentError
186
+ nil
187
+ end
188
+
189
+ def convert_unix_milliseconds_to_seconds(value)
190
+ return nil unless value.is_a?(Numeric)
191
+ # A value int64 cannot represent is not a real timestamp; treating one as a bound would let a
192
+ # nonsense target define a rollout window. NaN fails this comparison too.
193
+ return nil unless value.abs < MAX_EPOCH_MS
194
+
195
+ value.to_i.fdiv(1000).truncate
196
+ end
197
+ end
198
+ end
199
+ end
200
+
201
+ JsonLogic.add_operation('semver_compare') do |values, _data|
202
+ Mixpanel::Flags::CustomOperators.semver_compare(values)
203
+ end
204
+
205
+ JsonLogic.add_operation('datetime_compare') do |values, _data|
206
+ Mixpanel::Flags::CustomOperators.datetime_compare(values)
207
+ end
@@ -126,6 +126,11 @@ module Mixpanel
126
126
  properties['$experiment_id'] = selected_variant.experiment_id if selected_variant.experiment_id
127
127
  properties['$is_experiment_active'] = selected_variant.is_experiment_active unless selected_variant.is_experiment_active.nil?
128
128
  properties['$is_qa_tester'] = selected_variant.is_qa_tester unless selected_variant.is_qa_tester.nil?
129
+ # SDK-448: the OpenFeature provider marks its evaluation context so
130
+ # exposures it triggers can be told apart from direct SDK calls.
131
+ if context['$openfeature_provider'] == true || context[:'$openfeature_provider'] == true
132
+ properties['$openfeature_provider'] = true
133
+ end
129
134
 
130
135
  dispatch_exposure(distinct_id, properties)
131
136
  end
@@ -1,6 +1,7 @@
1
1
  require 'thread'
2
2
  require 'json_logic'
3
3
  require 'mixpanel-ruby/flags/flags_provider'
4
+ require 'mixpanel-ruby/flags/custom_operators'
4
5
 
5
6
  module Mixpanel
6
7
  module Flags
@@ -377,7 +378,10 @@ module Mixpanel
377
378
  begin
378
379
  rule = lowercase_only_leaf_nodes(runtime_rule)
379
380
  result = JsonLogic.apply(rule, parameters)
380
- !!result
381
+ # A well-formed runtime rule evaluates to a boolean. Anything else —
382
+ # notably an unrecognized operator, which the engine echoes back as a
383
+ # (truthy) hash rather than raising — fails closed.
384
+ result == true
381
385
  rescue StandardError => e
382
386
  @error_handler.handle(e) if @error_handler
383
387
  false
@@ -127,21 +127,25 @@ module Mixpanel
127
127
  # as a Hash with string keys and strings, numbers or booleans as
128
128
  # values.
129
129
  #
130
- # tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN)
131
- #
132
- # # Using deprecated API key (still supported)
133
- # tracker.import("API_KEY", "12345", "Credit Card Declined", {
134
- # 'time' => 1310111365
135
- # })
130
+ # Prefer #import_events, which takes the same arguments without the
131
+ # leading api_key. Import is authenticated with service account
132
+ # credentials passed to the constructor; the project token alone is
133
+ # not enough.
136
134
  #
137
135
  # # Using service account credentials (recommended)
138
136
  # credentials = Mixpanel::ServiceAccountCredentials.new(username, secret, project_id)
139
137
  # tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN, credentials: credentials)
140
- # tracker.import(nil, "12345", "Welcome Email Sent", {
138
+ # tracker.import_events("12345", "Welcome Email Sent", {
141
139
  # 'Email Template' => 'Pretty Pink Welcome',
142
140
  # 'User Sign-up Cohort' => 'July 2013',
143
141
  # 'time' => 1310111365
144
142
  # })
143
+ #
144
+ # # Deprecated: legacy API key (not your project token). Avoid in new code.
145
+ # tracker = Mixpanel::Tracker.new(YOUR_MIXPANEL_TOKEN)
146
+ # tracker.import("API_KEY", "12345", "Credit Card Declined", {
147
+ # 'time' => 1310111365
148
+ # })
145
149
  def import(api_key, distinct_id, event, properties={}, ip=nil)
146
150
  # This is here strictly to allow rdoc to include the relevant
147
151
  # documentation
@@ -1,3 +1,3 @@
1
1
  module Mixpanel
2
- VERSION = '3.3.0'
2
+ VERSION = '3.5.0'
3
3
  end
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |spec|
15
15
  spec.required_ruby_version = '>= 3.0.0'
16
16
  spec.add_runtime_dependency 'mutex_m'
17
17
  spec.add_runtime_dependency "base64"
18
- spec.add_runtime_dependency 'json-logic-rb', '~> 0.1.5'
18
+ spec.add_runtime_dependency 'json-logic-rb', '~> 0.3'
19
19
 
20
20
  spec.add_development_dependency 'activesupport', '~> 4.0'
21
21
  spec.add_development_dependency 'rake', '~> 13'
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [openfeature/v0.2.0](https://github.com/mixpanel/mixpanel-ruby/tree/openfeature/v0.2.0) (2026-07-28)
4
+
5
+ ### Features
6
+ - add service account support ([#152](https://github.com/mixpanel/mixpanel-ruby/pull/152))
7
+
8
+ ### Chores
9
+ - pin mixpanel-ruby ~> 3.3 for fallback_reason (SDK-126) ([#166](https://github.com/mixpanel/mixpanel-ruby/pull/166))
10
+
11
+ [Full Changelog](https://github.com/mixpanel/mixpanel-ruby/compare/openfeature/v0.1.0...openfeature/v0.2.0)
12
+
3
13
  ## [openfeature/v0.1.0](https://github.com/mixpanel/mixpanel-ruby/tree/openfeature/v0.1.0) (2026-05-13)
4
14
 
5
15
  Initial release of the Mixpanel OpenFeature provider for Ruby.
@@ -1,6 +1,6 @@
1
1
  # mixpanel-ruby-openfeature
2
2
 
3
- ##### _May 13, 2026_ - [openfeature/v0.1.0](https://github.com/mixpanel/mixpanel-ruby/releases/tag/openfeature/v0.1.0)
3
+ ##### _July 28, 2026_ - [openfeature/v0.2.0](https://github.com/mixpanel/mixpanel-ruby/releases/tag/openfeature/v0.2.0)
4
4
 
5
5
  [![Gem Version](https://img.shields.io/gem/v/mixpanel-ruby-openfeature.svg)](https://rubygems.org/gems/mixpanel-ruby-openfeature)
6
6
  [![OpenFeature](https://img.shields.io/badge/OpenFeature-compatible-green)](https://openfeature.dev/)
@@ -150,15 +150,19 @@ module Mixpanel
150
150
  end
151
151
 
152
152
  def build_context(evaluation_context)
153
- return {} if evaluation_context.nil?
154
-
155
153
  ctx = {}
156
- if evaluation_context.respond_to?(:fields)
157
- evaluation_context.fields.each { |k, v| ctx[k] = unwrap_value(v) }
158
- end
159
- if evaluation_context.respond_to?(:targeting_key) && evaluation_context.targeting_key
160
- ctx['targetingKey'] = unwrap_value(evaluation_context.targeting_key)
154
+ unless evaluation_context.nil?
155
+ if evaluation_context.respond_to?(:fields)
156
+ evaluation_context.fields.each { |k, v| ctx[k] = unwrap_value(v) }
157
+ end
158
+ if evaluation_context.respond_to?(:targeting_key) && evaluation_context.targeting_key
159
+ ctx['targetingKey'] = unwrap_value(evaluation_context.targeting_key)
160
+ end
161
161
  end
162
+ # SDK-448: marks exposures as coming from the OpenFeature provider. The
163
+ # SDK copies this onto `$experiment_started`; older SDKs ignore the key.
164
+ # Set last so a customer attribute of the same name can't override it.
165
+ ctx['$openfeature_provider'] = true
162
166
  ctx
163
167
  end
164
168
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mixpanel
4
4
  module OpenFeature
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ['lib']
18
18
 
19
19
  spec.add_runtime_dependency 'openfeature-sdk', '~> 0.5'
20
- spec.add_runtime_dependency 'mixpanel-ruby', '~> 3.1'
20
+ spec.add_runtime_dependency 'mixpanel-ruby', '~> 3.3'
21
21
 
22
22
  spec.add_development_dependency 'rspec', '~> 3.0'
23
23
  spec.add_development_dependency 'simplecov'