statsig 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/statsig.rb +1 -1
  3. data/lib/statsig_user.rb +19 -11
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31a3f19ad19ba6b7ce4ebd18e2632ee04a85d3a2176b2c914e75fcd8f326f578
4
- data.tar.gz: b3d6905b985889b60a0e713231d7bb5576cb9638972d331243bf93c881557130
3
+ metadata.gz: e976fe13de26ad1653e42b8a5a710210b51234cb96e6eaed6cbd350097f2370f
4
+ data.tar.gz: d0a3e427187fd4ae7cd0ff0b0c0e3c2bb88c3cf5dd7ed14a272f5dae89b18ea1
5
5
  SHA512:
6
- metadata.gz: 4a15075766b794eeefdc187cd225edac10a35810a8066ffab521db2228466a5687007a58077a9c788b668b5ed25cddc0c125f5f74fbf4bdea0488318159e9c00
7
- data.tar.gz: 74e4ded54a6dc0198ca99cca62d12517109957316a45b562c26df5eca6f154db9a2f1cb59f4a1c6575035a6863f5a7055ee7d4d7e38c6f8eeaa7930eb487cebd
6
+ metadata.gz: 2eeaf918074df7b66ffd9746d7f1717efa1912be27e86698c44bd57869f2ca023590d5db9779bbf0b3312a26735781b51afc5fd7a5e726f13fc5af00f7395fec
7
+ data.tar.gz: '08d264d18cd2c772f05886782999e8c5703cf92d006a3395f57af84795b4cd309b8a7efe4d98b9e9d62378f584eb3735f3c299f859f0a46e660013e543780dca'
data/lib/statsig.rb CHANGED
@@ -227,7 +227,7 @@ module Statsig
227
227
  def self.get_statsig_metadata
228
228
  {
229
229
  'sdkType' => 'ruby-server',
230
- 'sdkVersion' => '1.20.0',
230
+ 'sdkVersion' => '1.21.0',
231
231
  }
232
232
  end
233
233
 
data/lib/statsig_user.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # typed: true
2
2
 
3
3
  require 'sorbet-runtime'
4
+ require 'json'
4
5
 
5
6
  ##
6
7
  # The user object to be evaluated against your Statsig configurations (gates/experiments/dynamic configs).
@@ -62,17 +63,24 @@ class StatsigUser
62
63
  sig { params(user_hash: T.any(T::Hash[T.any(String, Symbol), T.untyped], NilClass)).void }
63
64
 
64
65
  def initialize(user_hash)
65
- @user_id = from_hash(user_hash, [:user_id, :userID], String)
66
- @email = from_hash(user_hash, [:email], String)
67
- @ip = from_hash(user_hash, [:ip], String)
68
- @user_agent = from_hash(user_hash, [:user_agent, :userAgent], String)
69
- @country = from_hash(user_hash, [:country], String)
70
- @locale = from_hash(user_hash, [:locale], String)
71
- @app_version = from_hash(user_hash, [:app_version, :appVersion], String)
72
- @custom = from_hash(user_hash, [:custom], Hash)
73
- @private_attributes = from_hash(user_hash, [:private_attributes, :privateAttributes], Hash)
74
- @custom_ids = from_hash(user_hash, [:custom_ids, :customIDs], Hash)
75
- @statsig_environment = from_hash(user_hash, [:statsig_environment, :statsigEnvironment], Hash)
66
+ the_hash = user_hash
67
+ begin
68
+ the_hash = JSON.parse(user_hash&.to_json || "")
69
+ rescue
70
+ puts 'Failed to clone user hash'
71
+ end
72
+
73
+ @user_id = from_hash(the_hash, [:user_id, :userID], String)
74
+ @email = from_hash(the_hash, [:email], String)
75
+ @ip = from_hash(the_hash, [:ip], String)
76
+ @user_agent = from_hash(the_hash, [:user_agent, :userAgent], String)
77
+ @country = from_hash(the_hash, [:country], String)
78
+ @locale = from_hash(the_hash, [:locale], String)
79
+ @app_version = from_hash(the_hash, [:app_version, :appVersion], String)
80
+ @custom = from_hash(the_hash, [:custom], Hash)
81
+ @private_attributes = from_hash(the_hash, [:private_attributes, :privateAttributes], Hash)
82
+ @custom_ids = from_hash(the_hash, [:custom_ids, :customIDs], Hash)
83
+ @statsig_environment = from_hash(the_hash, [:statsig_environment, :statsigEnvironment], Hash)
76
84
  end
77
85
 
78
86
  def serialize(for_logging)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statsig
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Statsig, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.3.26
218
+ rubygems_version: 3.4.1
219
219
  signing_key:
220
220
  specification_version: 4
221
221
  summary: Statsig server SDK for Ruby