featurehub-sdk 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e641291e7daf8a2bb0209ecfd7b0af27fc46b4cd17645bbe7072171ee0c8eb79
4
- data.tar.gz: c37349075e7d5ccdff4776d6980f612e0e8b3bd9d5964124aab104dcf06a991a
3
+ metadata.gz: bc24dc7d6fdae7564db049087e349c8f76fd3cc545ca36b49f18917df8958266
4
+ data.tar.gz: 3ba7ac2412576d5794ee792bbe8a506409b41c533714520b0b8bf0ad17d1c20e
5
5
  SHA512:
6
- metadata.gz: efe9d777183431e8729c37aba09384998c82d8b52eddf2835e47aba7ea60546630a09587fe6f8639c1f4daddb637c68b915daf4dbcdd362ba59b8960ca68d321
7
- data.tar.gz: c028d22c9f8e32077a69e2e0bbc2ba34ea96892cfd78431f480ea020bdf9d7baec15c3af8bb3c0cbe0497c112eec372cd5615f9393fbd5b9dc73a7bcbb08f7fc
6
+ metadata.gz: 5fd342cec7336dab9a9693b40be745c071a25596d37ba0d7c2533394b1bc6d4e2b747a748a47a72bbf1db55784e998582fa01eabbe534f0f950992a516f9576f
7
+ data.tar.gz: 70a79dfc9dfee9ab5d1f2b27f1646bd1f886600f6c3fb389e462564419d832270ac3efb95cdc636b970aec6fd38184ab069a52d2401a8a52530c6834396c0559
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.3.10
1
+ 3.3.11
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [2.1.1] - 2026-05-01
2
+
3
+ - expose Feature Properties capability
4
+ - wrap poll in case of transient timeout or similar error to allow it to continue
5
+
1
6
  ## [2.1.0] - 2026-04-14
2
7
 
3
8
  - Once the Config is closed it won't reopen
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gem "rake", "~> 13.0"
9
9
 
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
- gem "rubocop", "~> 1.21"
12
+ gem "rubocop", "~> 1.86"
13
13
 
14
14
  gem "simplecov", "~> 0.21"
15
15
 
@@ -21,4 +21,4 @@ gem "murmurhash3", "~> 0.1.7"
21
21
 
22
22
  gem "sem_version", "~> 2.0.0"
23
23
 
24
- gem "ld-eventsource", "~> 2.5.1"
24
+ gem "ld-eventsource", "~> 2.6.0"
data/Gemfile.lock CHANGED
@@ -1,73 +1,63 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- featurehub-sdk (2.1.0)
4
+ featurehub-sdk (2.2.0)
5
5
  concurrent-ruby (~> 1.3)
6
6
  faraday
7
- ld-eventsource (~> 2.5.1)
7
+ faraday-gzip
8
+ ld-eventsource (>= 2.5.1, < 2.7.0)
8
9
  murmurhash3 (~> 0.1.7)
9
10
  sem_version (~> 2.0.0)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- addressable (2.8.8)
15
- public_suffix (>= 2.0.2, < 8.0)
16
15
  ast (2.4.3)
17
- concurrent-ruby (1.3.6)
16
+ concurrent-ruby (1.3.7)
18
17
  connection_pool (3.0.2)
19
18
  dalli (4.3.3)
20
19
  logger
21
20
  diff-lcs (1.6.2)
22
21
  docile (1.4.1)
23
22
  domain_name (0.6.20240107)
24
- faraday (2.14.0)
23
+ faraday (2.14.3)
25
24
  faraday-net_http (>= 2.0, < 3.5)
26
25
  json
27
26
  logger
28
- faraday-net_http (3.4.2)
27
+ faraday-gzip (3.1.0)
28
+ faraday (>= 2.0, < 3)
29
+ zlib (~> 3.0)
30
+ faraday-net_http (3.4.4)
29
31
  net-http (~> 0.5)
30
- ffi (1.17.3-arm64-darwin)
31
- ffi (1.17.3-x86_64-darwin)
32
- ffi (1.17.3-x86_64-linux-gnu)
33
- ffi-compiler (1.3.2)
34
- ffi (>= 1.15.5)
35
- rake
36
- http (5.3.1)
37
- addressable (~> 2.8)
32
+ http (6.0.2)
38
33
  http-cookie (~> 1.0)
