flagsmith 4.3.0 → 5.0.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: 0d20d6b2aee787d2d25478b00eea5f1e06ad4f345097102b1381faf7455774d2
4
- data.tar.gz: c782d13647ae7c5905e0a0b46cb0085a395adbb71c95101e0b424b719e2b1a52
3
+ metadata.gz: b59d272761eb747f1c641b42eb8fb55271b16fa458a572a7aa6b855abf586e8e
4
+ data.tar.gz: 3f5574d998098c99a6382989ec5f0dea89931d39db35cbf2adab344ce2ab76a5
5
5
  SHA512:
6
- metadata.gz: 135da46a33bde44fb78a54c769dc25caab7566b18c68a870306ef645cad2de6de75ee599af0fd851fa3a3562bae92bec57e57089f31fa4f9cb282fadf47df01a
7
- data.tar.gz: ead1e0df360be3a4637892f8fec1c10415967a072604b42dc113ee5034a06a235294300de59014ab35c829aceb46acca9454f29138e02dd610fd97abaadae293
6
+ metadata.gz: 9191b70408b15bb072466d6f3f982aad4988559c6875cb6b529ee5e4e6a3319fa937ecd60e7609c1013712d8210c444f10390e4b5b33a4528cf6b93ab11c81ab
7
+ data.tar.gz: '058753886f2e4866c89803311225650c57d93c0b1c79dc7d67717836dc8c461aa2c9e70987c3cc3dadf01b2df54408a627484846d160980e64b85ff6e0041c04'
@@ -0,0 +1 @@
1
+ {".":"5.0.1"}
data/CHANGELOG.md ADDED
@@ -0,0 +1,258 @@
1
+ # Changelog
2
+
3
+ ## [5.0.1](https://github.com/Flagsmith/flagsmith-ruby-client/compare/v5.0.0...v5.0.1) (2026-08-26)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * exclude-identities-when-traits-is-undefined ([#96](https://github.com/Flagsmith/flagsmith-ruby-client/issues/96)) ([f888d4c](https://github.com/Flagsmith/flagsmith-ruby-client/commit/f888d4c03c45d7fe8b1a994f2ca512bf7f9f0fe0))
9
+ * removed-dango-id-usage-in-mapper ([#94](https://github.com/Flagsmith/flagsmith-ruby-client/issues/94)) ([a86fc3e](https://github.com/Flagsmith/flagsmith-ruby-client/commit/a86fc3e6cf93c2e99e30b1ed7d2ff144d47be4ee))
10
+ * respect rule type for sub-rules in segment evaluation ([#101](https://github.com/Flagsmith/flagsmith-ruby-client/issues/101)) ([e5c52d8](https://github.com/Flagsmith/flagsmith-ruby-client/commit/e5c52d8a8d06c289e9b24c9f62f021d270dbe1d9))
11
+
12
+
13
+ ### CI
14
+
15
+ * setup Renovate for engine-test-data tracking ([#100](https://github.com/Flagsmith/flagsmith-ruby-client/issues/100)) ([87bd746](https://github.com/Flagsmith/flagsmith-ruby-client/commit/87bd7465a896801cdf5b4fba48f2b88ae1972198))
16
+ * track engine-test-data semver tags via Renovate ([#102](https://github.com/Flagsmith/flagsmith-ruby-client/issues/102)) ([77da402](https://github.com/Flagsmith/flagsmith-ruby-client/commit/77da4025af5e97ea0fd89dc27591d3ab9606cb9d))
17
+
18
+
19
+ ### Dependency Updates
20
+
21
+ * Bump faraday from 2.9.0 to 2.14.1 ([#98](https://github.com/Flagsmith/flagsmith-ruby-client/issues/98)) ([1bdbdbf](https://github.com/Flagsmith/flagsmith-ruby-client/commit/1bdbdbf9876f117f88165e7736756413cc63826a))
22
+ * bump rexml from 3.3.9 to 3.4.2 ([#85](https://github.com/Flagsmith/flagsmith-ruby-client/issues/85)) ([16cb374](https://github.com/Flagsmith/flagsmith-ruby-client/commit/16cb3741a673441addc7accc399f74dcd31314a3))
23
+
24
+
25
+ ### Other
26
+
27
+ * Remove amannn/action-semantic-pull-request workflow ([#97](https://github.com/Flagsmith/flagsmith-ruby-client/issues/97)) ([ddc0f21](https://github.com/Flagsmith/flagsmith-ruby-client/commit/ddc0f21d88f5e4325403ff6d7414e95f6283bc96))
28
+
29
+ ## [5.0.0](https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.3.0...v5.0.0) (2025-11-12)
30
+
31
+
32
+ ### ⚠ BREAKING CHANGES
33
+
34
+ * evaluation context mappers ([#87](https://github.com/Flagsmith/flagsmith-ruby-client/issues/87))
35
+
36
+ ### Features
37
+
38
+ * added-version-in-user-agent-header ([#86](https://github.com/Flagsmith/flagsmith-ruby-client/issues/86)) ([a7216f5](https://github.com/Flagsmith/flagsmith-ruby-client/commit/a7216f51ce99142473b0c12a72940d406543c4bd))
39
+ * evaluation context mappers ([#87](https://github.com/Flagsmith/flagsmith-ruby-client/issues/87)) ([287ce6d](https://github.com/Flagsmith/flagsmith-ruby-client/commit/287ce6d173cf72564da88b8e9c98d042a1deb941))
40
+
41
+
42
+ ### CI
43
+
44
+ * add release please ([#77](https://github.com/Flagsmith/flagsmith-ruby-client/issues/77)) ([a815cd9](https://github.com/Flagsmith/flagsmith-ruby-client/commit/a815cd9f2274f9bda9842786f2a09a358f203f46))
45
+
46
+
47
+ ### Docs
48
+
49
+ * removing hero image from SDK readme ([#78](https://github.com/Flagsmith/flagsmith-ruby-client/issues/78)) ([154c5b2](https://github.com/Flagsmith/flagsmith-ruby-client/commit/154c5b22f0b10c7a013605cf1265c6338f986c62))
50
+
51
+
52
+ ### Other
53
+
54
+ * add root CODEOWNERS ([#83](https://github.com/Flagsmith/flagsmith-ruby-client/issues/83)) ([da0c6e0](https://github.com/Flagsmith/flagsmith-ruby-client/commit/da0c6e045212dd3f7912f0e5e847be0bd5c3ad66))
55
+ * versioned test data ([#80](https://github.com/Flagsmith/flagsmith-ruby-client/issues/80)) ([18eedd9](https://github.com/Flagsmith/flagsmith-ruby-client/commit/18eedd9d51a6a5489fed16e47c167a8bb4c3ae4c))
56
+
57
+ <a id="v4.3.0"></a>
58
+ ## [v4.3.0](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.3.0) - 2024-12-06
59
+
60
+ ## What's Changed
61
+ * Bump rexml from 3.2.8 to 3.3.9 by [@dependabot](https://github.com/dependabot) in [#71](https://github.com/Flagsmith/flagsmith-ruby-client/pull/71)
62
+ * fix: allow false as a flag value by [@bdchauvette](https://github.com/bdchauvette) in [#68](https://github.com/Flagsmith/flagsmith-ruby-client/pull/68)
63
+ * feat: Enable realtime mode (SSE) by [@zachaysan](https://github.com/zachaysan) in [#73](https://github.com/Flagsmith/flagsmith-ruby-client/pull/73)
64
+ * Make segment operators nil-safe by [@rolodato](https://github.com/rolodato) in [#69](https://github.com/Flagsmith/flagsmith-ruby-client/pull/69)
65
+ * chore: Bump to 4.3.0 by [@zachaysan](https://github.com/zachaysan) in [#74](https://github.com/Flagsmith/flagsmith-ruby-client/pull/74)
66
+
67
+ ## New Contributors
68
+ * [@bdchauvette](https://github.com/bdchauvette) made their first contribution in [#68](https://github.com/Flagsmith/flagsmith-ruby-client/pull/68)
69
+ * [@rolodato](https://github.com/rolodato) made their first contribution in [#69](https://github.com/Flagsmith/flagsmith-ruby-client/pull/69)
70
+
71
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.2.0...v4.3.0
72
+
73
+ [Changes][v4.3.0]
74
+
75
+
76
+ <a id="v4.2.0"></a>
77
+ ## [v4.2.0](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.2.0) - 2024-10-22
78
+
79
+ ## What's Changed
80
+ * feat: Support transient identities and traits by [@khvn26](https://github.com/khvn26) in [#66](https://github.com/Flagsmith/flagsmith-ruby-client/pull/66)
81
+
82
+
83
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.1.1...v4.2.0
84
+
85
+ [Changes][v4.2.0]
86
+
87
+
88
+ <a id="v4.1.1"></a>
89
+ ## [v4.1.1](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.1.1) - 2024-05-22
90
+
91
+ ## What's Changed
92
+ * fix: Squash exceptions for polling manager by [@zachaysan](https://github.com/zachaysan) in [#55](https://github.com/Flagsmith/flagsmith-ruby-client/pull/55)
93
+ * Bump rexml from 3.2.6 to 3.2.8 by [@dependabot](https://github.com/dependabot) in [#60](https://github.com/Flagsmith/flagsmith-ruby-client/pull/60)
94
+
95
+
96
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.1.0...v4.1.1
97
+
98
+ [Changes][v4.1.1]
99
+
100
+
101
+ <a id="v4.1.0"></a>
102
+ ## [v4.1.0](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.1.0) - 2024-04-19
103
+
104
+ ## What's Changed
105
+ * feat: Add identity overrides to client by [@zachaysan](https://github.com/zachaysan) in [#50](https://github.com/Flagsmith/flagsmith-ruby-client/pull/50)
106
+ * fix: Make local evaluation multivariate work by [@zachaysan](https://github.com/zachaysan) in [#51](https://github.com/Flagsmith/flagsmith-ruby-client/pull/51)
107
+ * Bump puma from 6.3.1 to 6.4.2 in /example by [@dependabot](https://github.com/dependabot) in [#39](https://github.com/Flagsmith/flagsmith-ruby-client/pull/39)
108
+ * chore: remove examples by [@dabeeeenster](https://github.com/dabeeeenster) in [#48](https://github.com/Flagsmith/flagsmith-ruby-client/pull/48)
109
+ * fix: Mute analytics processor on failure by [@zachaysan](https://github.com/zachaysan) in [#57](https://github.com/Flagsmith/flagsmith-ruby-client/pull/57)
110
+ * fix: Stop repeated calls to update environment when polling manager is set by [@zachaysan](https://github.com/zachaysan) in [#58](https://github.com/Flagsmith/flagsmith-ruby-client/pull/58)
111
+
112
+ ## New Contributors
113
+ * [@dabeeeenster](https://github.com/dabeeeenster) made their first contribution in [#48](https://github.com/Flagsmith/flagsmith-ruby-client/pull/48)
114
+
115
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.0.1...v4.1.0
116
+
117
+ [Changes][v4.1.0]
118
+
119
+
120
+ <a id="v4.0.1"></a>
121
+ ## [v4.0.1](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.0.1) - 2024-02-06
122
+
123
+ ## What's Changed
124
+ * fix: Remove dev dependences by [@zachaysan](https://github.com/zachaysan) in [#45](https://github.com/Flagsmith/flagsmith-ruby-client/pull/45)
125
+ * chore: Bump version to 4.0.1 by [@zachaysan](https://github.com/zachaysan) in [#46](https://github.com/Flagsmith/flagsmith-ruby-client/pull/46)
126
+
127
+
128
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.0.0...v4.0.1
129
+
130
+ [Changes][v4.0.1]
131
+
132
+
133
+ <a id="v4.0.0"></a>
134
+ ## [Version 4.0.0 (v4.0.0)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v4.0.0) - 2024-01-30
135
+
136
+ ## What's Changed
137
+ * Bump puma from 5.6.4 to 6.3.1 in /example by [@dependabot](https://github.com/dependabot) in [#35](https://github.com/Flagsmith/flagsmith-ruby-client/pull/35)
138
+ * chore: update CI Ruby version to 3.1 by [@khvn26](https://github.com/khvn26) in [#34](https://github.com/Flagsmith/flagsmith-ruby-client/pull/34)
139
+ * fix: Pin the faraday gem file to avoid TypeError superclass mismatch by [@zachaysan](https://github.com/zachaysan) in [#37](https://github.com/Flagsmith/flagsmith-ruby-client/pull/37)
140
+ * feat: Add offline mode for using the client locally by [@zachaysan](https://github.com/zachaysan) in [#38](https://github.com/Flagsmith/flagsmith-ruby-client/pull/38)
141
+ * chore: Remove faraday middleware by [@zachaysan](https://github.com/zachaysan) in [#40](https://github.com/Flagsmith/flagsmith-ruby-client/pull/40)
142
+ * chore: Bump version to 4.0.0 by [@zachaysan](https://github.com/zachaysan) in [#41](https://github.com/Flagsmith/flagsmith-ruby-client/pull/41)
143
+
144
+ ## New Contributors
145
+ * [@zachaysan](https://github.com/zachaysan) made their first contribution in [#37](https://github.com/Flagsmith/flagsmith-ruby-client/pull/37)
146
+
147
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.2.0...v4.0.0
148
+
149
+ [Changes][v4.0.0]
150
+
151
+
152
+ <a id="v3.2.0"></a>
153
+ ## [Version 3.2.0 (v3.2.0)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.2.0) - 2023-07-25
154
+
155
+ ## What's Changed
156
+ * Prevent publish workflow from running by [@matthewelwell](https://github.com/matthewelwell) in [#25](https://github.com/Flagsmith/flagsmith-ruby-client/pull/25)
157
+ * Bump rack from 2.2.3.1 to 2.2.6.4 in /example by [@dependabot](https://github.com/dependabot) in [#27](https://github.com/Flagsmith/flagsmith-ruby-client/pull/27)
158
+ * Update dependencies by [@matthewelwell](https://github.com/matthewelwell) in [#28](https://github.com/Flagsmith/flagsmith-ruby-client/pull/28)
159
+ * ci: add rubocop by [@matthewelwell](https://github.com/matthewelwell) in [#32](https://github.com/Flagsmith/flagsmith-ruby-client/pull/32)
160
+ * feat: implement `IN` operator by [@khvn26](https://github.com/khvn26) in [#31](https://github.com/Flagsmith/flagsmith-ruby-client/pull/31)
161
+
162
+ ## New Contributors
163
+ * [@khvn26](https://github.com/khvn26) made their first contribution in [#31](https://github.com/Flagsmith/flagsmith-ruby-client/pull/31)
164
+
165
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.1.1...v3.2.0
166
+
167
+ [Changes][v3.2.0]
168
+
169
+
170
+ <a id="v3.1.1"></a>
171
+ ## [Version 3.1.1 (v3.1.1)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.1.1) - 2023-02-22
172
+
173
+ ## What's Changed
174
+ * Fix analytics flush timer by [@matthewelwell](https://github.com/matthewelwell) in [#23](https://github.com/Flagsmith/flagsmith-ruby-client/pull/23)
175
+ * Release 3.1.1 by [@matthewelwell](https://github.com/matthewelwell) in [#24](https://github.com/Flagsmith/flagsmith-ruby-client/pull/24)
176
+
177
+
178
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.1.0...v3.1.1
179
+
180
+ [Changes][v3.1.1]
181
+
182
+
183
+ <a id="v3.1.0"></a>
184
+ ## [Version 3.1.0 (v3.1.0)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.1.0) - 2022-11-01
185
+
186
+ ## What's Changed
187
+ * Add modulo operator by [@matthewelwell](https://github.com/matthewelwell) in [#21](https://github.com/Flagsmith/flagsmith-ruby-client/pull/21)
188
+ * Add get identity segments method by [@matthewelwell](https://github.com/matthewelwell) in [#18](https://github.com/Flagsmith/flagsmith-ruby-client/pull/18)
189
+ * Add IS_SET and IS_NOT_SET segment operators by [@matthewelwell](https://github.com/matthewelwell) in [#20](https://github.com/Flagsmith/flagsmith-ruby-client/pull/20)
190
+ * Release 3.1.0 by [@matthewelwell](https://github.com/matthewelwell) in [#19](https://github.com/Flagsmith/flagsmith-ruby-client/pull/19)
191
+
192
+
193
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.2...v3.1.0
194
+
195
+ [Changes][v3.1.0]
196
+
197
+
198
+ <a id="v3.0.2"></a>
199
+ ## [Version 3.0.2 (v3.0.2)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.0.2) - 2022-07-13
200
+
201
+ ## What's Changed
202
+ * Use feature name instead of id for analytics by [@matthewelwell](https://github.com/matthewelwell) in [#17](https://github.com/Flagsmith/flagsmith-ruby-client/pull/17)
203
+ * Bump rack from 2.2.3 to 2.2.3.1 in /example by [@dependabot](https://github.com/dependabot) in [#12](https://github.com/Flagsmith/flagsmith-ruby-client/pull/12)
204
+ * Bump rexml from 3.2.4 to 3.2.5 by [@dependabot](https://github.com/dependabot) in [#8](https://github.com/Flagsmith/flagsmith-ruby-client/pull/8)
205
+ * Release 3.0.2 by [@matthewelwell](https://github.com/matthewelwell) in [#16](https://github.com/Flagsmith/flagsmith-ruby-client/pull/16)
206
+
207
+ ## New Contributors
208
+ * [@dependabot](https://github.com/dependabot) made their first contribution in [#12](https://github.com/Flagsmith/flagsmith-ruby-client/pull/12)
209
+
210
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.1...v3.0.2
211
+
212
+ [Changes][v3.0.2]
213
+
214
+
215
+ <a id="v3.0.1"></a>
216
+ ## [Version 3.0.1 (v3.0.1)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.0.1) - 2022-06-09
217
+
218
+ ## What's Changed
219
+ * Add BaseFlag and DefaultFlag classes by [@matthewelwell](https://github.com/matthewelwell) in [#14](https://github.com/Flagsmith/flagsmith-ruby-client/pull/14)
220
+ * Release 3.0.1 by [@matthewelwell](https://github.com/matthewelwell) in [#15](https://github.com/Flagsmith/flagsmith-ruby-client/pull/15)
221
+
222
+
223
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.0...v3.0.1
224
+
225
+ [Changes][v3.0.1]
226
+
227
+
228
+ <a id="v3.0.0"></a>
229
+ ## [Version 3.0.0 (v3.0.0)](https://github.com/Flagsmith/flagsmith-ruby-client/releases/tag/v3.0.0) - 2022-06-07
230
+
231
+ ## What's Changed
232
+ * Example app by [@byReham](https://github.com/byReham) in [#10](https://github.com/Flagsmith/flagsmith-ruby-client/pull/10)
233
+ * Update default url by [@matthewelwell](https://github.com/matthewelwell) in [#11](https://github.com/Flagsmith/flagsmith-ruby-client/pull/11)
234
+ * Release/3.0.0 by [@byReham](https://github.com/byReham) in [#9](https://github.com/Flagsmith/flagsmith-ruby-client/pull/9)
235
+
236
+ ## New Contributors
237
+ * [@byReham](https://github.com/byReham) made their first contribution in [#10](https://github.com/Flagsmith/flagsmith-ruby-client/pull/10)
238
+ * [@matthewelwell](https://github.com/matthewelwell) made their first contribution in [#11](https://github.com/Flagsmith/flagsmith-ruby-client/pull/11)
239
+
240
+ **Full Changelog**: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v2.0.0...v3.0.0
241
+
242
+ [Changes][v3.0.0]
243
+
244
+
245
+ [v4.3.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.2.0...v4.3.0
246
+ [v4.2.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.1.1...v4.2.0
247
+ [v4.1.1]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.1.0...v4.1.1
248
+ [v4.1.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.0.1...v4.1.0
249
+ [v4.0.1]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v4.0.0...v4.0.1
250
+ [v4.0.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.2.0...v4.0.0
251
+ [v3.2.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.1.1...v3.2.0
252
+ [v3.1.1]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.1.0...v3.1.1
253
+ [v3.1.0]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.2...v3.1.0
254
+ [v3.0.2]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.1...v3.0.2
255
+ [v3.0.1]: https://github.com/Flagsmith/flagsmith-ruby-client/compare/v3.0.0...v3.0.1
256
+ [v3.0.0]: https://github.com/Flagsmith/flagsmith-ruby-client/tree/v3.0.0
257
+
258
+ <!-- Generated by https://github.com/rhysd/changelog-from-release v3.9.0 -->
data/CODEOWNERS ADDED
@@ -0,0 +1 @@
1
+ * @flagsmith/flagsmith-back-end
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flagsmith (4.3.0)
4
+ flagsmith (5.0.1)
5
5
  faraday (>= 2.0.1)
6
6
  faraday-retry
7
+ jsonpath (~> 1.1)
7
8
  semantic
8
9
 
9
10
  GEM
@@ -13,18 +14,24 @@ GEM
13
14
  byebug (11.1.3)
14
15
  coderay (1.1.3)
15
16
  diff-lcs (1.5.0)
16
- faraday (2.9.0)
17
- faraday-net_http (>= 2.0, < 3.2)
18
- faraday-net_http (3.1.0)
19
- net-http
17
+ faraday (2.14.3)
18
+ faraday-net_http (>= 2.0, < 3.5)
19
+ json
20
+ logger
21
+ faraday-net_http (3.4.4)
22
+ net-http (~> 0.5)
20
23
  faraday-retry (2.2.1)
21
24
  faraday (~> 2.0)
22
25
  gem-release (2.2.2)
23
- json (2.7.1)
26
+ json (2.21.2)
27
+ jsonpath (1.1.5)
28
+ multi_json
24
29
  language_server-protocol (3.17.0.3)
30
+ logger (1.7.0)
25
31
  method_source (1.0.0)
26
- net-http (0.4.1)
27
- uri
32
+ multi_json (1.17.0)
33
+ net-http (0.9.1)
34
+ uri (>= 0.11.1)
28
35
  parallel (1.24.0)
29
36
  parser (3.3.0.4)
30
37
  ast (~> 2.4.1)
@@ -39,7 +46,7 @@ GEM
39
46
  rainbow (3.1.1)
40
47
  rake (13.1.0)
41
48
  regexp_parser (2.9.0)
42
- rexml (3.3.9)
49
+ rexml (3.4.2)
43
50
  rspec (3.12.0)
44
51
  rspec-core (~> 3.12.0)
45
52
  rspec-expectations (~> 3.12.0)
@@ -69,7 +76,7 @@ GEM
69
76
  ruby-progressbar (1.13.0)
70
77
  semantic (1.6.1)
71
78
  unicode-display_width (2.5.0)
72
- uri (0.13.0)
79
+ uri (1.1.1)
73
80
 
74
81
  PLATFORMS
75
82
  ruby
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- <img width="100%" src="https://github.com/Flagsmith/flagsmith/raw/main/static-files/hero.png"/>
2
-
3
1
  # Flagsmith Ruby Client
4
2
 
5
3
  The SDK clients for Ruby [https://www.flagsmith.com/](https://www.flagsmith.com/). Flagsmith allows you to manage feature flags and remote config across multiple projects, environments and organizations.
@@ -5,84 +5,143 @@ require 'securerandom'
5
5
 
6
6
  require_relative 'environments/models'
7
7
  require_relative 'features/models'
8
+ require_relative 'features/constants'
8
9
  require_relative 'identities/models'
9
10
  require_relative 'organisations/models'
10
11
  require_relative 'projects/models'
11
12
  require_relative 'segments/evaluator'
12
13
  require_relative 'segments/models'
13
14
  require_relative 'utils/hash_func'
15
+ require_relative 'mappers'
14
16
 
15
17
  module Flagsmith
18
+ # Core evaluation logic for feature flags
16
19
  module Engine
17
- # Flags engine methods
18
- class Engine
19
- include Flagsmith::Engine::Segments::Evaluator
20
-
21
- def get_identity_feature_state(environment, identity, feature_name, override_traits = nil)
22
- feature_states = get_identity_feature_states_dict(environment, identity, override_traits).values
20
+ extend self
21
+ include Flagsmith::Engine::Utils::HashFunc
22
+ include Flagsmith::Engine::Features::TargetingReasons
23
+ include Flagsmith::Engine::Segments::Evaluator
24
+
25
+ # Get evaluation result from evaluation context
26
+ #
27
+ # @param evaluation_context [Hash] The evaluation context
28
+ # @return [Hash] Evaluation result with flags and segments
29
+ def get_evaluation_result(evaluation_context)
30
+ evaluation_context = get_enriched_context(evaluation_context)
31
+ segments, segment_overrides = evaluate_segments(evaluation_context)
32
+ flags = evaluate_features(evaluation_context, segment_overrides)
33
+ {
34
+ flags: flags,
35
+ segments: segments
36
+ }
37
+ end
23
38
 
24
- feature_state = feature_states.find { |f| f.feature.name == feature_name }
39
+ # Returns { segments: EvaluationResultSegments; segmentOverrides: Record<string, SegmentOverride>; }
40
+ def evaluate_segments(evaluation_context)
41
+ return [], {} if evaluation_context[:segments].nil?
25
42
 
26
- raise Flagsmith::FeatureStateNotFound, 'Feature State Not Found' if feature_state.nil?
43
+ identity_segments = get_segments_from_context(evaluation_context)
27
44
 
28
- feature_state
45
+ segments = identity_segments.map do |segment|
46
+ { name: segment[:name], metadata: segment[:metadata] }.compact
29
47
  end
30
48
 
31
- def get_identity_feature_states(environment, identity, override_traits = nil)
32
- feature_states = get_identity_feature_states_dict(environment, identity, override_traits).values
49
+ segment_overrides = process_segment_overrides(identity_segments)
50
+
51
+ [segments, segment_overrides]
52
+ end
33
53
 
34
- return feature_states.select(&:enabled?) if environment.project.hide_disabled_flags
54
+ # Returns Record<string: override.name, SegmentOverride>
55
+ def process_segment_overrides(identity_segments) # rubocop:disable Metrics/MethodLength
56
+ segment_overrides = {}
35
57
 
36
- feature_states
58
+ identity_segments.each do |segment|
59
+ Array(segment[:overrides]).each do |override|
60
+ next unless should_apply_override(override, segment_overrides)
61
+
62
+ segment_overrides[override[:name]] = {
63
+ feature: override,
64
+ segment_name: segment[:name]
65
+ }
66
+ end
37
67
  end
38
68
 
39
- def get_environment_feature_state(environment, feature_name)
40
- features_state = environment.feature_states.find { |f| f.feature.name == feature_name }
69
+ segment_overrides
70
+ end
41
71
 
42
- raise Flagsmith::FeatureStateNotFound, 'Feature State Not Found' if features_state.nil?
72
+ def evaluate_features(evaluation_context, segment_overrides)
73
+ identity_key = get_identity_key(evaluation_context)
43
74
 
44
- features_state
75
+ (evaluation_context[:features] || {}).each_with_object({}) do |(_, feature), flags|
76
+ segment_override = segment_overrides[feature[:name]]
77
+ final_feature = segment_override ? segment_override[:feature] : feature
78
+
79
+ flag_result = build_flag_result(final_feature, identity_key, segment_override)
80
+ flags[final_feature[:name].to_sym] = flag_result
45
81
  end
82
+ end
46
83
 
47
- def get_environment_feature_states(environment)
48
- return environment.feature_states.select(&:enabled?) if environment.project.hide_disabled_flags
84
+ # Returns {value: any; reason?: string}
85
+ def evaluate_feature_value(feature, identity_key = nil)
86
+ return get_multivariate_feature_value(feature, identity_key) if feature[:variants]&.any? && identity_key
49
87
 
50
- environment.feature_states
51
- end
88
+ { value: feature[:value], reason: nil }
89
+ end
52
90
 
53
- private
91
+ # Returns {value: any; reason?: string}
92
+ def get_multivariate_feature_value(feature, identity_key)
93
+ percentage_value = hashed_percentage_for_object_ids([feature[:key], identity_key])
94
+ sorted_variants = (feature[:variants] || []).sort_by { |v| v[:priority] || WEAKEST_PRIORITY }
54
95
 
55
- def get_identity_feature_states_dict(environment, identity, override_traits = nil)
56
- # Get feature states from the environment
57
- feature_states = {}
58
- override = ->(fs) { feature_states[fs.feature.id] = fs }
59
- environment.feature_states.each(&override)
96
+ variant = find_matching_variant(sorted_variants, percentage_value)
97
+ variant || { value: feature[:value], reason: nil }
98
+ end
60
99
 
61
- override_by_matching_segments(environment, identity, override_traits) do |fs|
62
- override.call(fs) unless higher_segment_priority?(feature_states, fs)
63
- end
100
+ def find_matching_variant(sorted_variants, percentage_value)
101
+ start_percentage = 0
102
+ sorted_variants.each do |variant|
103
+ limit = start_percentage + variant[:weight]
104
+ return { value: variant[:value], reason: "#{TARGETING_REASON_SPLIT}; weight=#{variant[:weight]}" } if start_percentage <= percentage_value && percentage_value < limit
64
105
 
65
- # Override with any feature states defined directly the identity
66
- identity.identity_features.each(&override)
67
- feature_states
106
+ start_percentage = limit
68
107
  end
108
+ nil
109
+ end
69
110
 
70
- # Override with any feature states defined by matching segments
71
- def override_by_matching_segments(environment, identity, override_traits)
72
- identity_segments = get_identity_segments(environment, identity, override_traits)
73
- identity_segments.each do |matching_segment|
74
- matching_segment.feature_states.each do |feature_state|
75
- yield feature_state if block_given?
76
- end
77
- end
78
- end
111
+ # returns boolean
112
+ def should_apply_override(override, existing_overrides)
113
+ current_override = existing_overrides[override[:name]]
114
+ !current_override || stronger_priority?(override[:priority], current_override[:feature][:priority])
115
+ end
79
116
 
80
- def higher_segment_priority?(collection, feature_state)
81
- collection.key?(feature_state.feature.id) &&
82
- collection[feature_state.feature.id].higher_segment_priority?(
83
- feature_state
84
- )
85
- end
117
+ private
118
+
119
+ def build_flag_result(feature, identity_key, segment_override)
120
+ evaluated = evaluate_feature_value(feature, identity_key)
121
+
122
+ flag_result = {
123
+ name: feature[:name],
124
+ enabled: feature[:enabled],
125
+ value: evaluated[:value],
126
+ reason: evaluated[:reason] || (segment_override ? "#{TARGETING_REASON_TARGETING_MATCH}; segment=#{segment_override[:segment_name]}" : TARGETING_REASON_DEFAULT)
127
+ }
128
+
129
+ flag_result[:metadata] = feature[:metadata] if feature[:metadata]
130
+ flag_result
131
+ end
132
+
133
+ # Extract identity key from evaluation context
134
+ #
135
+ # @param evaluation_context [Hash] The evaluation context
136
+ # @return [String, nil] The identity key or nil if no identity
137
+ def get_identity_key(evaluation_context)
138
+ return nil unless evaluation_context[:identity]
139
+
140
+ evaluation_context[:identity][:key]
141
+ end
142
+
143
+ def stronger_priority?(priority_a, priority_b)
144
+ (priority_a || WEAKEST_PRIORITY) < (priority_b || WEAKEST_PRIORITY)
86
145
  end
87
146
  end
88
147
  end
@@ -4,17 +4,20 @@ module Flagsmith
4
4
  module Engine
5
5
  # EnvironmentModel
6
6
  class Environment
7
- attr_reader :id, :api_key
7
+ attr_reader :id, :api_key, :name
8
8
  attr_accessor :project, :feature_states, :amplitude_config, :segment_config,
9
9
  :mixpanel_config, :heap_config, :identity_overrides
10
10
 
11
- def initialize(id:, api_key:, project:, feature_states: [], identity_overrides: [])
11
+ # rubocop:disable Metrics/ParameterLists
12
+ def initialize(id:, api_key:, project:, name: nil, feature_states: [], identity_overrides: [])
12
13
  @id = id
13
14
  @api_key = api_key
15
+ @name = name
14
16
  @project = project
15
17
  @feature_states = feature_states
16
18
  @identity_overrides = identity_overrides
17
19
  end
20
+ # rubocop:enable Metrics/ParameterLists
18
21
 
19
22
  class << self
20
23
  # rubocop:disable Metrics/MethodLength
@@ -28,7 +31,7 @@ module Flagsmith
28
31
  Flagsmith::Engine::Identity.build(io)
29
32
  end
30
33
 
31
- new(**json.slice(:id, :api_key).merge(
34
+ new(**json.slice(:id, :api_key, :name).merge(
32
35
  project: project,
33
36
  feature_states: feature_states,
34
37
  identity_overrides: identity_overrides