splitclient-rb 1.0.2.wip → 8.11.1.pre.rc1-java

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.
Files changed (210) hide show
  1. checksums.yaml +5 -5
  2. data/.github/CODEOWNERS +1 -0
  3. data/.github/pull_request_template.md +9 -0
  4. data/.github/workflows/ci.yml +90 -0
  5. data/.github/workflows/update-license-year.yml +45 -0
  6. data/.gitignore +20 -0
  7. data/.rubocop.yml +76 -0
  8. data/.simplecov +1 -0
  9. data/CHANGES.txt +361 -2
  10. data/CONTRIBUTORS-GUIDE.md +49 -0
  11. data/Gemfile +2 -0
  12. data/LICENSE +3 -36
  13. data/NOTICE.txt +5 -0
  14. data/README.md +59 -127
  15. data/Rakefile +27 -3
  16. data/ext/murmurhash/MurmurHash3.java +302 -0
  17. data/gemfiles/faraday_after_0.13.gemfile +7 -0
  18. data/gemfiles/faraday_before_0.13.gemfile +8 -0
  19. data/lib/murmurhash/base.rb +58 -0
  20. data/lib/murmurhash/murmurhash.jar +0 -0
  21. data/lib/murmurhash/murmurhash_mri.rb +3 -0
  22. data/lib/splitclient-rb/cache/adapters/cache_adapter.rb +130 -0
  23. data/lib/splitclient-rb/cache/adapters/memory_adapter.rb +12 -0
  24. data/lib/splitclient-rb/cache/adapters/memory_adapters/map_adapter.rb +137 -0
  25. data/lib/splitclient-rb/cache/adapters/memory_adapters/queue_adapter.rb +53 -0
  26. data/lib/splitclient-rb/cache/adapters/redis_adapter.rb +178 -0
  27. data/lib/splitclient-rb/cache/fetchers/segment_fetcher.rb +83 -0
  28. data/lib/splitclient-rb/cache/fetchers/split_fetcher.rb +70 -0
  29. data/lib/splitclient-rb/cache/filter/bloom_filter.rb +67 -0
  30. data/lib/splitclient-rb/cache/filter/filter_adapter.rb +32 -0
  31. data/lib/splitclient-rb/cache/filter/flag_set_filter.rb +40 -0
  32. data/lib/splitclient-rb/cache/hashers/impression_hasher.rb +34 -0
  33. data/lib/splitclient-rb/cache/observers/impression_observer.rb +22 -0
  34. data/lib/splitclient-rb/cache/observers/noop_impression_observer.rb +10 -0
  35. data/lib/splitclient-rb/cache/repositories/events/memory_repository.rb +45 -0
  36. data/lib/splitclient-rb/cache/repositories/events/redis_repository.rb +35 -0
  37. data/lib/splitclient-rb/cache/repositories/events_repository.rb +61 -0
  38. data/lib/splitclient-rb/cache/repositories/flag_sets/memory_repository.rb +40 -0
  39. data/lib/splitclient-rb/cache/repositories/flag_sets/redis_repository.rb +49 -0
  40. data/lib/splitclient-rb/cache/repositories/impressions/memory_repository.rb +56 -0
  41. data/lib/splitclient-rb/cache/repositories/impressions/redis_repository.rb +57 -0
  42. data/lib/splitclient-rb/cache/repositories/impressions_repository.rb +23 -0
  43. data/lib/splitclient-rb/cache/repositories/repository.rb +24 -0
  44. data/lib/splitclient-rb/cache/repositories/rule_based_segments_repository.rb +136 -0
  45. data/lib/splitclient-rb/cache/repositories/segments_repository.rb +124 -0
  46. data/lib/splitclient-rb/cache/repositories/splits_repository.rb +296 -0
  47. data/lib/splitclient-rb/cache/routers/impression_router.rb +60 -0
  48. data/lib/splitclient-rb/cache/senders/events_sender.rb +42 -0
  49. data/lib/splitclient-rb/cache/senders/impressions_adapter/memory_sender.rb +71 -0
  50. data/lib/splitclient-rb/cache/senders/impressions_adapter/redis_sender.rb +69 -0
  51. data/lib/splitclient-rb/cache/senders/impressions_count_sender.rb +43 -0
  52. data/lib/splitclient-rb/cache/senders/impressions_formatter.rb +95 -0
  53. data/lib/splitclient-rb/cache/senders/impressions_sender.rb +52 -0
  54. data/lib/splitclient-rb/cache/senders/impressions_sender_adapter.rb +21 -0
  55. data/lib/splitclient-rb/cache/senders/localhost_repo_cleaner.rb +47 -0
  56. data/lib/splitclient-rb/cache/stores/localhost_split_builder.rb +95 -0
  57. data/lib/splitclient-rb/cache/stores/localhost_split_store.rb +110 -0
  58. data/lib/splitclient-rb/cache/stores/store_utils.rb +13 -0
  59. data/lib/splitclient-rb/clients/split_client.rb +530 -0
  60. data/lib/splitclient-rb/constants.rb +16 -0
  61. data/lib/splitclient-rb/engine/api/client.rb +87 -0
  62. data/lib/splitclient-rb/engine/api/events.rb +57 -0
  63. data/lib/splitclient-rb/engine/api/faraday_middleware/gzip.rb +58 -0
  64. data/lib/splitclient-rb/engine/api/impressions.rb +79 -0
  65. data/lib/splitclient-rb/engine/api/segments.rb +78 -0
  66. data/lib/splitclient-rb/engine/api/splits.rb +139 -0
  67. data/lib/splitclient-rb/engine/api/telemetry_api.rb +47 -0
  68. data/lib/splitclient-rb/engine/auth_api_client.rb +100 -0
  69. data/lib/splitclient-rb/engine/back_off.rb +26 -0
  70. data/lib/splitclient-rb/engine/common/impressions_counter.rb +45 -0
  71. data/lib/splitclient-rb/engine/common/impressions_manager.rb +165 -0
  72. data/lib/splitclient-rb/engine/common/noop_impressions_counter.rb +27 -0
  73. data/lib/{splitclient-engine → splitclient-rb/engine}/evaluator/splitter.rb +35 -22
  74. data/lib/splitclient-rb/engine/events/events_delivery.rb +20 -0
  75. data/lib/splitclient-rb/engine/events/events_manager.rb +194 -0
  76. data/lib/splitclient-rb/engine/events/events_manager_config.rb +96 -0
  77. data/lib/splitclient-rb/engine/events/events_task.rb +50 -0
  78. data/lib/splitclient-rb/engine/events/noop_events_queue.rb +13 -0
  79. data/lib/splitclient-rb/engine/fallback_treatment_calculator.rb +48 -0
  80. data/lib/splitclient-rb/engine/impressions/noop_unique_keys_tracker.rb +17 -0
  81. data/lib/splitclient-rb/engine/impressions/unique_keys_tracker.rb +144 -0
  82. data/lib/{splitclient-engine → splitclient-rb/engine}/matchers/all_keys_matcher.rb +10 -21
  83. data/lib/splitclient-rb/engine/matchers/between_matcher.rb +47 -0
  84. data/lib/splitclient-rb/engine/matchers/between_semver_matcher.rb +33 -0
  85. data/lib/{splitclient-engine → splitclient-rb/engine}/matchers/combiners.rb +4 -6
  86. data/lib/splitclient-rb/engine/matchers/combining_matcher.rb +80 -0
  87. data/lib/splitclient-rb/engine/matchers/contains_all_matcher.rb +20 -0
  88. data/lib/splitclient-rb/engine/matchers/contains_any_matcher.rb +16 -0
  89. data/lib/splitclient-rb/engine/matchers/contains_matcher.rb +43 -0
  90. data/lib/splitclient-rb/engine/matchers/dependency_matcher.rb +26 -0
  91. data/lib/splitclient-rb/engine/matchers/ends_with_matcher.rb +42 -0
  92. data/lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb +37 -0
  93. data/lib/splitclient-rb/engine/matchers/equal_to_matcher.rb +44 -0
  94. data/lib/splitclient-rb/engine/matchers/equal_to_semver_matcher.rb +28 -0
  95. data/lib/splitclient-rb/engine/matchers/equal_to_set_matcher.rb +16 -0
  96. data/lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_matcher.rb +43 -0
  97. data/lib/splitclient-rb/engine/matchers/greater_than_or_equal_to_semver_matcher.rb +28 -0
  98. data/lib/splitclient-rb/engine/matchers/in_list_semver_matcher.rb +36 -0
  99. data/lib/splitclient-rb/engine/matchers/less_than_or_equal_to_matcher.rb +43 -0
  100. data/lib/splitclient-rb/engine/matchers/less_than_or_equal_to_semver_matcher.rb +28 -0
  101. data/lib/splitclient-rb/engine/matchers/matcher.rb +52 -0
  102. data/lib/splitclient-rb/engine/matchers/matches_string_matcher.rb +29 -0
  103. data/lib/splitclient-rb/engine/matchers/negation_matcher.rb +47 -0
  104. data/lib/splitclient-rb/engine/matchers/part_of_set_matcher.rb +22 -0
  105. data/lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb +31 -0
  106. data/lib/splitclient-rb/engine/matchers/rule_based_segment_matcher.rb +78 -0
  107. data/lib/splitclient-rb/engine/matchers/semver.rb +201 -0
  108. data/lib/splitclient-rb/engine/matchers/set_matcher.rb +27 -0
  109. data/lib/splitclient-rb/engine/matchers/starts_with_matcher.rb +40 -0
  110. data/lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb +28 -0
  111. data/lib/splitclient-rb/engine/matchers/whitelist_matcher.rb +66 -0
  112. data/lib/splitclient-rb/engine/metrics/binary_search_latency_tracker.rb +66 -0
  113. data/lib/splitclient-rb/engine/models/evaluation_options.rb +9 -0
  114. data/lib/splitclient-rb/engine/models/event_active_subscriptions.rb +14 -0
  115. data/lib/splitclient-rb/engine/models/events_metadata.rb +10 -0
  116. data/lib/splitclient-rb/engine/models/fallback_treatment.rb +11 -0
  117. data/lib/splitclient-rb/engine/models/fallback_treatments_configuration.rb +36 -0
  118. data/lib/splitclient-rb/engine/models/label.rb +10 -0
  119. data/lib/splitclient-rb/engine/models/sdk_event.rb +4 -0
  120. data/lib/splitclient-rb/engine/models/sdk_event_type.rb +4 -0
  121. data/lib/splitclient-rb/engine/models/sdk_internal_event.rb +8 -0
  122. data/lib/splitclient-rb/engine/models/sdk_internal_event_notification.rb +16 -0
  123. data/lib/splitclient-rb/engine/models/segment_type.rb +4 -0
  124. data/lib/splitclient-rb/engine/models/split.rb +17 -0
  125. data/lib/splitclient-rb/engine/models/split_http_response.rb +19 -0
  126. data/lib/splitclient-rb/engine/models/treatment.rb +3 -0
  127. data/lib/splitclient-rb/engine/models/valid_sdk_event.rb +14 -0
  128. data/lib/splitclient-rb/engine/parser/condition.rb +271 -0
  129. data/lib/splitclient-rb/engine/parser/evaluator.rb +112 -0
  130. data/lib/{splitclient-engine → splitclient-rb/engine}/parser/partition.rb +2 -4
  131. data/lib/splitclient-rb/engine/push_manager.rb +66 -0
  132. data/lib/splitclient-rb/engine/status_manager.rb +39 -0
  133. data/lib/splitclient-rb/engine/sync_manager.rb +183 -0
  134. data/lib/splitclient-rb/engine/synchronizer.rb +231 -0
  135. data/lib/splitclient-rb/exceptions.rb +26 -0
  136. data/lib/splitclient-rb/helpers/decryption_helper.rb +25 -0
  137. data/lib/splitclient-rb/helpers/evaluator_helper.rb +37 -0
  138. data/lib/splitclient-rb/helpers/repository_helper.rb +61 -0
  139. data/lib/splitclient-rb/helpers/thread_helper.rb +24 -0
  140. data/lib/splitclient-rb/helpers/util.rb +26 -0
  141. data/lib/splitclient-rb/managers/split_manager.rb +121 -0
  142. data/lib/splitclient-rb/spec.rb +9 -0
  143. data/lib/splitclient-rb/split_config.rb +591 -47
  144. data/lib/splitclient-rb/split_factory.rb +284 -0
  145. data/lib/splitclient-rb/split_factory_builder.rb +7 -0
  146. data/lib/splitclient-rb/split_factory_registry.rb +63 -0
  147. data/lib/splitclient-rb/split_logger.rb +23 -0
  148. data/lib/splitclient-rb/sse/event_source/client.rb +264 -0
  149. data/lib/splitclient-rb/sse/event_source/event_parser.rb +65 -0
  150. data/lib/splitclient-rb/sse/event_source/event_types.rb +15 -0
  151. data/lib/splitclient-rb/sse/event_source/stream_data.rb +22 -0
  152. data/lib/splitclient-rb/sse/notification_manager_keeper.rb +84 -0
  153. data/lib/splitclient-rb/sse/notification_processor.rb +48 -0
  154. data/lib/splitclient-rb/sse/sse_handler.rb +44 -0
  155. data/lib/splitclient-rb/sse/workers/segments_worker.rb +62 -0
  156. data/lib/splitclient-rb/sse/workers/splits_worker.rb +153 -0
  157. data/lib/splitclient-rb/telemetry/domain/constants.rb +48 -0
  158. data/lib/splitclient-rb/telemetry/domain/structs.rb +35 -0
  159. data/lib/splitclient-rb/telemetry/evaluation_consumer.rb +14 -0
  160. data/lib/splitclient-rb/telemetry/evaluation_producer.rb +21 -0
  161. data/lib/splitclient-rb/telemetry/init_consumer.rb +14 -0
  162. data/lib/splitclient-rb/telemetry/init_producer.rb +19 -0
  163. data/lib/splitclient-rb/telemetry/memory/memory_evaluation_consumer.rb +32 -0
  164. data/lib/splitclient-rb/telemetry/memory/memory_evaluation_producer.rb +24 -0
  165. data/lib/splitclient-rb/telemetry/memory/memory_init_consumer.rb +28 -0
  166. data/lib/splitclient-rb/telemetry/memory/memory_init_producer.rb +34 -0
  167. data/lib/splitclient-rb/telemetry/memory/memory_runtime_consumer.rb +119 -0
  168. data/lib/splitclient-rb/telemetry/memory/memory_runtime_producer.rb +87 -0
  169. data/lib/splitclient-rb/telemetry/memory/memory_synchronizer.rb +213 -0
  170. data/lib/splitclient-rb/telemetry/redis/redis_evaluation_producer.rb +38 -0
  171. data/lib/splitclient-rb/telemetry/redis/redis_init_producer.rb +37 -0
  172. data/lib/splitclient-rb/telemetry/redis/redis_synchronizer.rb +27 -0
  173. data/lib/splitclient-rb/telemetry/runtime_consumer.rb +25 -0
  174. data/lib/splitclient-rb/telemetry/runtime_producer.rb +25 -0
  175. data/lib/splitclient-rb/telemetry/storages/memory.rb +159 -0
  176. data/lib/splitclient-rb/telemetry/sync_task.rb +36 -0
  177. data/lib/splitclient-rb/telemetry/synchronizer.rb +33 -0
  178. data/lib/splitclient-rb/utilitites.rb +49 -0
  179. data/lib/splitclient-rb/validators.rb +361 -0
  180. data/lib/splitclient-rb/version.rb +1 -1
  181. data/lib/splitclient-rb.rb +177 -25
  182. data/sonar-project.properties +6 -0
  183. data/splitclient-rb.gemspec +53 -26
  184. data/tasks/benchmark_get_treatment.rake +31 -17
  185. data/tasks/irb.rake +6 -0
  186. metadata +411 -86
  187. data/NEWS +0 -9
  188. data/lib/splitclient-cache/local_store.rb +0 -45
  189. data/lib/splitclient-engine/impressions/impressions.rb +0 -79
  190. data/lib/splitclient-engine/matchers/between_matcher.rb +0 -48
  191. data/lib/splitclient-engine/matchers/combining_matcher.rb +0 -94
  192. data/lib/splitclient-engine/matchers/equal_to_matcher.rb +0 -48
  193. data/lib/splitclient-engine/matchers/greater_than_or_equal_to_matcher.rb +0 -48
  194. data/lib/splitclient-engine/matchers/less_than_or_equal_to_matcher.rb +0 -48
  195. data/lib/splitclient-engine/matchers/negation_matcher.rb +0 -54
  196. data/lib/splitclient-engine/matchers/user_defined_segment_matcher.rb +0 -61
  197. data/lib/splitclient-engine/matchers/whitelist_matcher.rb +0 -64
  198. data/lib/splitclient-engine/metrics/binary_search_latency_tracker.rb +0 -122
  199. data/lib/splitclient-engine/metrics/metrics.rb +0 -158
  200. data/lib/splitclient-engine/parser/condition.rb +0 -143
  201. data/lib/splitclient-engine/parser/segment.rb +0 -84
  202. data/lib/splitclient-engine/parser/segment_parser.rb +0 -46
  203. data/lib/splitclient-engine/parser/split.rb +0 -68
  204. data/lib/splitclient-engine/parser/split_adapter.rb +0 -433
  205. data/lib/splitclient-engine/parser/split_parser.rb +0 -139
  206. data/lib/splitclient-engine/partitions/treatments.rb +0 -40
  207. data/lib/splitclient-rb/split_client.rb +0 -156
  208. data/lib/splitclient-rb_utilitites.rb +0 -26
  209. data/tasks/console.rake +0 -4
  210. data/tasks/rspec.rake +0 -3
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in splitclient-rb.gemspec
data/LICENSE CHANGED
@@ -1,17 +1,12 @@
1
- Apache License
1
+ Apache License
2
2
  Version 2.0, January 2004