39
- http-form_data (~> 2.2)
40
- llhttp-ffi (~> 0.5.0)
41
- http-cookie (1.1.0)
34
+ llhttp (~> 0.6.1)
35
+ http-cookie (1.1.4)
42
36
  domain_name (~> 0.5)
43
- http-form_data (2.3.0)
44
- json (2.19.2)
45
- language_server-protocol (3.17.0.5)
46
- ld-eventsource (2.5.1)
37
+ json (2.21.1)
38
+ language_server-protocol (3.17.0.6)
39
+ ld-eventsource (2.6.0)
47
40
  concurrent-ruby (~> 1.0)
48
- http (>= 4.4.1, < 6.0.0)
41
+ http (>= 4.4.1, < 7.0.0)
49
42
  lint_roller (1.1.0)
50
- llhttp-ffi (0.5.1)
51
- ffi-compiler (~> 1.0)
52
- rake (~> 13.0)
43
+ llhttp (0.6.1)
53
44
  logger (1.7.0)
54
45
  murmurhash3 (0.1.7)
55
46
  net-http (0.9.1)
56
47
  uri (>= 0.11.1)
57
- parallel (1.27.0)
58
- parser (3.3.10.0)
48
+ parallel (2.1.0)
49
+ parser (3.3.12.0)
59
50
  ast (~> 2.4.1)
60
51
  racc
61
- prism (1.6.0)
62
- public_suffix (6.0.2)
52
+ prism (1.9.0)
63
53
  racc (1.8.1)
64
54
  rainbow (3.1.1)
65
- rake (13.3.1)
55
+ rake (13.4.2)
66
56
  redis (5.4.1)
67
57
  redis-client (>= 0.22.0)
68
58
  redis-client (0.28.0)
69
59
  connection_pool
70
- regexp_parser (2.11.3)
60
+ regexp_parser (2.12.0)
71
61
  rspec (3.13.2)
72
62
  rspec-core (~> 3.13.0)
73
63
  rspec-expectations (~> 3.13.0)
@@ -81,20 +71,20 @@ GEM
81
71
  diff-lcs (>= 1.2.0, < 2.0)
82
72
  rspec-support (~> 3.13.0)
83
73
  rspec-support (3.13.6)
84
- rubocop (1.82.0)
74
+ rubocop (1.88.2)
85
75
  json (~> 2.3)
86
76
  language_server-protocol (~> 3.17.0.2)
87
77
  lint_roller (~> 1.1.0)
88
- parallel (~> 1.10)
78
+ parallel (>= 1.10)
89
79
  parser (>= 3.3.0.2)
90
80
  rainbow (>= 2.2.2, < 4.0)
91
81
  regexp_parser (>= 2.9.3, < 3.0)
92
- rubocop-ast (>= 1.48.0, < 2.0)
82
+ rubocop-ast (>= 1.49.0, < 2.0)
93
83
  ruby-progressbar (~> 1.7)
94
84
  unicode-display_width (>= 2.4.0, < 4.0)
95
- rubocop-ast (1.48.0)
85
+ rubocop-ast (1.50.0)
96
86
  parser (>= 3.3.7.2)
97
- prism (~> 1.4)
87
+ prism (~> 1.7)
98
88
  ruby-progressbar (1.13.0)
99
89
  sem_version (2.0.1)
100
90
  simplecov (0.22.0)
@@ -107,6 +97,7 @@ GEM
107
97
  unicode-emoji (~> 4.1)
108
98
  unicode-emoji (4.2.0)
109
99
  uri (1.1.1)
100
+ zlib (3.2.3)
110
101
 
111
102
  PLATFORMS
112
103
  arm64-darwin
@@ -118,59 +109,53 @@ DEPENDENCIES
118
109
  dalli (~> 4)
119
110
  faraday
120
111
  featurehub-sdk!
121
- ld-eventsource (~> 2.5.1)
112
+ ld-eventsource (~> 2.6.0)
122
113
  murmurhash3 (~> 0.1.7)
123
114
  rake (~> 13.0)
124
115
  redis (~> 5)
125
116
  rspec (~> 3.0)
126
- rubocop (~> 1.21)
117
+ rubocop (~> 1.86)
127
118
  sem_version (~> 2.0.0)
128
119
  simplecov (~> 0.21)
129
120
 
130
121
  CHECKSUMS
131
- addressable (2.8.8) sha256=7c13b8f9536cf6364c03b9d417c19986019e28f7c00ac8132da4eb0fe393b057
132
122
  ast (2.4.3) sha256=954615157c1d6a382bc27d690d973195e79db7f55e9765ac7c481c60bdb4d383
133
- concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
123
+ concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
134
124
  connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
135
125
  dalli (4.3.3) sha256=ae58aa3442b0d9e129898f56bc6e3a0f8b6149523e723b3eb124a05ae9a2da0c
136
126
  diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
137
127
  docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
138
128
  domain_name (0.6.20240107) sha256=5f693b2215708476517479bf2b3802e49068ad82167bcd2286f899536a17d933
139
- faraday (2.14.0) sha256=8699cfe5d97e55268f2596f9a9d5a43736808a943714e3d9a53e6110593941cd
140
- faraday-net_http (3.4.2) sha256=f147758260d3526939bf57ecf911682f94926a3666502e24c69992765875906c
141
- featurehub-sdk (2.1.0)
142
- ffi (1.17.3-arm64-darwin) sha256=0c690555d4cee17a7f07c04d59df39b2fba74ec440b19da1f685c6579bb0717f
143
- ffi (1.17.3-x86_64-darwin) sha256=1f211811eb5cfaa25998322cdd92ab104bfbd26d1c4c08471599c511f2c00bb5
144
- ffi (1.17.3-x86_64-linux-gnu) sha256=3746b01f677aae7b16dc1acb7cb3cc17b3e35bdae7676a3f568153fb0e2c887f
145
- ffi-compiler (1.3.2) sha256=a94f3d81d12caf5c5d4ecf13980a70d0aeaa72268f3b9cc13358bcc6509184a0
146
- http (5.3.1) sha256=c50802d8e9be3926cb84ac3b36d1a31fbbac383bc4cbecdce9053cb604231d7d
147
- http-cookie (1.1.0) sha256=38a5e60d1527eebc396831b8c4b9455440509881219273a6c99943d29eadbb19
148
- http-form_data (2.3.0) sha256=cc4eeb1361d9876821e31d7b1cf0b68f1cf874b201d27903480479d86448a5f3
149
- json (2.19.2) sha256=e7e1bd318b2c37c4ceee2444841c86539bc462e81f40d134cf97826cb14e83cf
150
- language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
151
- ld-eventsource (2.5.1) sha256=19cb44b7d3f91f76b7401a1b74293b32c723389b2d6f9d81ecb803c628ac1b25
129
+ faraday (2.14.3) sha256=1882247e6766615c8220b4392bf1d27f6ebb63d8e28267587cef1fb0bf37f278
130
+ faraday-gzip (3.1.0) sha256=320783690be169f9b7ddde11598b77156951343753f66a9ab98b1f6694433ff8
131
+ faraday-net_http (3.4.4) sha256=0e78af151747ed1b00f33e25973b4bc220d7f16c00c39676817c8b12331eb588
132
+ featurehub-sdk (2.2.0)
133
+ http (6.0.2) sha256=be337816fb45cee712eeb0829a16d9300c9d2b87b38b771d177d7a59f77e8b83
134
+ http-cookie (1.1.4) sha256=8dd8011dedcae5f91af2671b7ba878c4a9e89f0f6384790c1f4cdd176f5e3ada
135
+ json (2.21.1) sha256=13a43df75d95641443f5702dff350f237164a9d811ff0f2c2800d4d980220583
136
+ language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
137
+ ld-eventsource (2.6.0) sha256=e70b34226972d3c729c92787de7f342de08340f7249393aa8b1d4b4e3f0b062d
152
138
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
153
- llhttp-ffi (0.5.1) sha256=9a25a7fc19311f691a78c9c0ac0fbf4675adbd0cca74310228fdf841018fa7bc
139
+ llhttp (0.6.1) sha256=9da187ecf6407265465919cc0d691210ef79e38fa6e86e5e45593bdf25b50146
154
140
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
155
141
  murmurhash3 (0.1.7) sha256=370a2ce2e9ab0711e51554e530b5f63956927a6554a296855f42a1a4a5ed0936
156
142
  net-http (0.9.1) sha256=25ba0b67c63e89df626ed8fac771d0ad24ad151a858af2cc8e6a716ca4336996
