safetykit 0.9.0 → 0.11.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: f1a671107be88330ee0f811d53e8682de7abeb3af6a2688377967666e24cd914
4
- data.tar.gz: f3dacbc2b9ec525bf4227eb490ea5e9b49bd9c1504899b0b1211648ea2e78155
3
+ metadata.gz: 94e07ec577f1b4609f67ecb8781f7dcb8cad0921771c864f1228a06fb42106fa
4
+ data.tar.gz: 032fa52459d5ff0ecae1d068122e0240c97195d911a2b93de316c4a65341d882
5
5
  SHA512:
6
- metadata.gz: 236641839506941d2c51deea450ac238e96b06dab2f3127a8e4c2ef6408cb4c4b8fd5c65c514a256ecfd18151c92d4d5122acd0f75898ca88e0d858f5d06e10b
7
- data.tar.gz: 9f0391fc5968b36964e3afff66bc74a39f9abb9889b15f34028ed5a534d52b0cff47f014d0bf499233172796a84cf99721a495c7f07d1fa5329d0e73c6cd25d5
6
+ metadata.gz: 6485be8f59b774dc3dca76cc35a87d3c04137b8a373951137b943472e6df1eeaa0f6d78fde41ba7a7089741adc467f079aafeb61074ef50f23d97c15f23294ca
7
+ data.tar.gz: cfd8bb7c49af9ad28babc906b9726f6838bd175d088d977011aba1edcc05f0a7a4a4a079b8ee93a0bb9563ff05b4caa051b6e0c7ba3fc8aa082a81e84459deae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.0 (2026-06-01)
4
+
5
+ Full Changelog: [v0.10.0...v0.11.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.10.0...v0.11.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([e67d224](https://github.com/GetSafetyKit/safetykit-ruby/commit/e67d22440af2aa0abda0fb0d64ba8a4d4ac2f6bc))
10
+
11
+ ## 0.10.0 (2026-06-01)
12
+
13
+ Full Changelog: [v0.9.0...v0.10.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.9.0...v0.10.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** api update ([aee3f63](https://github.com/GetSafetyKit/safetykit-ruby/commit/aee3f6328ed102537734db57da1b09fc90c8b5a7))
18
+
3
19
  ## 0.9.0 (2026-06-01)
4
20
 
5
21
  Full Changelog: [v0.8.0...v0.9.0](https://github.com/GetSafetyKit/safetykit-ruby/compare/v0.8.0...v0.9.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "safetykit", "~> 0.9.0"
20
+ gem "safetykit", "~> 0.11.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -7,24 +7,85 @@ module SafetyKit
7
7
  extend SafetyKit::Internal::Type::RequestParameters::Converter
8
8
  include SafetyKit::Internal::Type::RequestParameters
9
9
 
10
- # @!attribute customer_session_hash
11
- # Hashed customer browser session value associated with the browser SDK session.
10
+ # @!attribute body
11
+ # Request body for creating a browser-safe webapp SDK session token from
12
+ # server-side code. Provide at least one of customer_user_id or
13
+ # customer_session_hash.
12
14
  #
13
- # @return [String, nil]
14
- optional :customer_session_hash, String
15
+ # @return [SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember0, SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember1]
16
+ required :body, union: -> { SafetyKit::ClientSessionCreateSessionParams::Body }
15
17
 
16
- # @!attribute customer_user_id
17
- # Customer user identifier associated with the browser SDK session.
18
+ # @!method initialize(body:, request_options: {})
19
+ # Some parameter documentations has been truncated, see
20
+ # {SafetyKit::Models::ClientSessionCreateSessionParams} for more details.
18
21
  #
19
- # @return [String, nil]
20
- optional :customer_user_id, String
21
-
22
- # @!method initialize(customer_session_hash: nil, customer_user_id: nil, request_options: {})
23
- # @param customer_session_hash [String] Hashed customer browser session value associated with the browser SDK session.
24
- #
25
- # @param customer_user_id [String] Customer user identifier associated with the browser SDK session.
22
+ # @param body [SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember0, SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember1] Request body for creating a browser-safe webapp SDK session token from server-si
26
23
  #
27
24
  # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}]
25
+
26
+ # Request body for creating a browser-safe webapp SDK session token from
27
+ # server-side code. Provide at least one of customer_user_id or
28
+ # customer_session_hash.
29
+ module Body
30
+ extend SafetyKit::Internal::Type::Union
31
+
32
+ variant -> { SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0 }
33
+
34
+ variant -> { SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1 }
35
+
36
+ class UnionMember0 < SafetyKit::Internal::Type::BaseModel
37
+ # @!attribute customer_user_id
38
+ # Customer user identifier associated with the browser SDK session. Use the same
39
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
40
+ # events.
41
+ #
42
+ # @return [String]
43
+ required :customer_user_id, String
44
+
45
+ # @!attribute customer_session_hash
46
+ # Stable opaque customer session hash associated with the browser SDK session.
47
+ #
48
+ # @return [String, nil]
49
+ optional :customer_session_hash, String
50
+
51
+ # @!method initialize(customer_user_id:, customer_session_hash: nil)
52
+ # Some parameter documentations has been truncated, see
53
+ # {SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember0} for
54
+ # more details.
55
+ #
56
+ # @param customer_user_id [String] Customer user identifier associated with the browser SDK session. Use the same c
57
+ #
58
+ # @param customer_session_hash [String] Stable opaque customer session hash associated with the browser SDK session.
59
+ end
60
+
61
+ class UnionMember1 < SafetyKit::Internal::Type::BaseModel
62
+ # @!attribute customer_session_hash
63
+ # Stable opaque customer session hash associated with the browser SDK session.
64
+ #
65
+ # @return [String]
66
+ required :customer_session_hash, String
67
+
68
+ # @!attribute customer_user_id
69
+ # Customer user identifier associated with the browser SDK session. Use the same
70
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
71
+ # events.
72
+ #
73
+ # @return [String, nil]
74
+ optional :customer_user_id, String
75
+
76
+ # @!method initialize(customer_session_hash:, customer_user_id: nil)
77
+ # Some parameter documentations has been truncated, see
78
+ # {SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember1} for
79
+ # more details.
80
+ #
81
+ # @param customer_session_hash [String] Stable opaque customer session hash associated with the browser SDK session.
82
+ #
83
+ # @param customer_user_id [String] Customer user identifier associated with the browser SDK session. Use the same c
84
+ end
85
+
86
+ # @!method self.variants
87
+ # @return [Array(SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember0, SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember1)]
88
+ end
28
89
  end
29
90
  end
30
91
  end
@@ -5,28 +5,32 @@ module SafetyKit
5
5
  # Create browser-safe webapp SDK session tokens from authenticated server-side
6
6
  # code.
7
7
  class ClientSessions
8
- # Create a browser-safe SafetyKit webapp SDK session token from server-side code
9
- # before rendering pages that load the browser SDK. The request must be
10
- # authenticated with a valid Bearer token.
8
+ # Some parameter documentations has been truncated, see
9
+ # {SafetyKit::Models::ClientSessionCreateSessionParams} for more details.
11
10
  #
12
- # @overload create_session(customer_session_hash: nil, customer_user_id: nil, request_options: {})
11
+ # Create a browser-safe SafetyKit webapp SDK session token from server-side code
12
+ # before rendering pages that load the browser SDK. Provide at least one of
13
+ # customer_user_id or customer_session_hash. When customer_user_id is present, use
14
+ # the same canonical user ID string that you send as user_id in SafetyKit
15
+ # server-to-server events. The request must be authenticated with a valid Bearer
16
+ # token.
13
17
  #
14
- # @param customer_session_hash [String] Hashed customer browser session value associated with the browser SDK session.
18
+ # @overload create_session(body:, request_options: {})
15
19
  #
16
- # @param customer_user_id [String] Customer user identifier associated with the browser SDK session.
20
+ # @param body [SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember0, SafetyKit::Models::ClientSessionCreateSessionParams::Body::UnionMember1] Request body for creating a browser-safe webapp SDK session token from server-si
17
21
  #
18
22
  # @param request_options [SafetyKit::RequestOptions, Hash{Symbol=>Object}, nil]
19
23
  #
20
24
  # @return [SafetyKit::Models::ClientSessionCreateSessionResponse]
21
25
  #
22
26
  # @see SafetyKit::Models::ClientSessionCreateSessionParams
23
- def create_session(params = {})
27
+ def create_session(params)
24
28
  parsed, options = SafetyKit::ClientSessionCreateSessionParams.dump_request(params)
25
29
  path = @client.base_url_overridden? ? "v1/sessions" : "https://diagnostics.safetykit.com/v1/sessions"
26
30
  @client.request(
27
31
  method: :post,
28
32
  path: path,
29
- body: parsed,
33
+ body: parsed[:body],
30
34
  model: SafetyKit::Models::ClientSessionCreateSessionResponse,
31
35
  options: options
32
36
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SafetyKit
4
- VERSION = "0.9.0"
4
+ VERSION = "0.11.0"
5
5
  end
@@ -14,32 +14,34 @@ module SafetyKit
14
14
  )
15
15
  end
16
16
 
17
- # Hashed customer browser session value associated with the browser SDK session.
18
- sig { returns(T.nilable(String)) }
19
- attr_reader :customer_session_hash
20
-
21
- sig { params(customer_session_hash: String).void }
22
- attr_writer :customer_session_hash
23
-
24
- # Customer user identifier associated with the browser SDK session.
25
- sig { returns(T.nilable(String)) }
26
- attr_reader :customer_user_id
27
-
28
- sig { params(customer_user_id: String).void }
29
- attr_writer :customer_user_id
17
+ # Request body for creating a browser-safe webapp SDK session token from
18
+ # server-side code. Provide at least one of customer_user_id or
19
+ # customer_session_hash.
20
+ sig do
21
+ returns(
22
+ T.any(
23
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0,
24
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1
25
+ )
26
+ )
27
+ end
28
+ attr_accessor :body
30
29
 
31
30
  sig do
32
31
  params(
33
- customer_session_hash: String,
34
- customer_user_id: String,
32
+ body:
33
+ T.any(
34
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0::OrHash,
35
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1::OrHash
36
+ ),
35
37
  request_options: SafetyKit::RequestOptions::OrHash
36
38
  ).returns(T.attached_class)
37
39
  end
38
40
  def self.new(
39
- # Hashed customer browser session value associated with the browser SDK session.
40
- customer_session_hash: nil,
41
- # Customer user identifier associated with the browser SDK session.
42
- customer_user_id: nil,
41
+ # Request body for creating a browser-safe webapp SDK session token from
42
+ # server-side code. Provide at least one of customer_user_id or
43
+ # customer_session_hash.
44
+ body:,
43
45
  request_options: {}
44
46
  )
45
47
  end
@@ -47,14 +49,136 @@ module SafetyKit
47
49
  sig do
48
50
  override.returns(
49
51
  {
50
- customer_session_hash: String,
51
- customer_user_id: String,
52
+ body:
53
+ T.any(
54
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0,
55
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1
56
+ ),
52
57
  request_options: SafetyKit::RequestOptions
53
58
  }
54
59
  )
55
60
  end
56
61
  def to_hash
57
62
  end
63
+
64
+ # Request body for creating a browser-safe webapp SDK session token from
65
+ # server-side code. Provide at least one of customer_user_id or
66
+ # customer_session_hash.
67
+ module Body
68
+ extend SafetyKit::Internal::Type::Union
69
+
70
+ Variants =
71
+ T.type_alias do
72
+ T.any(
73
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0,
74
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1
75
+ )
76
+ end
77
+
78
+ class UnionMember0 < SafetyKit::Internal::Type::BaseModel
79
+ OrHash =
80
+ T.type_alias do
81
+ T.any(
82
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0,
83
+ SafetyKit::Internal::AnyHash
84
+ )
85
+ end
86
+
87
+ # Customer user identifier associated with the browser SDK session. Use the same
88
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
89
+ # events.
90
+ sig { returns(String) }
91
+ attr_accessor :customer_user_id
92
+
93
+ # Stable opaque customer session hash associated with the browser SDK session.
94
+ sig { returns(T.nilable(String)) }
95
+ attr_reader :customer_session_hash
96
+
97
+ sig { params(customer_session_hash: String).void }
98
+ attr_writer :customer_session_hash
99
+
100
+ sig do
101
+ params(
102
+ customer_user_id: String,
103
+ customer_session_hash: String
104
+ ).returns(T.attached_class)
105
+ end
106
+ def self.new(
107
+ # Customer user identifier associated with the browser SDK session. Use the same
108
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
109
+ # events.
110
+ customer_user_id:,
111
+ # Stable opaque customer session hash associated with the browser SDK session.
112
+ customer_session_hash: nil
113
+ )
114
+ end
115
+
116
+ sig do
117
+ override.returns(
118
+ { customer_user_id: String, customer_session_hash: String }
119
+ )
120
+ end
121
+ def to_hash
122
+ end
123
+ end
124
+
125
+ class UnionMember1 < SafetyKit::Internal::Type::BaseModel
126
+ OrHash =
127
+ T.type_alias do
128
+ T.any(
129
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1,
130
+ SafetyKit::Internal::AnyHash
131
+ )
132
+ end
133
+
134
+ # Stable opaque customer session hash associated with the browser SDK session.
135
+ sig { returns(String) }
136
+ attr_accessor :customer_session_hash
137
+
138
+ # Customer user identifier associated with the browser SDK session. Use the same
139
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
140
+ # events.
141
+ sig { returns(T.nilable(String)) }
142
+ attr_reader :customer_user_id
143
+
144
+ sig { params(customer_user_id: String).void }
145
+ attr_writer :customer_user_id
146
+
147
+ sig do
148
+ params(
149
+ customer_session_hash: String,
150
+ customer_user_id: String
151
+ ).returns(T.attached_class)
152
+ end
153
+ def self.new(
154
+ # Stable opaque customer session hash associated with the browser SDK session.
155
+ customer_session_hash:,
156
+ # Customer user identifier associated with the browser SDK session. Use the same
157
+ # canonical user ID string that you send as user_id in SafetyKit server-to-server
158
+ # events.
159
+ customer_user_id: nil
160
+ )
161
+ end
162
+
163
+ sig do
164
+ override.returns(
165
+ { customer_session_hash: String, customer_user_id: String }
166
+ )
167
+ end
168
+ def to_hash
169
+ end
170
+ end
171
+
172
+ sig do
173
+ override.returns(
174
+ T::Array[
175
+ SafetyKit::ClientSessionCreateSessionParams::Body::Variants
176
+ ]
177
+ )
178
+ end
179
+ def self.variants
180
+ end
181
+ end
58
182
  end
59
183
  end
60
184
  end
@@ -6,20 +6,26 @@ module SafetyKit
6
6
  # code.
7
7
  class ClientSessions
8
8
  # Create a browser-safe SafetyKit webapp SDK session token from server-side code
9
- # before rendering pages that load the browser SDK. The request must be
10
- # authenticated with a valid Bearer token.
9
+ # before rendering pages that load the browser SDK. Provide at least one of
10
+ # customer_user_id or customer_session_hash. When customer_user_id is present, use
11
+ # the same canonical user ID string that you send as user_id in SafetyKit
12
+ # server-to-server events. The request must be authenticated with a valid Bearer
13
+ # token.
11
14
  sig do
12
15
  params(
13
- customer_session_hash: String,
14
- customer_user_id: String,
16
+ body:
17
+ T.any(
18
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0::OrHash,
19
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1::OrHash
20
+ ),
15
21
  request_options: SafetyKit::RequestOptions::OrHash
16
22
  ).returns(SafetyKit::Models::ClientSessionCreateSessionResponse)
17
23
  end
18
24
  def create_session(
19
- # Hashed customer browser session value associated with the browser SDK session.
20
- customer_session_hash: nil,
21
- # Customer user identifier associated with the browser SDK session.
22
- customer_user_id: nil,
25
+ # Request body for creating a browser-safe webapp SDK session token from
26
+ # server-side code. Provide at least one of customer_user_id or
27
+ # customer_session_hash.
28
+ body:,
23
29
  request_options: {}
24
30
  )
25
31
  end
@@ -1,32 +1,76 @@
1
1
  module SafetyKit
2
2
  module Models
3
3
  type client_session_create_session_params =
4
- { customer_session_hash: String, customer_user_id: String }
4
+ { body: SafetyKit::Models::ClientSessionCreateSessionParams::body }
5
5
  & SafetyKit::Internal::Type::request_parameters
6
6
 
7
7
  class ClientSessionCreateSessionParams < SafetyKit::Internal::Type::BaseModel
8
8
  extend SafetyKit::Internal::Type::RequestParameters::Converter
9
9
  include SafetyKit::Internal::Type::RequestParameters
10
10
 
11
- attr_reader customer_session_hash: String?
12
-
13
- def customer_session_hash=: (String) -> String
14
-
15
- attr_reader customer_user_id: String?
16
-
17
- def customer_user_id=: (String) -> String
11
+ attr_accessor body: SafetyKit::Models::ClientSessionCreateSessionParams::body
18
12
 
19
13
  def initialize: (
20
- ?customer_session_hash: String,
21
- ?customer_user_id: String,
14
+ body: SafetyKit::Models::ClientSessionCreateSessionParams::body,
22
15
  ?request_options: SafetyKit::request_opts
23
16
  ) -> void
24
17
 
25
18
  def to_hash: -> {
26
- customer_session_hash: String,
27
- customer_user_id: String,
19
+ body: SafetyKit::Models::ClientSessionCreateSessionParams::body,
28
20
  request_options: SafetyKit::RequestOptions
29
21
  }
22
+
23
+ type body =
24
+ SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember0
25
+ | SafetyKit::ClientSessionCreateSessionParams::Body::UnionMember1
26
+
27
+ module Body
28
+ extend SafetyKit::Internal::Type::Union
29
+
30
+ type union_member0 =
31
+ { customer_user_id: String, customer_session_hash: String }
32
+
33
+ class UnionMember0 < SafetyKit::Internal::Type::BaseModel
34
+ attr_accessor customer_user_id: String
35
+
36
+ attr_reader customer_session_hash: String?
37
+
38
+ def customer_session_hash=: (String) -> String
39
+
40
+ def initialize: (
41
+ customer_user_id: String,
42
+ ?customer_session_hash: String
43
+ ) -> void
44
+
45
+ def to_hash: -> {
46
+ customer_user_id: String,
47
+ customer_session_hash: String
48
+ }
49
+ end
50
+
51
+ type union_member1 =
52
+ { customer_session_hash: String, customer_user_id: String }
53
+
54
+ class UnionMember1 < SafetyKit::Internal::Type::BaseModel
55
+ attr_accessor customer_session_hash: String
56
+
57
+ attr_reader customer_user_id: String?
58
+
59
+ def customer_user_id=: (String) -> String
60
+
61
+ def initialize: (
62
+ customer_session_hash: String,
63
+ ?customer_user_id: String
64
+ ) -> void
65
+
66
+ def to_hash: -> {
67
+ customer_session_hash: String,
68
+ customer_user_id: String
69
+ }
70
+ end
71
+
72
+ def self?.variants: -> ::Array[SafetyKit::Models::ClientSessionCreateSessionParams::body]
73
+ end
30
74
  end
31
75
  end
32
76
  end
@@ -2,8 +2,7 @@ module SafetyKit
2
2
  module Resources
3
3
  class ClientSessions
4
4
  def create_session: (
5
- ?customer_session_hash: String,
6
- ?customer_user_id: String,
5
+ body: SafetyKit::Models::ClientSessionCreateSessionParams::body,
7
6
  ?request_options: SafetyKit::request_opts
8
7
  ) -> SafetyKit::Models::ClientSessionCreateSessionResponse
9
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: safetykit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Safetykit