3
3
  http://www.apache.org/licenses/
4
-
5
4
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
5
  1. Definitions.
8
-
9
6
  "License" shall mean the terms and conditions for use, reproduction,
10
7
  and distribution as defined by Sections 1 through 9 of this document.
11
-
12
8
  "Licensor" shall mean the copyright owner or entity authorized by
13
9
  the copyright owner that is granting the License.
14
-
15
10
  "Legal Entity" shall mean the union of the acting entity and all
16
11
  other entities that control, are controlled by, or are under common
17
12
  control with that entity. For the purposes of this definition,
@@ -19,24 +14,19 @@
19
14
  direction or management of such entity, whether by contract or
20
15
  otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
16
  outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
17
  "You" (or "Your") shall mean an individual or Legal Entity
24
18
  exercising permissions granted by this License.
25
-
26
19
  "Source" form shall mean the preferred form for making modifications,
27
20
  including but not limited to software source code, documentation
28
21
  source, and configuration files.
29
-
30
22
  "Object" form shall mean any form resulting from mechanical
31
23
  transformation or translation of a Source form, including but
32
24
  not limited to compiled object code, generated documentation,
33
25
  and conversions to other media types.
34
-
35
26
  "Work" shall mean the work of authorship, whether in Source or
36
27
  Object form, made available under the License, as indicated by a
37
28
  copyright notice that is included in or attached to the work
38
29
  (an example is provided in the Appendix below).
39
-
40
30
  "Derivative Works" shall mean any work, whether in Source or Object
41
31
  form, that is based on (or derived from) the Work and for which the
42
32
  editorial revisions, annotations, elaborations, or other modifications
@@ -44,7 +34,6 @@
44
34
  of this License, Derivative Works shall not include works that remain
45
35
  separable from, or merely link (or bind by name) to the interfaces of,
46
36
  the Work and Derivative Works thereof.
47
-
48
37
  "Contribution" shall mean any work of authorship, including
49
38
  the original version of the Work and any modifications or additions
50
39
  to that Work or Derivative Works thereof, that is intentionally
@@ -58,18 +47,15 @@
58
47
  Licensor for the purpose of discussing and improving the Work, but
59
48
  excluding communication that is conspicuously marked or otherwise
60
49
  designated in writing by the copyright owner as "Not a Contribution."
61
-
62
50
  "Contributor" shall mean Licensor and any individual or Legal Entity
63
51
  on behalf of whom a Contribution has been received by Licensor and
64
52
  subsequently incorporated within the Work.
65
-
66
53
  2. Grant of Copyright License. Subject to the terms and conditions of
67
54
  this License, each Contributor hereby grants to You a perpetual,
68
55
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
56
  copyright license to reproduce, prepare Derivative Works of,
70
57
  publicly display, publicly perform, sublicense, and distribute the
71
58
  Work and such Derivative Works in Source or Object form.
72
-
73
59
  3. Grant of Patent License. Subject to the terms and conditions of
74
60
  this License, each Contributor hereby grants to You a perpetual,
75
61
  worldwide, non-exclusive, no-charge, royalty-free, irrevocable
@@ -85,24 +71,19 @@
85
71
  or contributory patent infringement, then any patent licenses
86
72
  granted to You under this License for that Work shall terminate
87
73
  as of the date such litigation is filed.
88
-
89
74
  4. Redistribution. You may reproduce and distribute copies of the
90
75
  Work or Derivative Works thereof in any medium, with or without
91
76
  modifications, and in Source or Object form, provided that You
92
77
  meet the following conditions:
93
-
94
78
  (a) You must give any other recipients of the Work or
95
79
  Derivative Works a copy of this License; and
96
-
97
80
  (b) You must cause any modified files to carry prominent notices
98
81
  stating that You changed the files; and
99
-
100
82
  (c) You must retain, in the Source form of any Derivative Works
101
83
  that You distribute, all copyright, patent, trademark, and
102
84
  attribution notices from the Source form of the Work,
103
85
  excluding those notices that do not pertain to any part of
104
86
  the Derivative Works; and
105
-
106
87
  (d) If the Work includes a "NOTICE" text file as part of its
107
88
  distribution, then any Derivative Works that You distribute must
108
89
  include a readable copy of the attribution notices contained
@@ -119,14 +100,12 @@
119
100
  or as an addendum to the NOTICE text from the Work, provided
120
101
  that such additional attribution notices cannot be construed
121
102
  as modifying the License.
122
-
123
103
  You may add Your own copyright statement to Your modifications and
124
104
  may provide additional or different license terms and conditions
125
105
  for use, reproduction, or distribution of Your modifications, or
126
106
  for any such Derivative Works as a whole, provided Your use,
127
107
  reproduction, and distribution of the Work otherwise complies with
128
108
  the conditions stated in this License.
129
-
130
109
  5. Submission of Contributions. Unless You explicitly state otherwise,
131
110
  any Contribution intentionally submitted for inclusion in the Work
132
111
  by You to the Licensor shall be under the terms and conditions of
@@ -134,12 +113,10 @@
134
113
  Notwithstanding the above, nothing herein shall supersede or modify
135
114
  the terms of any separate license agreement you may have executed
136
115
  with Licensor regarding such Contributions.
137
-
138
116
  6. Trademarks. This License does not grant permission to use the trade
139
117
  names, trademarks, service marks, or product names of the Licensor,
140
118
  except as required for reasonable and customary use in describing the
141
119
  origin of the Work and reproducing the content of the NOTICE file.
142
-
143
120
  7. Disclaimer of Warranty. Unless required by applicable law or
144
121
  agreed to in writing, Licensor provides the Work (and each
145
122
  Contributor provides its Contributions) on an "AS IS" BASIS,
@@ -149,7 +126,6 @@
149
126
  PARTICULAR PURPOSE. You are solely responsible for determining the
150
127
  appropriateness of using or redistributing the Work and assume any
151
128
  risks associated with Your exercise of permissions under this License.
152
-
153
129
  8. Limitation of Liability. In no event and under no legal theory,
154
130
  whether in tort (including negligence), contract, or otherwise,
155
131
  unless required by applicable law (such as deliberate and grossly
@@ -161,7 +137,6 @@
161
137
  work stoppage, computer failure or malfunction, or any and all
162
138
  other commercial damages or losses), even if such Contributor
163
139
  has been advised of the possibility of such damages.
164
-
165
140
  9. Accepting Warranty or Additional Liability. While redistributing
166
141
  the Work or Derivative Works thereof, You may choose to offer,
167
142
  and charge a fee for, acceptance of support, warranty, indemnity,
@@ -172,31 +147,23 @@
172
147
  defend, and hold each Contributor harmless for any liability
173
148
  incurred by, or claims asserted against, such Contributor by reason
174
149
  of your accepting any such warranty or additional liability.
175
-
176
150
  END OF TERMS AND CONDITIONS
177
-
178
151
  APPENDIX: How to apply the Apache License to your work.
179
-
180
152
  To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "{}"
153
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
154
  replaced with your own identifying information. (Don't include
183
155
  the brackets!) The text should be enclosed in the appropriate
184
156
  comment syntax for the file format. We also recommend that a
185
157
  file or class name and description of purpose be included on the
186
158
  same "printed page" as the copyright notice for easier
187
159
  identification within third-party archives.
188
-
189
- Copyright {yyyy} {name of copyright owner}
190
-
160
+ Copyright 2025 Harness Corporation
191
161
  Licensed under the Apache License, Version 2.0 (the "License");
192
162
  you may not use this file except in compliance with the License.
193
163
  You may obtain a copy of the License at
194
-
195
164
  http://www.apache.org/licenses/LICENSE-2.0
196
-
197
165
  Unless required by applicable law or agreed to in writing, software
198
166
  distributed under the License is distributed on an "AS IS" BASIS,
199
167
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
168
  See the License for the specific language governing permissions and
201
169
  limitations under the License.
202
-
data/NOTICE.txt ADDED
@@ -0,0 +1,5 @@
1
+ Harness Feature Management JavaScript SDK Copyright 2024-2026 Harness Inc.
2
+
3
+ This product includes software developed at Harness Inc. (https://harness.io/).
4
+
5
+ This product includes software originally developed by Split Software, Inc. (https://www.split.io/). Copyright 2016-2024 Split Software, Inc.
data/README.md CHANGED
@@ -1,152 +1,84 @@
1
- # splitclient-rb
1
+ # Split SDK for Ruby
2
+ [![build status](https://github.com/splitio/ruby-client/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/splitio/ruby-client/actions)
3
+ [![Documentation](https://img.shields.io/badge/ruby_client-documentation-informational)](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
2
4
 
3
- Ruby client for split software. This is provided as a gem that can be installed to your Ruby application
5
+ ## Overview
6
+ This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience.
4
7
 
5
- ## Installation
6
- ----------
8
+ [![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware)
7
9
 
8
- - Once the gem is published you can install it with the following steps:
10
+ ## Compatibility
11
+ The Ruby SDK support Ruby version 2.5.0 or later and JRuby or 9.1.17 o later.
9
12
 
10
- Add this line to your application's Gemfile:
13
+ Also the Ruby SDK has been tested as a standalone app as well as using the following web servers:
14
+ - Puma
15
+ - Passenger
16
+ - Unicorn
11
17
 
12
- ```ruby
13
- gem 'splitclient-rb'
14
- ```
18
+ For other setups, please reach out to [support@split.io](mailto:support@split.io).
15
19
 
16
- And then execute:
17
-
18
- $ bundle
19
-
20
- Or install it yourself as:
21
-
22
- $ gem install splitclient-rb
23
-
24
- - If the gem is still unpublished you can install it through this git repository with the following instructions:
25
-
26
- Add these lines to you application's Gemnfile
27
- ```ruby
28
- gem 'splitclient-rb', :git=>'https://github.com/splitio/ruby-client.git',
29
- ```
30
- You can also specify any specific branch if necessary
31
- ```ruby
32
- gem 'splitclient-rb', :git=>'https://github.com/splitio/ruby-client.git', :branch=>'development'
33
- ```
34
- And then execute:
35
-
36
- $ bundle install
37
-
38
- ## Usage
39
- ###Quick Setup
40
- ------
41
- Within your application you need the following
42
-
43
- Require the Split client:
20
+ ## Getting started
21
+ Below is a simple example that describes the instantiation and most basic usage of our SDK:
44
22
  ```ruby
45
23
  require 'splitclient-rb'
46
- ```
47
-
48
- Create a new split client instance with your API key:
49
- ```ruby
50
- split_client = SplitIoClient::SplitClient.new("your_api_key")
51
- ```
52
- ###Ruby on Rails
53
- ----
54
- If you're using Ruby on Rails
55
-
56
- Create an initializer file at config/initializers/splitclient.rb and then initialize the split client :
57
- ```ruby
58
- Rails.configuration.split_client = SplitIoClient::SplitClient.new("your_api_key")
59
- ```
60
- In your controllers, access the client using
61
-
62
- ```ruby
63
- Rails.application.config.split_client
64
- ```
65
-
66
- ###Configuration
67
- ---
68
- By default the split client uses its default configuration, it will be sufficient for most scenarios. However you can also provide custom configuration when initializing the client using an optional hash of options.
69
-
70
- The following values can be customized
71
24
 
72
- **base_uri** : URI for the api endpoints
73
- *defualt value* : https://sdk.split.io/api/
25
+ split_factory = SplitIoClient::SplitFactory.new('YOUR_SDK_KEY')
26
+ split_client = split_factory.client
74
27
 
75
- **local_store** : optional cache storage
76
- *default value* : custom cache local storage
77
-
78
- **connection_timeout** : timeout for network connections in seconds
79
- *default value* = 5
80
-
81
- **read_timeout** : timeout for requests in seconds
82
- *default value* = 5
83
-
84
- **features_refresh_rate** : The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds
85
- *default value* = 30
86
-
87
- **segments_refresh_rate** : The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds
88
- *default value* = 60
89
-
90
- **metrics_refresh_rate** : The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds
91
- *default value* = 60
92
-
93
- **impressions_refresh_rate** : The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers in seconds
94
- *default value* = 60
95
-
96
- **logger** : default logger for messages and errors
97
- *default value* : Ruby logger class set to STDOUT
28
+ begin
29
+ split_client.block_until_ready
30
+ rescue SplitIoClient::SDKBlockerTimeoutExpiredException
31
+ puts 'SDK is not ready. Decide whether to continue or abort execution'
32
+ end
98
33
 
99
- Example
100
- ```ruby
101
- options = {base_uri: 'https://my.app.api/',
102
- local_store: Rails.cache,
103
- connection_timeout: 10,
104
- read_timeout: 5,
105
- features_refresh_rate: 120,
106
- segments_refresh_rate: 120,
107
- metrics_refresh_rate: 360,
108
- impressions_refresh_rate: 360,
109
- logger: Logger.new('logfile.log')}
110
-
111
- split_client = SplitIoClient::SplitClient.new("your_api_key", options)
112
- ```
113
- ### Execution
114
- ---
115
- In your application code you just need to call the is_on? method with the required parameters for key and feature name
116
- ```ruby
117
- split_client.is_treatment?('key','feature_name','on')
118
- ```
34
+ treatment = split_client.get_treatment('CUSTOMER_ID', 'FEATURE_FLAG_NAME');
119
35
 
120
- For example
121
- ```ruby
122
- if split_client.is_treatment?('employee_user_01','view_main_list','on')
123
- my_app.display_main_list
36
+ if treatment == 'on'
37
+ # insert code here to show on treatment
38
+ elsif treatment == 'off'
39
+ # insert code here to show off treatment
40
+ else
41
+ # insert your control treatment code here
124
42
  end
125
43
  ```
44
+ For multi-process environments you also need to setup Split Synchronizer. See [Sharing state: Redis integration](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK#sharing-state-redis-integration)
126
45
 
127
- ## Development
128
-
129
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
130
-
131
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
46
+ Please refer to [our official docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) to learn about all the functionality provided by our SDK and the configuration options available for tailoring it to your current application setup.
132
47
 
133
- ## Coverage
48
+ ## Submitting issues
49
+ The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/ruby-client/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner.
134
50
 
135
- The gem uses rspec for unit testing. Under the default `/spec` folder you will find the files for the unit tests and the specs helper file ( spec_helper.rb ). If a new spec file with new unit tests is required you just simply need to create it under the spec foleder and all its test will be executed on the next rspec execution.
51
+ ## Contributing
52
+ Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR).
136
53
 
137
- To run the suite of unit tests a rake task is provided. It's executed with the following command:
54
+ ## License
55
+ Licensed under the Apache License, Version 2.0. See: [Apache License](http://www.apache.org/licenses/).
138
56
 
139
- $ rake spec
57
+ ## About Split
58
+ Split is the leading Feature Delivery Platform for engineering teams that want to confidently deploy features as fast as they can develop them. Split’s fine-grained management, real-time monitoring, and data-driven experimentation ensure that new features will improve the customer experience without breaking or degrading performance. Companies like Twilio, Salesforce, GoDaddy and WePay trust Split to power their feature delivery.
140
59
 
141
- Also, simplecov is used for coverage reporting. After the execution of the rake tastk it will create the `/coverage` folder with coverage reports in pretty HTML format.
142
- Right now, the code coverage of the gem is at about 95%.
60
+ To learn more about Split, contact hello@split.io, or get started with feature flags for free at https://www.split.io/signup.
143
61
 
62
+ Split has built and maintains SDKs for:
144
63
 
145
- ## Contributing
64
+ * .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK)
65
+ * Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK)
66
+ * Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities)
67
+ * GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK)
68
+ * iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK)
69
+ * Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK)
70
+ * JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK)
71
+ * JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK)
72
+ * Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK)
73
+ * PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK)
74
+ * Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK)
75
+ * React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK)
76
+ * React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK)
77
+ * Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK)
78
+ * Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK)
146
79
 