157
- parallel (1.27.0) sha256=4ac151e1806b755fb4e2dc2332cbf0e54f2e24ba821ff2d3dcf86bf6dc4ae130
158
- parser (3.3.10.0) sha256=ce3587fa5cc55a88c4ba5b2b37621b3329aadf5728f9eafa36bbd121462aabd6
159
- prism (1.6.0) sha256=bfc0281a81718c4872346bc858dc84abd3a60cae78336c65ad35c8fbff641c6b
160
- public_suffix (6.0.2) sha256=bfa7cd5108066f8c9602e0d6d4114999a5df5839a63149d3e8b0f9c1d3558394
143
+ parallel (2.1.0) sha256=b35258865c2e31134c5ecb708beaaf6772adf9d5efae28e93e99260877b09356
144
+ parser (3.3.12.0) sha256=21a6d7f755d5a24dfbdc6e6b772e4e879a52e7631a88bc5a3a134606052c9828
145
+ prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
161
146
  racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
162
147
  rainbow (3.1.1) sha256=039491aa3a89f42efa1d6dec2fc4e62ede96eb6acd95e52f1ad581182b79bc6a
163
- rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
148
+ rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
164
149
  redis (5.4.1) sha256=b5e675b57ad22b15c9bcc765d5ac26f60b675408af916d31527af9bd5a81faae
165
150
  redis-client (0.28.0) sha256=888892f9cd8787a41c0ece00bdf5f556dfff7770326ce40bb2bc11f1bfec824b
166
- regexp_parser (2.11.3) sha256=ca13f381a173b7a93450e53459075c9b76a10433caadcb2f1180f2c741fc55a4
151
+ regexp_parser (2.12.0) sha256=35a916a1d63190ab5c9009457136ae5f3c0c7512d60291d0d1378ba18ce08ebb
167
152
  rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
168
153
  rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
169
154
  rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
170
155
  rspec-mocks (3.13.7) sha256=0979034e64b1d7a838aaaddf12bf065ea4dc40ef3d4c39f01f93ae2c66c62b1c
171
156
  rspec-support (3.13.6) sha256=2e8de3702427eab064c9352fe74488cc12a1bfae887ad8b91cba480ec9f8afb2
172
- rubocop (1.82.0) sha256=237b7dc24952d7ec469a9593c7a5283315515e2e7dc24ac91532819c254fc4ec
173
- rubocop-ast (1.48.0) sha256=22df9bbf3f7a6eccde0fad54e68547ae1e2a704bf8719e7c83813a99c05d2e76
157
+ rubocop (1.88.2) sha256=8def251c90cd955feb4daa3edc0ab56893250c4ce90ef81e6c80c03f9a939bbf
158
+ rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
174
159
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
175
160
  sem_version (2.0.1) sha256=6d97d4f67e28546ba90b3c290f901d6c8031ddb8e08bce962139739c4d40b183
176
161
  simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
@@ -179,6 +164,7 @@ CHECKSUMS
179
164
  unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
180
165
  unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
181
166
  uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
167
+ zlib (3.2.3) sha256=5bd316698b32f31a64ab910a8b6c282442ca1626a81bbd6a1674e8522e319c20
182
168
 
183
169
  BUNDLED WITH
184
170
  4.0.3
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- ruby "3.3.10"
5
+ ruby "3.3.11"
6
6
 
7
7
  # 5 prevents us using ruby 3.2 which while EOL is still in our build
8
8
  gem "dalli", "~> 4"
@@ -1,17 +1,18 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- featurehub-sdk (2.1.0)
4
+ featurehub-sdk (2.2.0)
5
5
  concurrent-ruby (~> 1.3)
6
6
  faraday
7
- ld-eventsource (~> 2.5.1)
7
+ faraday-gzip
8
+ ld-eventsource (>= 2.5.1, < 2.7.0)
8
9
  murmurhash3 (~> 0.1.7)
9
10
  sem_version (~> 2.0.0)
10
11
 
11
12
  GEM
12
13
  remote: https://rubygems.org/
13
14
  specs:
14
- addressable (2.8.9)
15
+ addressable (2.9.0)
15
16
  public_suffix (>= 2.0.2, < 8.0)
16
17
  concurrent-ruby (1.3.6)
17
18
  connection_pool (3.0.2)
@@ -20,7 +21,7 @@ GEM
20
21
  logger
21
22
  domain_name (0.6.20240107)
22
23
  eventmachine (1.2.7)
23
- faraday (1.10.5)
24
+ faraday (1.10.6)
24
25
  faraday-em_http (~> 1.0)
25
26
  faraday-em_synchrony (~> 1.0)
