configcat 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33a4c0203fd65359fbe8a9f6c01a9bc3dfeee10b84b30c710c7a0c36e36424cf
4
- data.tar.gz: 49bf12953b36c0b30ac77e3dd2cb8ca413b7c5bb2ad5300965f095323c5ed370
3
+ metadata.gz: f268b80ad6cfa72c12ca3a438d6fc8a896be9dcd324d5f7743274ea1b93935b8
4
+ data.tar.gz: e9889a6887f63823adacfa9be12f1ede457f0f94d17a2920d6800b6c816a4f23
5
5
  SHA512:
6
- metadata.gz: 629bf0f3a763666a1840e52329b94f656aeba9fd31c2798655403aa5de49097b6508ac6ab867743dcf421c912f5d4ccee8c8bf012f4505e95a2881221f0f0a92
7
- data.tar.gz: b568f5e461fba75756e5fb40785bcc2a297d25dfe246d28b669251bf084069afbbed37f69a2761e19cc011782417420a0284b4a21662dbf54f62bc560dcd3a30
6
+ metadata.gz: 248a015959119f3629c42df5b6bb9d1b5105a452ea5d3d8054d0110b73fff508f2e551cf7e3ed591330f0037748adf487b7c6678a0385c47e5869613ca8b6d66
7
+ data.tar.gz: 055ac0dd698e4bd3173ba64c299c9856ad8e2821bd92fd5b0a6e2f25197054ba1ff15bb0c931b6a1bd78ed6eb6ea369d2b08e637db5743154fd73a243b6f3876
@@ -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, poll_interval_seconds, max_init_wait_time_seconds, on_configuration_changed_callback, 0, config_cache_class, base_url)
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, 0, 0, nil, cache_time_to_live_seconds, config_cache_class, base_url)
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, 0, 0, nil, 0, config_cache_class, base_url)
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=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)
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
- # TODO: check cached entry
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
@@ -1,3 +1,3 @@
1
1
  module ConfigCat
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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-01 00:00:00.000000000 Z
11
+ date: 2019-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby