featurehub-sdk 1.2.3 → 1.3.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 +4 -4
- data/.rubocop.yml +4 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +124 -63
- data/LICENSE +21 -0
- data/README.md +235 -0
- data/examples/rails_example/.env.example +13 -0
- data/examples/rails_example/.gitattributes +7 -0
- data/examples/rails_example/.gitignore +103 -0
- data/examples/rails_example/.ruby-version +1 -0
- data/examples/rails_example/Dockerfile +12 -0
- data/examples/rails_example/Gemfile +80 -0
- data/examples/rails_example/Gemfile.lock +283 -0
- data/examples/rails_example/README.md +36 -0
- data/examples/rails_example/Rakefile +8 -0
- data/examples/rails_example/app/assets/config/manifest.js +4 -0
- data/examples/rails_example/app/assets/images/.keep +0 -0
- data/examples/rails_example/app/assets/stylesheets/application.css +15 -0
- data/examples/rails_example/app/channels/application_cable/channel.rb +6 -0
- data/examples/rails_example/app/channels/application_cable/connection.rb +6 -0
- data/examples/rails_example/app/controllers/application_controller.rb +4 -0
- data/examples/rails_example/app/controllers/concerns/.keep +0 -0
- data/examples/rails_example/app/controllers/home_controller.rb +12 -0
- data/examples/rails_example/app/helpers/application_helper.rb +4 -0
- data/examples/rails_example/app/helpers/home_helper.rb +4 -0
- data/examples/rails_example/app/javascript/application.js +3 -0
- data/examples/rails_example/app/javascript/controllers/application.js +9 -0
- data/examples/rails_example/app/javascript/controllers/hello_controller.js +7 -0
- data/examples/rails_example/app/javascript/controllers/index.js +11 -0
- data/examples/rails_example/app/jobs/application_job.rb +9 -0
- data/examples/rails_example/app/mailers/application_mailer.rb +6 -0
- data/examples/rails_example/app/models/application_record.rb +5 -0
- data/examples/rails_example/app/models/concerns/.keep +0 -0
- data/examples/rails_example/app/views/home/index.html.erb +6 -0
- data/examples/rails_example/app/views/layouts/application.html.erb +16 -0
- data/examples/rails_example/app/views/layouts/mailer.html.erb +13 -0
- data/examples/rails_example/app/views/layouts/mailer.text.erb +1 -0
- data/examples/rails_example/bin/bundle +118 -0
- data/examples/rails_example/bin/importmap +5 -0
- data/examples/rails_example/bin/rails +6 -0
- data/examples/rails_example/bin/rake +6 -0
- data/examples/rails_example/bin/setup +35 -0
- data/examples/rails_example/config/application.rb +24 -0
- data/examples/rails_example/config/boot.rb +6 -0
- data/examples/rails_example/config/cable.yml +10 -0
- data/examples/rails_example/config/credentials.yml.enc +1 -0
- data/examples/rails_example/config/database.yml +25 -0
- data/examples/rails_example/config/environment.rb +7 -0
- data/examples/rails_example/config/environments/development.rb +72 -0
- data/examples/rails_example/config/environments/production.rb +95 -0
- data/examples/rails_example/config/environments/test.rb +62 -0
- data/examples/rails_example/config/importmap.rb +9 -0
- data/examples/rails_example/config/initializers/assets.rb +14 -0
- data/examples/rails_example/config/initializers/content_security_policy.rb +27 -0
- data/examples/rails_example/config/initializers/featurehub.rb +8 -0
- data/examples/rails_example/config/initializers/filter_parameter_logging.rb +10 -0
- data/examples/rails_example/config/initializers/inflections.rb +18 -0
- data/examples/rails_example/config/initializers/permissions_policy.rb +13 -0
- data/examples/rails_example/config/locales/en.yml +33 -0
- data/examples/rails_example/config/puma.rb +57 -0
- data/examples/rails_example/config/routes.rb +8 -0
- data/examples/rails_example/config/storage.yml +34 -0
- data/examples/rails_example/config.ru +8 -0
- data/examples/rails_example/db/seeds.rb +9 -0
- data/examples/rails_example/lib/assets/.keep +0 -0
- data/examples/rails_example/lib/tasks/.keep +0 -0
- data/examples/rails_example/log/.keep +0 -0
- data/examples/rails_example/public/404.html +67 -0
- data/examples/rails_example/public/422.html +67 -0
- data/examples/rails_example/public/500.html +66 -0
- data/examples/rails_example/public/apple-touch-icon-precomposed.png +0 -0
- data/examples/rails_example/public/apple-touch-icon.png +0 -0
- data/examples/rails_example/public/favicon.ico +0 -0
- data/examples/rails_example/public/robots.txt +1 -0
- data/examples/rails_example/storage/.keep +0 -0
- data/examples/rails_example/test/application_system_test_case.rb +7 -0
- data/examples/rails_example/test/channels/application_cable/connection_test.rb +15 -0
- data/examples/rails_example/test/controllers/.keep +0 -0
- data/examples/rails_example/test/controllers/home_controller_test.rb +9 -0
- data/examples/rails_example/test/fixtures/files/.keep +0 -0
- data/examples/rails_example/test/helpers/.keep +0 -0
- data/examples/rails_example/test/integration/.keep +0 -0
- data/examples/rails_example/test/mailers/.keep +0 -0
- data/examples/rails_example/test/models/.keep +0 -0
- data/examples/rails_example/test/system/.keep +0 -0
- data/examples/rails_example/test/test_helper.rb +17 -0
- data/examples/rails_example/tmp/.keep +0 -0
- data/examples/rails_example/tmp/pids/.keep +0 -0
- data/examples/rails_example/tmp/storage/.keep +0 -0
- data/examples/rails_example/vendor/.keep +0 -0
- data/examples/rails_example/vendor/javascript/.keep +0 -0
- data/examples/sinatra/.gitignore +3 -0
- data/examples/sinatra/.ruby-version +1 -0
- data/examples/sinatra/Dockerfile +42 -0
- data/examples/sinatra/Gemfile +16 -0
- data/examples/sinatra/Gemfile.lock +86 -0
- data/examples/sinatra/README.adoc +10 -0
- data/examples/sinatra/app/application.rb +141 -0
- data/examples/sinatra/build.sh +2 -0
- data/examples/sinatra/conf/nginx.conf +57 -0
- data/examples/sinatra/conf/nsswitch.conf +21 -0
- data/examples/sinatra/config.ru +17 -0
- data/examples/sinatra/docker_start.sh +3 -0
- data/examples/sinatra/sinatra.iml +22 -0
- data/examples/sinatra/start.sh +3 -0
- data/examples/sinatra/thin.ru +9 -0
- data/featurehub-ruby-sdk.iml +9 -0
- data/featurehub-sdk.gemspec +42 -0
- data/lib/feature_hub/sdk/feature_hub_config.rb +0 -2
- data/lib/feature_hub/sdk/impl/rollout_holders.rb +3 -3
- data/lib/feature_hub/sdk/streaming_edge_service.rb +1 -1
- data/lib/feature_hub/sdk/version.rb +1 -1
- metadata +114 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cd81cc23b520be9a702b06ab17071c1eddb40bd2a79cc0617c22509f1574cc9
|
|
4
|
+
data.tar.gz: e2c3cf069c8635fc574db0d6c5a8dcdef2170058d282747c2b0481f84998078b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7092b35679401cd732ece4a49366a84e136df729d8bbdc3285da81ade5cb90ffad19a5431c9fe25e9c5b8f9b2c777a144e90859d22c9230c22f3278909de35af
|
|
7
|
+
data.tar.gz: a134bea6b240aa6aced1158e5c0bd70c4c3b7754d047387aeb517fdec8b35e2572599971aea11abfcdb477ed68dd2d29657b0747acd1a2c87fc93d59927e1457
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion: 2
|
|
2
|
+
TargetRubyVersion: 3.2
|
|
3
3
|
|
|
4
4
|
Style/StringLiterals:
|
|
5
5
|
Enabled: true
|
|
@@ -35,7 +35,7 @@ Metrics/CyclomaticComplexity:
|
|
|
35
35
|
Naming/FileName:
|
|
36
36
|
Enabled: false
|
|
37
37
|
|
|
38
|
-
Gemspec/
|
|
38
|
+
Gemspec/DeprecatedAttributeAssignment:
|
|
39
39
|
Enabled: true
|
|
40
40
|
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
|
41
41
|
Enabled: true
|
|
@@ -101,6 +101,8 @@ Style/ArgumentsForwarding: # new in 1.1
|
|
|
101
101
|
Enabled: true
|
|
102
102
|
Style/CollectionCompact: # new in 1.2
|
|
103
103
|
Enabled: true
|
|
104
|
+
Style/Documentation:
|
|
105
|
+
Enabled: false
|
|
104
106
|
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
|
105
107
|
Enabled: true
|
|
106
108
|
Style/EndlessMethod: # new in 1.8
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.0
|
|
1
|
+
3.2.0
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
|
@@ -13,12 +13,12 @@ gem "rubocop", "~> 1.21"
|
|
|
13
13
|
|
|
14
14
|
gem "simplecov", "~> 0.21"
|
|
15
15
|
|
|
16
|
-
gem "concurrent-ruby", "~> 1.
|
|
16
|
+
gem "concurrent-ruby", "~> 1.3"
|
|
17
17
|
|
|
18
18
|
gem "faraday", "~> 2"
|
|
19
19
|
|
|
20
|
-
gem "murmurhash3", "~> 0.1.
|
|
20
|
+
gem "murmurhash3", "~> 0.1.7"
|
|
21
21
|
|
|
22
22
|
gem "sem_version", "~> 2.0.0"
|
|
23
23
|
|
|
24
|
-
gem "ld-eventsource", "~> 2.
|
|
24
|
+
gem "ld-eventsource", "~> 2.3.0"
|
data/Gemfile.lock
CHANGED
|
@@ -1,107 +1,168 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
featurehub-sdk (1.
|
|
5
|
-
concurrent-ruby (~> 1.
|
|
4
|
+
featurehub-sdk (1.3.0)
|
|
5
|
+
concurrent-ruby (~> 1.3)
|
|
6
6
|
faraday (~> 2)
|
|
7
|
-
ld-eventsource (~> 2.
|
|
8
|
-
murmurhash3 (~> 0.1.
|
|
7
|
+
ld-eventsource (~> 2.3.0)
|
|
8
|
+
murmurhash3 (~> 0.1.7)
|
|
9
9
|
sem_version (~> 2.0.0)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
addressable (2.8.
|
|
15
|
-
public_suffix (>= 2.0.2, <
|
|
16
|
-
ast (2.4.
|
|
17
|
-
concurrent-ruby (1.
|
|
18
|
-
diff-lcs (1.
|
|
19
|
-
docile (1.4.
|
|
20
|
-
domain_name (0.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
faraday-net_http (
|
|
26
|
-
|
|
27
|
-
ffi
|
|
28
|
-
|
|
14
|
+
addressable (2.8.8)
|
|
15
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
16
|
+
ast (2.4.3)
|
|
17
|
+
concurrent-ruby (1.3.6)
|
|
18
|
+
diff-lcs (1.6.2)
|
|
19
|
+
docile (1.4.1)
|
|
20
|
+
domain_name (0.6.20240107)
|
|
21
|
+
faraday (2.14.0)
|
|
22
|
+
faraday-net_http (>= 2.0, < 3.5)
|
|
23
|
+
json
|
|
24
|
+
logger
|
|
25
|
+
faraday-net_http (3.4.2)
|
|
26
|
+
net-http (~> 0.5)
|
|
27
|
+
ffi (1.17.3-arm64-darwin)
|
|
28
|
+
ffi (1.17.3-x86_64-linux-gnu)
|
|
29
|
+
ffi-compiler (1.3.2)
|
|
30
|
+
ffi (>= 1.15.5)
|
|
29
31
|
rake
|
|
30
|
-
http (5.
|
|
32
|
+
http (5.3.1)
|
|
31
33
|
addressable (~> 2.8)
|
|
32
34
|
http-cookie (~> 1.0)
|
|
33
35
|
http-form_data (~> 2.2)
|
|
34
|
-
llhttp-ffi (~> 0.
|
|
35
|
-
http-cookie (1.0
|
|
36
|
+
llhttp-ffi (~> 0.5.0)
|
|
37
|
+
http-cookie (1.1.0)
|
|
36
38
|
domain_name (~> 0.5)
|
|
37
39
|
http-form_data (2.3.0)
|
|
38
|
-
|
|
40
|
+
json (2.18.0)
|
|
41
|
+
language_server-protocol (3.17.0.5)
|
|
42
|
+
ld-eventsource (2.3.0)
|
|
39
43
|
concurrent-ruby (~> 1.0)
|
|
40
44
|
http (>= 4.4.1, < 6.0.0)
|
|
41
|
-
|
|
45
|
+
lint_roller (1.1.0)
|
|
46
|
+
llhttp-ffi (0.5.1)
|
|
42
47
|
ffi-compiler (~> 1.0)
|
|
43
48
|
rake (~> 13.0)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
logger (1.7.0)
|
|
50
|
+
murmurhash3 (0.1.7)
|
|
51
|
+
net-http (0.9.1)
|
|
52
|
+
uri (>= 0.11.1)
|
|
53
|
+
parallel (1.27.0)
|
|
54
|
+
parser (3.3.10.0)
|
|
47
55
|
ast (~> 2.4.1)
|
|
48
|
-
|
|
56
|
+
racc
|
|
57
|
+
prism (1.6.0)
|
|
58
|
+
public_suffix (6.0.2)
|
|
59
|
+
racc (1.8.1)
|
|
49
60
|
rainbow (3.1.1)
|
|
50
|
-
rake (13.
|
|
51
|
-
regexp_parser (2.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
rspec-
|
|
55
|
-
rspec-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
rspec-expectations (3.11.0)
|
|
61
|
+
rake (13.3.1)
|
|
62
|
+
regexp_parser (2.11.3)
|
|
63
|
+
rspec (3.13.2)
|
|
64
|
+
rspec-core (~> 3.13.0)
|
|
65
|
+
rspec-expectations (~> 3.13.0)
|
|
66
|
+
rspec-mocks (~> 3.13.0)
|
|
67
|
+
rspec-core (3.13.6)
|
|
68
|
+
rspec-support (~> 3.13.0)
|
|
69
|
+
rspec-expectations (3.13.5)
|
|
60
70
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
-
rspec-support (~> 3.
|
|
62
|
-
rspec-mocks (3.
|
|
71
|
+
rspec-support (~> 3.13.0)
|
|
72
|
+
rspec-mocks (3.13.7)
|
|
63
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
64
|
-
rspec-support (~> 3.
|
|
65
|
-
rspec-support (3.
|
|
66
|
-
rubocop (1.
|
|
74
|
+
rspec-support (~> 3.13.0)
|
|
75
|
+
rspec-support (3.13.6)
|
|
76
|
+
rubocop (1.82.0)
|
|
77
|
+
json (~> 2.3)
|
|
78
|
+
language_server-protocol (~> 3.17.0.2)
|
|
79
|
+
lint_roller (~> 1.1.0)
|
|
67
80
|
parallel (~> 1.10)
|
|
68
|
-
parser (>= 3.
|
|
81
|
+
parser (>= 3.3.0.2)
|
|
69
82
|
rainbow (>= 2.2.2, < 4.0)
|
|
70
|
-
regexp_parser (>=
|
|
71
|
-
|
|
72
|
-
rubocop-ast (>= 1.18.0, < 2.0)
|
|
83
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
84
|
+
rubocop-ast (>= 1.48.0, < 2.0)
|
|
73
85
|
ruby-progressbar (~> 1.7)
|
|
74
|
-
unicode-display_width (>=
|
|
75
|
-
rubocop-ast (1.
|
|
76
|
-
parser (>= 3.
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
87
|
+
rubocop-ast (1.48.0)
|
|
88
|
+
parser (>= 3.3.7.2)
|
|
89
|
+
prism (~> 1.4)
|
|
90
|
+
ruby-progressbar (1.13.0)
|
|
79
91
|
sem_version (2.0.1)
|
|
80
|
-
simplecov (0.
|
|
92
|
+
simplecov (0.22.0)
|
|
81
93
|
docile (~> 1.1)
|
|
82
94
|
simplecov-html (~> 0.11)
|
|
83
95
|
simplecov_json_formatter (~> 0.1)
|
|
84
|
-
simplecov-html (0.
|
|
96
|
+
simplecov-html (0.13.2)
|
|
85
97
|
simplecov_json_formatter (0.1.4)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
98
|
+
unicode-display_width (3.2.0)
|
|
99
|
+
unicode-emoji (~> 4.1)
|
|
100
|
+
unicode-emoji (4.2.0)
|
|
101
|
+
uri (1.1.1)
|
|
90
102
|
|
|
91
103
|
PLATFORMS
|
|
92
|
-
|
|
104
|
+
arm64-darwin
|
|
105
|
+
x86_64-linux
|
|
93
106
|
|
|
94
107
|
DEPENDENCIES
|
|
95
|
-
concurrent-ruby (~> 1.
|
|
108
|
+
concurrent-ruby (~> 1.3)
|
|
96
109
|
faraday (~> 2)
|
|
97
110
|
featurehub-sdk!
|
|
98
|
-
ld-eventsource (~> 2.
|
|
99
|
-
murmurhash3 (~> 0.1.
|
|
111
|
+
ld-eventsource (~> 2.3.0)
|
|
112
|
+
murmurhash3 (~> 0.1.7)
|
|
100
113
|
rake (~> 13.0)
|
|
101
114
|
rspec (~> 3.0)
|
|
102
115
|
rubocop (~> 1.21)
|
|
103
116
|
sem_version (~> 2.0.0)
|
|
104
117
|
simplecov (~> 0.21)
|
|
105
118
|
|
|
119
|
+
CHECKSUMS
|
|
120
|
+
addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057
|
|
121
|
+
ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
|
|
122
|
+
concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
|
|
123
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
124
|
+
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
125
|
+
domain_name (0.6.20240107) sha256=5f693b2215708476517479bf2b3802e49068ad82167bcd2286f899536a17d933
|
|
126
|
+
faraday (2.14.0) sha256=8699cfe5d97e55268f2596f9a9d5a43736808a943714e3d9a53e6110593941cd
|
|
127
|
+
faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
|
|
128
|
+
featurehub-sdk (1.3.0)
|
|
129
|
+
ffi (1.17.3-arm64-darwin) sha256=0c690555d4cee17a7f07c04d59df39b2fba74ec440b19da1f685c6579bb0717f
|
|
130
|
+
ffi (1.17.3-x86_64-linux-gnu) sha256=3746b01f677aae7b16dc1acb7cb3cc17b3e35bdae7676a3f568153fb0e2c887f
|
|
131
|
+
ffi-compiler (1.3.2) sha256=a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0
|
|
132
|
+
http (5.3.1) sha256=c50802d8e9be3926cb84ac3b36d1a31fbbac383bc4cbecdce9053cb604231d7d
|
|
133
|
+
http-cookie (1.1.0) sha256=38a5e60d1527eebc396831b8c4b9455440509881219273a6c99943d29eadbb19
|
|
134
|
+
http-form_data (2.3.0) sha256=cc4eeb1361d9876821e31d7b1cf0b68f1cf874b201d27903480479d86448a5f3
|
|
135
|
+
json (2.18.0) sha256=b10506aee4183f5cf49e0efc48073d7b75843ce3782c68dbeb763351c08fd505
|
|
136
|
+
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
|
|
137
|
+
ld-eventsource (2.3.0) sha256=b79187490fc567626c805b9f3d97d08a03d5e4cad045974b2089216bf37dba9f
|
|
138
|
+
lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
|
|
139
|
+
llhttp-ffi (0.5.1) sha256=9a25a7fc19311f691a78c9c0ac0fbf4675adbd0cca74310228fdf841018fa7bc
|
|
140
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
141
|
+
murmurhash3 (0.1.7) sha256=370a2ce2e9ab0711e51554e530b5f63956927a6554a296855f42a1a4a5ed0936
|
|
142
|
+
net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
|
|
143
|
+
parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
|
|
144
|
+
parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
|
|
145
|
+
prism (1.6.0) sha256=bfc0281a81718c4872346bc858dc84abd3a60cae78336c65ad35c8fbff641c6b
|
|
146
|
+
public_suffix (6.0.2) sha256=bfa7cd5108066f8c9602e0d6d4114999a5df5839a63149d3e8b0f9c1d3558394
|
|
147
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
148
|
+
rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
|
|
149
|
+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
|
|
150
|
+
regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
|
|
151
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
152
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
153
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
154
|
+
rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
|
|
155
|
+
rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
|
|
156
|
+
rubocop (1.82.0) sha256=237b7dc24952d7ec469a9593c7a5283315515e2e7dc24ac91532819c254fc4ec
|
|
157
|
+
rubocop-ast (1.48.0) sha256=22df9bbf3f7a6eccde0fad54e68547ae1e2a704bf8719e7c83813a99c05d2e76
|
|
158
|
+
ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
|
|
159
|
+
sem_version (2.0.1) sha256=6d97d4f67e28546ba90b3c290f901d6c8031ddb8e08bce962139739c4d40b183
|
|
160
|
+
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
|
|
161
|
+
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
|
|
162
|
+
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
|
|
163
|
+
unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
|
|
164
|
+
unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
|
|
165
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
166
|
+
|
|
106
167
|
BUNDLED WITH
|
|
107
|
-
|
|
168
|
+
4.0.3
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 FeatureHub
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
# Official FeatureHub Ruby SDK.
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
To control the feature flags from the FeatureHub Admin console, either use our [demo](https://demo.featurehub.io) version for evaluation or install the app using our guide [here](https://docs.featurehub.io/featurehub/latest/installation.html)
|
|
5
|
+
|
|
6
|
+
## SDK installation
|
|
7
|
+
|
|
8
|
+
Add the featurehub sdk gem to your Gemfile and/or gemspec if you are creating a library:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
gem `featurehub-sdk`
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
To use it in your code, use:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
require 'featurehub-sdk'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Options to get feature updates
|
|
22
|
+
|
|
23
|
+
There are 2 ways to request for feature updates via this SDK:
|
|
24
|
+
|
|
25
|
+
- **SSE (Server Sent Events) realtime updates mechanism**
|
|
26
|
+
|
|
27
|
+
In this mode, you will make a connection to the FeatureHub Edge server using using Server Sent Events, any updates to any features will come through in _near realtime_, automatically updating the feature values in the repository. This method is recommended for server applications.
|
|
28
|
+
|
|
29
|
+
- **FeatureHub polling client (GET request updates)**
|
|
30
|
+
|
|
31
|
+
In this mode you can set an interval (from 0 - just once) to any number of seconds between polling. This is more useful for when you have short term single threaded
|
|
32
|
+
processes like command line tools. Batch tools that iterate over data sets and wish to control when updates happen can also benefit from this method.
|
|
33
|
+
|
|
34
|
+
This SDK uses concurrent ruby to ensure whichever option you choose stays open and continually updates your data.
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
|
|
38
|
+
Check our example Sinatra app [here](https://github.com/featurehub-io/featurehub-ruby-sdk/tree/main/example/sinatra)
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
### Connecting to FeatureHub
|
|
43
|
+
There are 3 steps to connecting:
|
|
44
|
+
1) Copy FeatureHub API Key from the FeatureHub Admin Console
|
|
45
|
+
2) Create FeatureHub config
|
|
46
|
+
3) Check FeatureHub Repository readiness and request feature state
|
|
47
|
+
|
|
48
|
+
#### 1. API Key from the FeatureHub Admin Console
|
|
49
|
+
Find and copy your API Key from the FeatureHub Admin Console on the API Keys page -
|
|
50
|
+
you will use this in your code to configure feature updates for your environments.
|
|
51
|
+
It should look similar to this: ```default/71ed3c04-122b-4312-9ea8-06b2b8d6ceac/fsTmCrcZZoGyl56kPHxfKAkbHrJ7xZMKO3dlBiab5IqUXjgKvqpjxYdI8zdXiJqYCpv92Jrki0jY5taE```.
|
|
52
|
+
There are two options - a Server Evaluated API Key and a Client Evaluated API Key. More on this [here](https://docs.featurehub.io/#_client_and_server_api_keys)
|
|
53
|
+
|
|
54
|
+
Client Side evaluation is intended for use in secure environments (such as microservices) and is intended for rapid client side evaluation, per request for example.
|
|
55
|
+
|
|
56
|
+
Server Side evaluation is more suitable when you are using an _insecure client_. (e.g. command line tool). This also means you evaluate one user per client.
|
|
57
|
+
|
|
58
|
+
#### 2. Create FeatureHub config:
|
|
59
|
+
|
|
60
|
+
Create `FeatureHubConfig`. You need to provide the API Key and the URL of the FeatureHub Edge server.
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
config = FeatureHub::Sdk::FeatureHubConfig.new(ENV.fetch("FEATUREHUB_EDGE_URL"),
|
|
64
|
+
[ENV.fetch("FEATUREHUB_CLIENT_API_KEY")])
|
|
65
|
+
config.init
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Note, you only ever need to do this once, a Config consists of a Repository
|
|
70
|
+
(which holds state) and an Edge Server (which gets the updates and passes them
|
|
71
|
+
on to the Repository). You can have many of them if you wish, but you don't need
|
|
72
|
+
to.
|
|
73
|
+
|
|
74
|
+
to in Rails, you might create an initializer that does this:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
Rails.configuration.fh_client = FeatureHub::Sdk::FeatureHubConfig.new(ENV.fetch("FEATUREHUB_EDGE_URL"),
|
|
78
|
+
[ENV.fetch("FEATUREHUB_CLIENT_API_KEY")]).init
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
in Sinatra (our example), it might do this:
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
class App < Sinatra::Base
|
|
85
|
+
configure do
|
|
86
|
+
set :fh_config, FeatureHub::Sdk::FeatureHubConfig.new(ENV.fetch("FEATUREHUB_EDGE_URL"),
|
|
87
|
+
[ENV.fetch("FEATUREHUB_CLIENT_API_KEY")])
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
By default, this SDK will use SSE client. If you decide to use FeatureHub polling client, after initialising the config, you can add this:
|
|
94
|
+
|
|
95
|
+
```ruby
|
|
96
|
+
config.use_polling_edge_service(30)
|
|
97
|
+
# OR
|
|
98
|
+
config.use_polling_edge_service # uses environment variable FEATUREHUB_POLL_INTERVAL or default of 30
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
in this case it is configured for requesting an update every 30 seconds.
|
|
102
|
+
|
|
103
|
+
#### 3. Check FeatureHub Repository readiness and request feature state
|
|
104
|
+
|
|
105
|
+
Check for FeatureHub Repository readiness:
|
|
106
|
+
```ruby
|
|
107
|
+
if config.repository.ready?
|
|
108
|
+
# do something
|
|
109
|
+
end
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If you are not intending to use rollout strategies, you can pass empty context to the SDK:
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
def name_arg(name)
|
|
116
|
+
if config.new_context.build.feature("FEATURE_TITLE_TO_UPPERCASE").flag
|
|
117
|
+
"HELLO WORLD"
|
|
118
|
+
else
|
|
119
|
+
"hello world"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
If you are using rollout strategies and targeting rules they are all determined by the active _user context_. In this example we pass `user_key` to the context :
|
|
126
|
+
|
|
127
|
+
```ruby
|
|
128
|
+
def name_arg(name)
|
|
129
|
+
if config.new_context.user_key(name).build.feature("FEATURE_TITLE_TO_UPPERCASE").flag
|
|
130
|
+
"HELLO WORLD"
|
|
131
|
+
else
|
|
132
|
+
"hello world"
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Well known fields have their own methods, or you can add custom
|
|
138
|
+
values for fields using `attribute_value(key, [values])`. For
|
|
139
|
+
example if you wish to trigger on specific contract ids and each
|
|
140
|
+
user could have a different set of contract ids, you can add those
|
|
141
|
+
`attribute_value("contract_values", [2,17,45])` and have configured
|
|
142
|
+
your strategy with a list of contract values which trigger the feature.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
See more options to request feature states [here](https://github.com/featurehub-io/featurehub-ruby-sdk/blob/main/featurehub-sdk/lib/feature_hub/sdk/context.rb)
|
|
146
|
+
|
|
147
|
+
### Using inside popular web servers
|
|
148
|
+
|
|
149
|
+
Because most of the popular webservers use a process per request distributed request distribution model, they
|
|
150
|
+
will generally fork the process when they need more processes to handle the incoming traffic, and this will naturally
|
|
151
|
+
kill the connection to FeatureHub. It does not however reset the cached repository. To ensure your fork is back
|
|
152
|
+
up in running, for various frameworks you will need to ensure the Edge connection is restarted. This consists of
|
|
153
|
+
|
|
154
|
+
```ruby
|
|
155
|
+
config.force_new_edge_service
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Resetting in Passenger
|
|
159
|
+
|
|
160
|
+
In your `config.ru`
|
|
161
|
+
|
|
162
|
+
```ruby
|
|
163
|
+
if defined?(PhusionPassenger)
|
|
164
|
+
PhusionPassenger.on_event(:starting_worker_process) do |forked|
|
|
165
|
+
if forked
|
|
166
|
+
# e.g.
|
|
167
|
+
# App.settings.fh_config.force_new_edge_service
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Resetting in Puma
|
|
175
|
+
|
|
176
|
+
```ruby
|
|
177
|
+
on_worker_boot do
|
|
178
|
+
# e.g.
|
|
179
|
+
# App.settings.fh_config.force_new_edge_service
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### Resetting in Unicorn
|
|
185
|
+
|
|
186
|
+
```ruby
|
|
187
|
+
after_fork do |_server, _worker|
|
|
188
|
+
# e.g.
|
|
189
|
+
# App.settings.fh_config.force_new_edge_service
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### Resetting in Spring
|
|
195
|
+
|
|
196
|
+
```ruby
|
|
197
|
+
Spring.after_fork do
|
|
198
|
+
# e.g.
|
|
199
|
+
# App.settings.fh_config.force_new_edge_service
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Extracting the state
|
|
206
|
+
|
|
207
|
+
You can extract the state from a repository and store it somewhere and reload
|
|
208
|
+
it, but it should be done so using the JSON mechanism so it parses correctly.
|
|
209
|
+
|
|
210
|
+
```ruby
|
|
211
|
+
require 'json'
|
|
212
|
+
|
|
213
|
+
state = config.repository.extract_feature_state
|
|
214
|
+
|
|
215
|
+
# somehow save it
|
|
216
|
+
save(state.to_json)
|
|
217
|
+
|
|
218
|
+
# some later stage, reload it or use it as a cache
|
|
219
|
+
config.repository.notify(:features, JSON.parse(read_state))
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Readyness
|
|
223
|
+
|
|
224
|
+
It is encourage that you include the ready state of the repository in your
|
|
225
|
+
readyness check. If your server cannot connect to your FeatureHub repository
|
|
226
|
+
and cannot sensibly operate without it, it is not ready. Once it has received
|
|
227
|
+
initial state it will remain ready even when it temporarily loses connections.
|
|
228
|
+
|
|
229
|
+
It is only if the key is invalid, or if the repository has never received state,
|
|
230
|
+
that the repository is marked not ready. To determine readyness:
|
|
231
|
+
|
|
232
|
+
```ruby
|
|
233
|
+
config.repository.ready?
|
|
234
|
+
```
|
|
235
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# you may have to change this URL in your app. Assuming you're running the party server locally
|
|
2
|
+
# (i.e. what's described here https://www.featurehub.io/) to test out FeatureHub you can find this URL by running
|
|
3
|
+
# docker ps and finding the container with an image name like 'featurehub/party-server:latest'
|
|
4
|
+
# running via docker? use this URL:
|
|
5
|
+
# "http://host.docker.internal:8085/",
|
|
6
|
+
FEATUREHUB_EDGE_URL="http://0.0.0.0:8085/"
|
|
7
|
+
# You can find this value in the admin console by navigating to the 'API Keys' section of the UI and choosing
|
|
8
|
+
# between the client and the server API Keys for whatever service account you've set up. Learn more about the
|
|
9
|
+
# differences between client-side evaluation here:
|
|
10
|
+
# https://docs.featurehub.io/featurehub/latest/sdks-development.html#_client_side_evaluation
|
|
11
|
+
# and server-side evaluation here (though it's almost never recommended):
|
|
12
|
+
# https://docs.featurehub.io/featurehub/latest/sdks-development.html#_supporting_server_side_evaluation
|
|
13
|
+
FEATUREHUB_CLIENT_API_KEY="CHANGE_ME"
|