26
27
  faraday-excon (~> 1.1)
@@ -35,6 +36,9 @@ GEM
35
36
  faraday-em_http (1.0.0)
36
37
  faraday-em_synchrony (1.0.1)
37
38
  faraday-excon (1.1.0)
39
+ faraday-gzip (2.0.1)
40
+ faraday (>= 1.0)
41
+ zlib (~> 3.0)
38
42
  faraday-httpclient (1.0.1)
39
43
  faraday-multipart (1.2.0)
40
44
  multipart-post (~> 2.0)
@@ -43,6 +47,7 @@ GEM
43
47
  faraday-patron (1.0.0)
44
48
  faraday-rack (1.0.0)
45
49
  faraday-retry (1.0.4)
50
+ ffi (1.17.3-arm64-darwin)
46
51
  ffi (1.17.3-x86_64-darwin)
47
52
  ffi (1.17.3-x86_64-linux-gnu)
48
53
  ffi-compiler (1.3.2)
@@ -90,8 +95,10 @@ GEM
90
95
  eventmachine (~> 1.0, >= 1.0.4)
91
96
  rack (>= 1, < 3)
92
97
  tilt (2.1.0)
98
+ zlib (3.2.3)
93
99
 
94
100
  PLATFORMS
101
+ arm64-darwin-25
95
102
  x86_64-darwin-21
96
103
  x86_64-darwin-24
97
104
  x86_64-linux
@@ -107,7 +114,7 @@ DEPENDENCIES
107
114
  thin
108
115
 
109
116
  RUBY VERSION
110
- ruby 3.3.10p183
117
+ ruby 3.3.11p205
111
118
 
112
119
  BUNDLED WITH
113
120
  2.3.15
@@ -16,5 +16,5 @@ PORT=8099
16
16
  if [[ "$2" == "sec" ]]; then
17
17
  PORT=8100
18
18
  fi
19
-
19
+ mkdir -p logs
20
20
  bundle exec thin -R thin.ru -a 0.0.0.0 -p $PORT start
@@ -36,7 +36,8 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.add_dependency "concurrent-ruby", "~> 1.3"
38
38
  spec.add_dependency "faraday"
39
- spec.add_dependency "ld-eventsource", "~> 2.5.1"
39
+ spec.add_dependency "faraday-gzip"
40
+ spec.add_dependency "ld-eventsource", ">= 2.5.1", "< 2.7.0"
40
41
  spec.add_dependency "murmurhash3", "~> 0.1.7"
41
42
  spec.add_dependency "sem_version", "~> 2.0.0"
42
43
 
@@ -43,6 +43,11 @@ module FeatureHub
43
43
  exists?(fs) ? fs["type"] : nil
44
44
  end
45
45
 
46
+ def feature_properties
47
+ fs = feature_state
48
+ (exists?(fs) ? fs["fp"] : {}) || {}
49
+ end
50
+
46
51
  def with_context(ctx)
47
52
  FeatureStateHolder.new(@key, @repo, nil, self, ctx)
48
53
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "faraday"
4
4
  require "faraday/net_http"
5
+ require "faraday/gzip"
5
6
  require "json"
6
7
  require "concurrent-ruby"
7
8
  require "digest/sha2"
@@ -108,21 +109,27 @@ module FeatureHub
108
109
  headers["if-none-match"] = @etag unless @etag.nil?
109
110
 
110
111
  @logger&.debug("polling for #{url}")
111
- resp = @conn.get url, {}, headers
112
- case resp.status
113
- when 200
114
- success(resp)
115
- when 236
116
- stopped_task
117
- success(resp)
118
- when 404, 400 # no such key
119
- @repository.notify("failed", nil, "polling")
120
- cancel_task
121
- @logger&.error("featurehub: key does not exist, stopping polling")
122
- when 503 # dacha busy
123
- @logger&.debug("featurehub: dacha is busy, trying again")
124
- else
125
- @logger&.debug("featurehub: unknown error #{resp.status}") if resp.status != 304
112
+ begin
113
+ resp = @conn.get url, {}, headers
114
+ case resp.status
115
+ when 200
116
+ success(resp)
117
+ when 236
118
+ stopped_task
119
+ success(resp)
120
+ when 404, 400 # no such key
121
+ @repository.notify("failed", nil, "polling")
122
+ cancel_task
123
+ @logger&.error("featurehub: key does not exist, stopping polling")
124
+ when 503 # dacha busy
125
+ @logger&.debug("featurehub: dacha is busy, trying again")
126
+ else
127
+ @logger&.debug("featurehub: unknown error #{resp.status}") if resp.status != 304
128
+ end
129
+ rescue StandardError => e
130
+ # we can get timeout errors for transient network failures, this should not prevent the
131
+ # next poll from happening however
132
+ @logger&.error("featurehub: failed to connect or similar error #{e&.message}")
126
133
  end