147
- Bug reports and pull requests are welcome on GitHub at https://github.com/splitio/ruby-client.
80
+ For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20).
148
81
 
82
+ **Learn more about Split:**
149
83
 
150
- ## License
151
-
152
- The gem is available as open source under the terms of the [Apache License](http://www.apache.org/licenses/).
84
+ Visit [split.io/product](https://www.split.io/product) for an overview of Split, or visit our documentation at [help.split.io](http://help.split.io) for more detailed information.
data/Rakefile CHANGED
@@ -1,4 +1,28 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ # frozen_string_literal: true
3
2
 
4
- Dir.glob('tasks/**/*.rake').each(&method(:import))
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+ require 'rubocop/rake_task'
6
+
7
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
8
+
9
+ RSpec::Core::RakeTask.new(:spec)
10
+ RuboCop::RakeTask.new(:rubocop)
11
+
12
+ task spec: :compile
13
+ case RUBY_PLATFORM
14
+ when 'java'
15
+ require 'rake/javaextensiontask'
16
+ Rake::JavaExtensionTask.new 'murmurhash' do |ext|
17
+ ext.lib_dir = 'lib/murmurhash'
18
+ ext.target_version = '1.7'
19
+ ext.source_version = '1.7'
20
+ end
21
+ else
22
+ require 'rake/extensiontask'
23
+ Rake::ExtensionTask.new 'murmurhash' do |ext|
24
+ ext.lib_dir = 'lib/murmurhash'
25
+ end
26
+ end
27
+
28
+ task default: %i[spec rubocop]