configcat 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/configcat.rb +21 -3
- data/lib/configcat/configcatclient.rb +6 -6
- data/lib/configcat/configfetcher.rb +3 -1
- data/lib/configcat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f268b80ad6cfa72c12ca3a438d6fc8a896be9dcd324d5f7743274ea1b93935b8
|
4
|
+
data.tar.gz: e9889a6887f63823adacfa9be12f1ede457f0f94d17a2920d6800b6c816a4f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 248a015959119f3629c42df5b6bb9d1b5105a452ea5d3d8054d0110b73fff508f2e551cf7e3ed591330f0037748adf487b7c6678a0385c47e5869613ca8b6d66
|
7
|
+
data.tar.gz: 055ac0dd698e4bd3173ba64c299c9856ad8e2821bd92fd5b0a6e2f25197054ba1ff15bb0c931b6a1bd78ed6eb6ea369d2b08e637db5743154fd73a243b6f3876
|
data/lib/configcat.rb
CHANGED
@@ -40,7 +40,13 @@ module ConfigCat
|
|
40
40
|
if max_init_wait_time_seconds < 0
|
41
41
|
max_init_wait_time_seconds = 0
|
42
42
|
end
|
43
|
-
return ConfigCatClient.new(api_key,
|
43
|
+
return ConfigCatClient.new(api_key,
|
44
|
+
poll_interval_seconds: poll_interval_seconds,
|
45
|
+
max_init_wait_time_seconds: max_init_wait_time_seconds,
|
46
|
+
on_configuration_changed_callback: on_configuration_changed_callback,
|
47
|
+
cache_time_to_live_seconds: 0,
|
48
|
+
config_cache_class: config_cache_class,
|
49
|
+
base_url: base_url)
|
44
50
|
end
|
45
51
|
|
46
52
|
def ConfigCat.create_client_with_lazy_load(api_key, cache_time_to_live_seconds: 60, config_cache_class: nil, base_url: nil)
|
@@ -59,7 +65,13 @@ module ConfigCat
|
|
59
65
|
if cache_time_to_live_seconds < 1
|
60
66
|
cache_time_to_live_seconds = 1
|
61
67
|
end
|
62
|
-
return ConfigCatClient.new(api_key,
|
68
|
+
return ConfigCatClient.new(api_key,
|
69
|
+
poll_interval_seconds: 0,
|
70
|
+
max_init_wait_time_seconds: 0,
|
71
|
+
on_configuration_changed_callback: nil,
|
72
|
+
cache_time_to_live_seconds: cache_time_to_live_seconds,
|
73
|
+
config_cache_class: config_cache_class,
|
74
|
+
base_url: base_url)
|
63
75
|
end
|
64
76
|
|
65
77
|
def ConfigCat.create_client_with_manual_poll(api_key, config_cache_class: nil, base_url: nil)
|
@@ -74,7 +86,13 @@ module ConfigCat
|
|
74
86
|
if api_key === nil
|
75
87
|
raise ConfigCatClientException, "API Key is required."
|
76
88
|
end
|
77
|
-
return ConfigCatClient.new(api_key,
|
89
|
+
return ConfigCatClient.new(api_key,
|
90
|
+
poll_interval_seconds: 0,
|
91
|
+
max_init_wait_time_seconds: 0,
|
92
|
+
on_configuration_changed_callback: nil,
|
93
|
+
cache_time_to_live_seconds: 0,
|
94
|
+
config_cache_class: config_cache_class,
|
95
|
+
base_url: base_url)
|
78
96
|
end
|
79
97
|
|
80
98
|
end
|
@@ -9,12 +9,12 @@ require 'configcat/rolloutevaluator'
|
|
9
9
|
module ConfigCat
|
10
10
|
class ConfigCatClient
|
11
11
|
def initialize(api_key,
|
12
|
-
poll_interval_seconds
|
13
|
-
max_init_wait_time_seconds
|
14
|
-
on_configuration_changed_callback
|
15
|
-
cache_time_to_live_seconds
|
16
|
-
config_cache_class
|
17
|
-
base_url
|
12
|
+
poll_interval_seconds:60,
|
13
|
+
max_init_wait_time_seconds:5,
|
14
|
+
on_configuration_changed_callback:nil,
|
15
|
+
cache_time_to_live_seconds:60,
|
16
|
+
config_cache_class:nil,
|
17
|
+
base_url:nil)
|
18
18
|
if api_key === nil
|
19
19
|
raise ConfigCatClientException, "API Key is required."
|
20
20
|
end
|
@@ -12,6 +12,7 @@ module ConfigCat
|
|
12
12
|
class CacheControlConfigFetcher < ConfigFetcher
|
13
13
|
def initialize(api_key, mode, base_url=nil)
|
14
14
|
@_api_key = api_key
|
15
|
+
@_etag = nil
|
15
16
|
@_headers = {"User-Agent" => ((("ConfigCat-Ruby/") + mode) + ("-")) + VERSION, "X-ConfigCat-UserAgent" => ((("ConfigCat-Ruby/") + mode) + ("-")) + VERSION, "Content-Type" => "application/json"}
|
16
17
|
if !base_url.equal?(nil)
|
17
18
|
@_base_url = base_url.chomp("/")
|
@@ -28,10 +29,11 @@ module ConfigCat
|
|
28
29
|
def get_configuration_json()
|
29
30
|
ConfigCat.logger.debug "Fetching configuration from ConfigCat"
|
30
31
|
uri = URI.parse((((@_base_url + ("/")) + BASE_PATH) + @_api_key) + BASE_EXTENSION)
|
32
|
+
@_headers["If-None-Match"] = @_etag unless @_etag.nil?
|
31
33
|
request = Net::HTTP::Get.new(uri.request_uri, @_headers)
|
32
34
|
response = @_http.request(request)
|
33
35
|
json = JSON.parse(response.body)
|
34
|
-
|
36
|
+
@_etag = response["ETag"]
|
35
37
|
ConfigCat.logger.debug "ConfigCat configuration json fetch response code:#{response.code} Cached:#{response['ETag']}"
|
36
38
|
return json
|
37
39
|
end
|
data/lib/configcat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ConfigCat
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|