127
134
  end
128
135
 
@@ -168,6 +175,8 @@ module FeatureHub
168
175
  @url = "features?#{api_key_cat}"
169
176
  @timeout = ENV.fetch("FEATUREHUB_POLL_HTTP_TIMEOUT", "12").to_i
170
177
  @conn = Faraday.new(url: @edge_url) do |f|
178
+ # support whatever compression is available from server
179
+ f.request :gzip
171
180
  f.adapter :net_http
172
181
  f.options.timeout = @timeout
173
182
  end
@@ -3,6 +3,6 @@
3
3
  module FeatureHub
4
4
  # already documented elsewhere
5
5
  module Sdk
6
- VERSION = "2.1.0"
6
+ VERSION = "2.2.0"
7
7
  end
8
8
  end
@@ -66,6 +66,8 @@ module FeatureHub
66
66
 
67
67
  def feature_type: -> String?
68
68
 
69
+ def feature_properties: -> Hash[String, String]
70
+
69
71
  def with_context: (ctx: ClientContext) -> FeatureStateHolder
70
72
 
71
73
  def update_feature_state: (feature_state: FeatureState) -> void
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featurehub-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vowles
@@ -38,20 +38,40 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday-gzip
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: ld-eventsource
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
- - - "~>"
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: 2.5.1
62
+ - - "<"
63
+ - !ruby/object:Gem::Version
64
+ version: 2.7.0
48
65
  type: :runtime
49
66
  prerelease: false
50
67
  version_requirements: !ruby/object:Gem::Requirement
51
68
  requirements:
52
- - - "~>"
69
+ - - ">="
53
70
  - !ruby/object:Gem::Version
54
71
  version: 2.5.1
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: 2.7.0
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: murmurhash3
57
77
  requirement: !ruby/object:Gem::Requirement
@@ -230,12 +250,9 @@ files:
230
250
  - examples/sinatra/docker-compose.yaml
231
251
  - examples/sinatra/docker_start.sh
232
252
  - examples/sinatra/feature-flags.yaml
233
- - examples/sinatra/sinatra.iml
234
253
  - examples/sinatra/start.sh
235
254
  - examples/sinatra/thin.ru
236
- - featurehub-ruby-sdk.iml
237
255
  - featurehub-sdk.gemspec
238
- - featurehub-sdk.iml
239
256
  - lib/feature_hub/sdk/context.rb
240
257
  - lib/feature_hub/sdk/feature_hub_config.rb
241
258
  - lib/feature_hub/sdk/feature_repository.rb
@@ -282,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
299
  - !ruby/object:Gem::Version
283
300
  version: '0'
284
301
  requirements: []
285
- rubygems_version: 4.0.6
302
+ rubygems_version: 4.0.16
286
303
  specification_version: 4
287
304
  summary: FeatureHub Ruby SDK
288
305
  test_files: []
