posthog-ruby 3.8.0 → 3.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a21b0cf7196c00dff9b6ad23c7ee12e54b9984b9e2e7639d0f4371f419de80c2
4
- data.tar.gz: 643244ae98a7d9879e64c905133aafba69e0e5e710e49766bdd38db24f28032d
3
+ metadata.gz: 4400cef0c43dd5e79c18f38712b6f0033271f798ad8f97362338516ab491185a
4
+ data.tar.gz: c789f72bcd04df210a74e79d9069e20a5a7f02b0b9b48eae344f58a33c348c8e
5
5
  SHA512:
6
- metadata.gz: f3e4329938912befad0b58c463dd5e82ff606e381c4f306e4a1d2e509963a613cff41acc5af853cd7a4f01033af283ee7a5f77324dd31e58c605b3f84a4d9d1b
7
- data.tar.gz: e331c6d025c837c2c2764d4dcccbf61dd0c33e53f55dc9a5fbaf6a2628852c86f290dbf5c8c6c375e178d13ba839126e5c472e3bce1769e118d27b28f8410f17
6
+ metadata.gz: fc6f2f8cfd188881c9aec1ab5867bf555ebfc8fdf12f87e2fb086884e75968e268df8346b1463a563bb48529f6f7c6326366718885c6e6584aa140ff5aa15f87
7
+ data.tar.gz: 7b6c516b339b0beaa8a0980d5e1d02027e826065f6bb28c85817344227cced2500b95e359bfe8955af952f553dc9b6cee958be8ffe2f52629d1bd1cf3df5e6f6
@@ -364,15 +364,15 @@ module PostHog
364
364
  !!response
365
365
  end
366
366
 
367
- # @param [String] flag_key The unique flag key of the feature flag
367
+ # @param [String, Symbol] flag_key The unique flag key of the feature flag
368
368
  # @return [String] The decrypted value of the feature flag payload
369
369
  def get_remote_config_payload(flag_key)
370
- @feature_flags_poller.get_remote_config_payload(flag_key)
370
+ @feature_flags_poller.get_remote_config_payload(flag_key.to_s)
371
371
  end
372
372
 
373
373
  # Returns whether the given feature flag is enabled for the given user or not
374
374
  #
375
- # @param [String] key The key of the feature flag
375
+ # @param [String, Symbol] key The key of the feature flag
376
376
  # @param [String] distinct_id The distinct id of the user
377
377
  # @param [Hash] groups
378
378
  # @param [Hash] person_properties key-value pairs of properties to associate with the user.
@@ -455,7 +455,7 @@ module PostHog
455
455
  # @param [Hash] group_properties
456
456
  # @param [Boolean] only_evaluate_locally Skip the remote /flags call entirely
457
457
  # @param [Boolean] disable_geoip Stamped on captured access events
458
- # @param [Array<String>] flag_keys When set, scopes the underlying /flags
458
+ # @param [Array<String, Symbol>] flag_keys When set, scopes the underlying /flags
459
459
  # request to only these flag keys (sent as `flag_keys_to_evaluate`).
460
460
  # Distinct from {FeatureFlagEvaluations#only}, which filters the
461
461
  # already-fetched snapshot in memory.
@@ -598,7 +598,7 @@ module PostHog
598
598
  # @deprecated Use {#get_feature_flag_result} instead, which returns both the flag value and payload
599
599
  # and properly raises the $feature_flag_called event.
600
600
  #
601
- # @param [String] key The key of the feature flag
601
+ # @param [String, Symbol] key The key of the feature flag
602
602
  # @param [String] distinct_id The distinct id of the user
603
603
  # @option [String or boolean] match_value The value of the feature flag to be matched
604
604
  # @option [Hash] groups
@@ -623,6 +623,7 @@ module PostHog
623
623
  'instead — this consolidates flag evaluation into a single `/flags` request per ' \
624
624
  'incoming request.'
625
625
  )
626
+ key = key.to_s
626
627
  person_properties, group_properties = add_local_person_and_group_properties(distinct_id, groups,
627
628
  person_properties, group_properties)
628
629
  @feature_flags_poller.get_feature_flag_payload(key, distinct_id, match_value, groups, person_properties,
@@ -725,6 +726,7 @@ module PostHog
725
726
  only_evaluate_locally: false,
726
727
  send_feature_flag_events: true
727
728
  )
729
+ key = key.to_s
728
730
  person_properties, group_properties = add_local_person_and_group_properties(
729
731
  distinct_id, groups, person_properties, group_properties
730
732
  )
@@ -125,6 +125,7 @@ module PostHog
125
125
 
126
126
  def get_flags(distinct_id, groups = {}, person_properties = {}, group_properties = {}, flag_keys = nil,
127
127
  disable_geoip = nil)
128
+ flag_keys = flag_keys.map(&:to_s) if flag_keys.is_a?(Array)
128
129
  request_data = {
129
130
  distinct_id: distinct_id,
130
131
  groups: groups,
@@ -160,7 +161,7 @@ module PostHog
160
161
  end
161
162
 
162
163
  def get_remote_config_payload(flag_key)
163
- _request_remote_config_payload(flag_key)
164
+ _request_remote_config_payload(flag_key.to_s)
164
165
  end
165
166
 
166
167
  def get_feature_flag(
@@ -171,6 +172,8 @@ module PostHog
171
172
  group_properties = {},
172
173
  only_evaluate_locally = false
173
174
  )
175
+ key = key.to_s
176
+
174
177
  # make sure they're loaded on first run
175
178
  load_feature_flags
176
179
 
@@ -363,6 +366,8 @@ module PostHog
363
366
  group_properties = {},
364
367
  only_evaluate_locally = false
365
368
  )
369
+ key = key.to_s
370
+
366
371
  if match_value.nil?
367
372
  match_value = get_feature_flag(
368
373
  key,
@@ -923,6 +928,7 @@ module PostHog
923
928
  def _compute_flag_payload_locally(key, match_value)
924
929
  return nil if @feature_flags_by_key.nil?
925
930
 
931
+ key = key.to_s
926
932
  response = nil
927
933
  if [true, false].include? match_value
928
934
  response = @feature_flags_by_key.dig(key, :filters, :payloads, match_value.to_s.to_sym)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.8.0'
4
+ VERSION = '3.8.1'
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.8.0
4
+ version: 3.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''