posthog-ruby 3.23.2 → 3.23.4

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: 837e66cdc96fecb0cb9edf1e2785e79da6eb1bb8fff2d57a8f2e3ccef18e66d8
4
- data.tar.gz: 658ed31c4f81fa722aa2b3e43a583e6d3c17684613dff68a88bc4100eb332837
3
+ metadata.gz: 91b19159933c38b73ae683c8dba00e8e2fc95b3e4281e641146c39626e91a707
4
+ data.tar.gz: ea448084b789cd156c77eed66404eac45ccd88fc003cffeb9f3ceddca7def548
5
5
  SHA512:
6
- metadata.gz: d14b85e59194400fc9567b0465d231e08b508bb47f0b57e0bbe3e849359f0b902031ebafa7efa4cf87aa64ed87205d0082db8a85b1c07a47c3c1e20b8745f367
7
- data.tar.gz: 63ea245c6a4c46be36ddf73bdfb159ebce9a45c25ea82815f2a0377b9b8e6196cc975c230b009ba51146e00288eaf0aa9fe4863f54c0294a2de64fcbe45e75ea
6
+ metadata.gz: 94d23fe6922e3baa914de8d3964ea89ff21d4802b70f24f3d17b2078c5a2650b0375daae97ab18edbf9abb7b710dd5fba1c30696c7e2ba2c9db46705f5693524
7
+ data.tar.gz: 49989565e733781a37f4e487cf679fa9de3ca34e8258b8f6c0d76c240a9168793baba9eaf9d587dcb0eb29a973dd6fcd5fc334e404468a6b46698ae0d8c39712
@@ -607,10 +607,9 @@ module PostHog
607
607
  # @param [Boolean] only_evaluate_locally Skip the remote /flags call entirely
608
608
  # @param [Boolean, nil] disable_geoip When true, disables GeoIP lookup for remote evaluation and stamps captured
609
609
  # access events.
610
- # @param [Array<String, Symbol>] flag_keys When set, scopes the underlying /flags
611
- # request to only these flag keys (sent as `flag_keys_to_evaluate`).
612
- # Distinct from {FeatureFlagEvaluations#only}, which filters the
613
- # already-fetched snapshot in memory.
610
+ # @param [Array<String, Symbol>, nil] flag_keys When set, scopes evaluation to only these flag keys.
611
+ # An empty array returns an empty snapshot without evaluating flags; +nil+ evaluates all flags.
612
+ # Distinct from {FeatureFlagEvaluations#only}, which filters the already-fetched snapshot in memory.
614
613
  # @return [PostHog::FeatureFlagEvaluations]
615
614
  def evaluate_flags(
616
615
  distinct_id,
@@ -629,6 +628,12 @@ module PostHog
629
628
 
630
629
  return FeatureFlagEvaluations.new(host: host, distinct_id: distinct_id, flags: {}, groups: groups) if @disabled
631
630
 
631
+ if flag_keys && flag_keys.empty?
632
+ return FeatureFlagEvaluations.new(
633
+ host: host, distinct_id: distinct_id, flags: {}, groups: groups, disable_geoip: disable_geoip
634
+ )
635
+ end
636
+
632
637
  person_properties, group_properties = add_local_person_and_group_properties(
633
638
  groups, person_properties, group_properties
634
639
  )
@@ -1179,7 +1184,7 @@ module PostHog
1179
1184
 
1180
1185
  @sync_lock.synchronize do
1181
1186
  res = @transport.send(@api_key, batch)
1182
- @on_error.call(res.status, res.error) unless res.status == 200
1187
+ @on_error.call(res.status, res.error) unless res.status.between?(200, 299)
1183
1188
  end
1184
1189
  end
1185
1190
 
@@ -154,7 +154,7 @@ module PostHog
154
154
 
155
155
  def send_batch
156
156
  res = @transport.send @api_key, @batch
157
- handle_error(res.status, res.error) unless res.status == 200
157
+ handle_error(res.status, res.error) unless res.status.between?(200, 299)
158
158
  end
159
159
 
160
160
  def consume_message_from_queue!
@@ -73,7 +73,7 @@ module PostHog
73
73
  status_code, body = send_request(api_key, batch)
74
74
  error =
75
75
  begin
76
- JSON.parse(body)['error']
76
+ body && JSON.parse(body)['error']
77
77
  rescue JSON::ParserError
78
78
  body
79
79
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.23.2'
4
+ VERSION = '3.23.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: posthog-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.23.2
4
+ version: 3.23.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''