@@ -1,51 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="jdk" jdkName="rbenv: 3.3.10" jdkType="RUBY_SDK" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.9, rbenv: 3.3.10) [gem]" level="application" />
9
- <orderEntry type="library" scope="PROVIDED" name="bundler (v2.3.15, rbenv: 3.3.10) [gem]" level="application" />
10
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.6, rbenv: 3.3.10) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="connection_pool (v3.0.2, rbenv: 3.3.10) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="daemons (v1.4.1, rbenv: 3.3.10) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="dalli (v4.3.3, rbenv: 3.3.10) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.6.20240107, rbenv: 3.3.10) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="eventmachine (v1.2.7, rbenv: 3.3.10) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="faraday (v1.10.5, rbenv: 3.3.10) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="faraday-em_http (v1.0.0, rbenv: 3.3.10) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="faraday-em_synchrony (v1.0.1, rbenv: 3.3.10) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="faraday-excon (v1.1.0, rbenv: 3.3.10) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="faraday-httpclient (v1.0.1, rbenv: 3.3.10) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="faraday-multipart (v1.2.0, rbenv: 3.3.10) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="faraday-net_http (v1.0.2, rbenv: 3.3.10) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="faraday-net_http_persistent (v1.2.0, rbenv: 3.3.10) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="faraday-patron (v1.0.0, rbenv: 3.3.10) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="faraday-rack (v1.0.0, rbenv: 3.3.10) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="faraday-retry (v1.0.4, rbenv: 3.3.10) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.3, rbenv: 3.3.10) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="ffi-compiler (v1.3.2, rbenv: 3.3.10) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="http (v5.3.1, rbenv: 3.3.10) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.1.0, rbenv: 3.3.10) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="http-form_data (v2.3.0, rbenv: 3.3.10) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="ld-eventsource (v2.5.1, rbenv: 3.3.10) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="llhttp-ffi (v0.5.1, rbenv: 3.3.10) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, rbenv: 3.3.10) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.4.1, rbenv: 3.3.10) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="murmurhash3 (v0.1.7, rbenv: 3.3.10) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="mustermann (v2.0.2, rbenv: 3.3.10) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="public_suffix (v7.0.5, rbenv: 3.3.10) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="rack (v2.2.6.4, rbenv: 3.3.10) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="rack-protection (v2.2.3, rbenv: 3.3.10) [gem]" level="application" />
41
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.3.1, rbenv: 3.3.10) [gem]" level="application" />
42
- <orderEntry type="library" scope="PROVIDED" name="redis (v5.4.1, rbenv: 3.3.10) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="redis-client (v0.28.0, rbenv: 3.3.10) [gem]" level="application" />
44
- <orderEntry type="library" scope="PROVIDED" name="ruby2_keywords (v0.0.5, rbenv: 3.3.10) [gem]" level="application" />
45
- <orderEntry type="library" scope="PROVIDED" name="sem_version (v2.0.1, rbenv: 3.3.10) [gem]" level="application" />
46
- <orderEntry type="library" scope="PROVIDED" name="shotgun (v0.9.2, rbenv: 3.3.10) [gem]" level="application" />
47
- <orderEntry type="library" scope="PROVIDED" name="sinatra (v2.2.3, rbenv: 3.3.10) [gem]" level="application" />
48
- <orderEntry type="library" scope="PROVIDED" name="thin (v1.8.1, rbenv: 3.3.10) [gem]" level="application" />
49
- <orderEntry type="library" scope="PROVIDED" name="tilt (v2.1.0, rbenv: 3.3.10) [gem]" level="application" />
50
- </component>
51
- </module>
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="JAVA_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="inheritedJdk" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- </component>
9
- </module>
data/featurehub-sdk.iml DELETED
@@ -1,87 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="NewModuleRootManager" inherit-compiler-output="true">
4
- <exclude-output />
5
- <content url="file://$MODULE_DIR$" />
6
- <orderEntry type="jdk" jdkName="rbenv: 3.0.6" jdkType="RUBY_SDK" />
7
- <orderEntry type="sourceFolder" forTests="false" />
8
- <orderEntry type="library" scope="PROVIDED" name="addressable (v2.8.0, rbenv: 3.0.6) [gem]" level="application" />
9
- <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, rbenv: 3.0.6) [gem]" level="application" />
10
- <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.10, rbenv: 3.0.6) [gem]" level="application" />
11
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.0, rbenv: 3.0.6) [gem]" level="application" />
12
- <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.0, rbenv: 3.0.6) [gem]" level="application" />
13
- <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, rbenv: 3.0.6) [gem]" level="application" />
14
- <orderEntry type="library" scope="PROVIDED" name="faraday (v2.3.0, rbenv: 3.0.6) [gem]" level="application" />
15
- <orderEntry type="library" scope="PROVIDED" name="faraday-net_http (v2.0.3, rbenv: 3.0.6) [gem]" level="application" />
16
- <orderEntry type="library" scope="PROVIDED" name="ffi (v1.15.5, rbenv: 3.0.6) [gem]" level="application" />
17
- <orderEntry type="library" scope="PROVIDED" name="ffi-compiler (v1.0.1, rbenv: 3.0.6) [gem]" level="application" />
18
- <orderEntry type="library" scope="PROVIDED" name="http (v5.0.4, rbenv: 3.0.6) [gem]" level="application" />
19
- <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.5, rbenv: 3.0.6) [gem]" level="application" />
20
- <orderEntry type="library" scope="PROVIDED" name="http-form_data (v2.3.0, rbenv: 3.0.6) [gem]" level="application" />
21
- <orderEntry type="library" scope="PROVIDED" name="ld-eventsource (v2.2.0, rbenv: 3.0.6) [gem]" level="application" />
22
- <orderEntry type="library" scope="PROVIDED" name="llhttp-ffi (v0.4.0, rbenv: 3.0.6) [gem]" level="application" />
23
- <orderEntry type="library" scope="PROVIDED" name="murmurhash3 (v0.1.6, rbenv: 3.0.6) [gem]" level="application" />
24
- <orderEntry type="library" scope="PROVIDED" name="parallel (v1.22.1, rbenv: 3.0.6) [gem]" level="application" />
25
- <orderEntry type="library" scope="PROVIDED" name="parser (v3.1.2.0, rbenv: 3.0.6) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="public_suffix (v4.0.7, rbenv: 3.0.6) [gem]" level="application" />
27
- <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.0.6) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 3.0.6) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.5.0, rbenv: 3.0.6) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="rexml (v3.2.5, rbenv: 3.0.6) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.11.0, rbenv: 3.0.6) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.11.0, rbenv: 3.0.6) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.11.0, rbenv: 3.0.6) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.11.1, rbenv: 3.0.6) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.11.0, rbenv: 3.0.6) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.30.1, rbenv: 3.0.6) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.18.0, rbenv: 3.0.6) [gem]" level="application" />
38
- <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.11.0, rbenv: 3.0.6) [gem]" level="application" />
39
- <orderEntry type="library" scope="PROVIDED" name="ruby2_keywords (v0.0.5, rbenv: 3.0.6) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="sem_version (v2.0.1, rbenv: 3.0.6) [gem]" level="application" />
41
- <orderEntry type="library" scope="PROVIDED" name="simplecov (v0.21.2, rbenv: 3.0.6) [gem]" level="application" />
42
- <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.12.3, rbenv: 3.0.6) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, rbenv: 3.0.6) [gem]" level="application" />
44
- <orderEntry type="library" scope="PROVIDED" name="unf (v0.1.4, rbenv: 3.0.6) [gem]" level="application" />
45
- <orderEntry type="library" scope="PROVIDED" name="unf_ext (v0.0.8.2, rbenv: 3.0.6) [gem]" level="application" />
46
- <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.1.0, rbenv: 3.0.6) [gem]" level="application" />
47
- </component>
48
- <component name="RakeTasksCache">
49
- <option name="myRootTask">
50
- <RakeTaskImpl id="rake">
51
- <subtasks>
52
- <RakeTaskImpl description="Build featurehub-sdk-1.2.3.gem into the pkg directory" fullCommand="build" id="build" />
53
- <RakeTaskImpl id="build">
54
- <subtasks>
55
- <RakeTaskImpl description="Generate SHA512 checksum if featurehub-sdk-1.2.3.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
56
- </subtasks>
57
- </RakeTaskImpl>
58
- <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
59
- <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
60
- <RakeTaskImpl description="Build and install featurehub-sdk-1.2.3.gem into system gems" fullCommand="install" id="install" />
61
- <RakeTaskImpl id="install">
62
- <subtasks>
63
- <RakeTaskImpl description="Build and install featurehub-sdk-1.2.3.gem into system gems without network access" fullCommand="install:local" id="local" />
64
- </subtasks>
65
- </RakeTaskImpl>
66
- <RakeTaskImpl description="Create tag v1.2.3 and build and push featurehub-sdk-1.2.3.gem to https://rubygems.org" fullCommand="release[remote]" id="release[remote]" />
67
- <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
68
- <RakeTaskImpl id="rubocop">
69
- <subtasks>
70
- <RakeTaskImpl description="Autocorrect RuboCop offenses" fullCommand="rubocop:auto_correct" id="auto_correct" />
71
- </subtasks>
72
- </RakeTaskImpl>
73
- <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
74
- <RakeTaskImpl description="" fullCommand="default" id="default" />
75
- <RakeTaskImpl description="" fullCommand="release" id="release" />
76
- <RakeTaskImpl id="release">
77
- <subtasks>
78
- <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
79
- <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
80
- <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
81
- </subtasks>
82
- </RakeTaskImpl>
83
- </subtasks>
84
- </RakeTaskImpl>
85
- </option>
86
- </component>
87
- </module>