posthog-ruby 3.9.5 → 3.10.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: 26f691859b23fd8a734457d5210bcfe633213c352c7362b375cf0107c169fce6
4
- data.tar.gz: b4b3803c627bf7f2f680e26ea986c40a5c36ec73ec87ef197b4d4fa702e5cb77
3
+ metadata.gz: caf866cb91c9fb07b894b6af005decf79644ddc3c2a7c2f84dc3dd59ac9350b1
4
+ data.tar.gz: 6aace1e7809b8f2c6f8529086aaaf8cceb44d5f47b515222d0eeb0e757a66617
5
5
  SHA512:
6
- metadata.gz: 4163a8b03c807016df84525b4adf6aa4a55af22c5354e4710dd82d2fc5222015c242a22ad5e9564614686527c0ff97e72cd0b40d18b3bace964bcb68d3fe8c7c
7
- data.tar.gz: 5ad637fd4df58d0d296b30c820c7017957ed4eae7488e639402504b4d477a97d30e9533a2fe14373ae5806ee515eab21522a2c6ef81222de4ce9e43dd1042a18
6
+ metadata.gz: ec98d033a36bd7069b001e957fd5a395d54225f505717c45322faa8ce157d00a8fdb1275b5ac4f098e3c51e78a8b2b13a11a94d76be7d50be9b87ab469da3285
7
+ data.tar.gz: c0122abe71ac22a9075236b167c4a136c156f8af6853252f0caf18e4c7f41f8ccdd4b2132481d1138a6ec44793efef8d14ed35c3b7aa5769f45b20babd1ebae9
@@ -73,6 +73,9 @@ module PostHog
73
73
  # Intended only for local development or custom deployments.
74
74
  # @option opts [Object] :flag_definition_cache_provider An object implementing the {FlagDefinitionCacheProvider}
75
75
  # interface for distributed flag definition caching.
76
+ # @option opts [Boolean] :is_server +true+ to stamp captured events with `$is_server => true` so PostHog
77
+ # attributes them as server-side. Defaults to +true+. Set to +false+ when running posthog-ruby as a
78
+ # client/CLI so the device OS is attributed normally and `$is_server` is omitted.
76
79
  def initialize(opts = {})
77
80
  symbolize_keys!(opts)
78
81
 
@@ -141,6 +144,7 @@ module PostHog
141
144
  end
142
145
 
143
146
  @before_send = opts[:before_send]
147
+ @is_server = opts.fetch(:is_server, true) != false
144
148
  @deprecation_emitted_for = Concurrent::Set.new
145
149
  end
146
150
 
@@ -272,6 +276,7 @@ module PostHog
272
276
  attrs[:feature_variants] = feature_variants if feature_variants
273
277
  end
274
278
 
279
+ attrs[:is_server] = @is_server
275
280
  enqueue(FieldParser.parse_for_capture(attrs))
276
281
  end
277
282
 
@@ -317,6 +322,7 @@ module PostHog
317
322
  return false if @disabled
318
323
 
319
324
  symbolize_keys! attrs
325
+ attrs[:is_server] = @is_server
320
326
  enqueue(FieldParser.parse_for_identify(attrs))
321
327
  end
322
328
 
@@ -334,6 +340,7 @@ module PostHog
334
340
  return false if @disabled
335
341
 
336
342
  symbolize_keys! attrs
343
+ attrs[:is_server] = @is_server
337
344
  enqueue(FieldParser.parse_for_group_identify(attrs))
338
345
  end
339
346
 
@@ -348,6 +355,7 @@ module PostHog
348
355
  return false if @disabled
349
356
 
350
357
  symbolize_keys! attrs
358
+ attrs[:is_server] = @is_server
351
359
  enqueue(FieldParser.parse_for_alias(attrs))
352
360
  end
353
361
 
@@ -89,11 +89,11 @@ module PostHog
89
89
  common.merge(
90
90
  {
91
91
  event: '$groupidentify',
92
- properties: {
92
+ properties: (common[:properties] || {}).merge(
93
93
  '$group_type': group_type,
94
94
  '$group_key': group_key,
95
- '$group_set': properties.merge(common[:properties] || {})
96
- }
95
+ '$group_set': properties
96
+ )
97
97
  }
98
98
  )
99
99
  end
@@ -141,16 +141,21 @@ module PostHog
141
141
  check_timestamp! timestamp
142
142
  check_presence! distinct_id, 'distinct_id'
143
143
 
144
+ is_server = fields.fetch(:is_server, true) != false
145
+
146
+ properties = {
147
+ '$lib' => 'posthog-ruby',
148
+ '$lib_version' => PostHog::VERSION.to_s
149
+ }
150
+ properties['$is_server'] = true if is_server
151
+
144
152
  parsed = {
145
153
  timestamp: datetime_in_iso8601(timestamp),
146
154
  library: 'posthog-ruby',
147
155
  library_version: PostHog::VERSION.to_s,
148
156
  messageId: message_id,
149
157
  distinct_id: distinct_id,
150
- properties: {
151
- '$lib' => 'posthog-ruby',
152
- '$lib_version' => PostHog::VERSION.to_s
153
- }
158
+ properties: properties
154
159
  }
155
160
 
156
161
  if send_feature_flags && fields[:feature_variants]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostHog
4
- VERSION = '3.9.5'
4
+ VERSION = '3.10.0'
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.9.5
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''