prefab-cloud-ruby 0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +5 -5
  2. data/.ruby-version +1 -0
  3. data/Gemfile +9 -22
  4. data/Gemfile.lock +88 -160
  5. data/LICENSE.txt +1 -1
  6. data/Rakefile +14 -14
  7. data/VERSION +1 -1
  8. data/lib/prefab/auth_interceptor.rb +25 -0
  9. data/lib/prefab/client.rb +34 -139
  10. data/lib/prefab/config_client.rb +23 -275
  11. data/lib/prefab/config_loader.rb +27 -60
  12. data/lib/prefab/config_resolver.rb +40 -53
  13. data/lib/prefab/noop_cache.rb +13 -0
  14. data/lib/prefab/noop_stats.rb +8 -0
  15. data/lib/prefab/prefab_pb.rb +39 -0
  16. data/lib/prefab/prefab_services_pb.rb +37 -0
  17. data/lib/prefab/ratelimit_client.rb +58 -0
  18. data/lib/prefab/ratelimit_pb.rb +125 -0
  19. data/lib/prefab/store.rb +29 -0
  20. data/lib/prefab_client.rb +35 -0
  21. metadata +36 -198
  22. data/.envrc.sample +0 -3
  23. data/.github/workflows/ruby.yml +0 -46
  24. data/.gitmodules +0 -3
  25. data/.rubocop.yml +0 -13
  26. data/.tool-versions +0 -1
  27. data/CHANGELOG.md +0 -169
  28. data/CODEOWNERS +0 -1
  29. data/README.md +0 -94
  30. data/bin/console +0 -21
  31. data/compile_protos.sh +0 -18
  32. data/lib/prefab/config_client_presenter.rb +0 -18
  33. data/lib/prefab/config_value_unwrapper.rb +0 -115
  34. data/lib/prefab/config_value_wrapper.rb +0 -18
  35. data/lib/prefab/context.rb +0 -179
  36. data/lib/prefab/context_shape.rb +0 -20
  37. data/lib/prefab/context_shape_aggregator.rb +0 -65
  38. data/lib/prefab/criteria_evaluator.rb +0 -136
  39. data/lib/prefab/encryption.rb +0 -65
  40. data/lib/prefab/error.rb +0 -6
  41. data/lib/prefab/errors/env_var_parse_error.rb +0 -11
  42. data/lib/prefab/errors/initialization_timeout_error.rb +0 -13
  43. data/lib/prefab/errors/invalid_api_key_error.rb +0 -19
  44. data/lib/prefab/errors/missing_default_error.rb +0 -13
  45. data/lib/prefab/errors/missing_env_var_error.rb +0 -11
  46. data/lib/prefab/errors/uninitialized_error.rb +0 -13
  47. data/lib/prefab/evaluation.rb +0 -52
  48. data/lib/prefab/evaluation_summary_aggregator.rb +0 -87
  49. data/lib/prefab/example_contexts_aggregator.rb +0 -78
  50. data/lib/prefab/exponential_backoff.rb +0 -21
  51. data/lib/prefab/feature_flag_client.rb +0 -42
  52. data/lib/prefab/http_connection.rb +0 -41
  53. data/lib/prefab/internal_logger.rb +0 -16
  54. data/lib/prefab/local_config_parser.rb +0 -151
  55. data/lib/prefab/log_path_aggregator.rb +0 -69
  56. data/lib/prefab/logger_client.rb +0 -264
  57. data/lib/prefab/murmer3.rb +0 -50
  58. data/lib/prefab/options.rb +0 -208
  59. data/lib/prefab/periodic_sync.rb +0 -69
  60. data/lib/prefab/prefab.rb +0 -56
  61. data/lib/prefab/rate_limit_cache.rb +0 -41
  62. data/lib/prefab/resolved_config_presenter.rb +0 -86
  63. data/lib/prefab/time_helpers.rb +0 -7
  64. data/lib/prefab/weighted_value_resolver.rb +0 -42
  65. data/lib/prefab/yaml_config_parser.rb +0 -34
  66. data/lib/prefab-cloud-ruby.rb +0 -57
  67. data/lib/prefab_pb.rb +0 -93
  68. data/prefab-cloud-ruby.gemspec +0 -155
  69. data/test/.prefab.default.config.yaml +0 -2
  70. data/test/.prefab.unit_tests.config.yaml +0 -28
  71. data/test/integration_test.rb +0 -150
  72. data/test/integration_test_helpers.rb +0 -151
  73. data/test/support/common_helpers.rb +0 -180
  74. data/test/support/mock_base_client.rb +0 -42
  75. data/test/support/mock_config_client.rb +0 -19
  76. data/test/support/mock_config_loader.rb +0 -1
  77. data/test/test_client.rb +0 -444
  78. data/test/test_config_client.rb +0 -109
  79. data/test/test_config_loader.rb +0 -117
  80. data/test/test_config_resolver.rb +0 -430
  81. data/test/test_config_value_unwrapper.rb +0 -224
  82. data/test/test_config_value_wrapper.rb +0 -42
  83. data/test/test_context.rb +0 -203
  84. data/test/test_context_shape.rb +0 -50
  85. data/test/test_context_shape_aggregator.rb +0 -147
  86. data/test/test_criteria_evaluator.rb +0 -726
  87. data/test/test_encryption.rb +0 -16
  88. data/test/test_evaluation_summary_aggregator.rb +0 -162
  89. data/test/test_example_contexts_aggregator.rb +0 -238
  90. data/test/test_exponential_backoff.rb +0 -18
  91. data/test/test_feature_flag_client.rb +0 -48
  92. data/test/test_helper.rb +0 -17
  93. data/test/test_integration.rb +0 -58
  94. data/test/test_local_config_parser.rb +0 -147
  95. data/test/test_log_path_aggregator.rb +0 -62
  96. data/test/test_logger.rb +0 -621
  97. data/test/test_logger_initialization.rb +0 -12
  98. data/test/test_options.rb +0 -75
  99. data/test/test_prefab.rb +0 -12
  100. data/test/test_rate_limit_cache.rb +0 -44
  101. data/test/test_weighted_value_resolver.rb +0 -71
@@ -0,0 +1,58 @@
1
+ module Prefab
2
+ class RateLimitClient
3
+ def initialize(ratelimit_service, client)
4
+ @ratelimit_service = ratelimit_service
5
+ @client = client
6
+ end
7
+
8
+ def pass?(group)
9
+ result = acquire([group], 1)
10
+ return result.passed
11
+ end
12
+
13
+ def acquire(groups, acquire_amount, allow_partial_response: false, on_error: :log_and_pass)
14
+ expiry_cache_key = "prefab.ratelimit.expiry:#{groups.join(".")}"
15
+ expiry = @client.shared_cache.read(expiry_cache_key)
16
+ if !expiry.nil? && Integer(expiry) > Time.now.utc.to_f * 1000
17
+ @client.stats.increment("prefab.ratelimit.limitcheck.expirycache.hit", tags: [])
18
+ return It::Ratelim::Data::LimitResponse.new(passed: false, amount: 0)
19
+ end
20
+
21
+ req = It::Ratelim::Data::LimitRequest.new(
22
+ account_id: @client.account_id,
23
+ acquire_amount: acquire_amount,
24
+ groups: groups,
25
+ allow_partial_response: allow_partial_response
26
+ )
27
+
28
+ result = @ratelimit_service.limit_check(req)
29
+
30
+ reset = result.limit_reset_at
31
+ @client.shared_cache.write(expiry_cache_key, reset) unless reset < 1
32
+
33
+ @client.stats.increment("prefab.ratelimit.limitcheck", tags: ["policy_group:#{result.policy_group}", "pass:#{result.passed}"])
34
+
35
+ result
36
+
37
+ rescue => e
38
+ handle_error(e, on_error)
39
+ end
40
+
41
+ private
42
+
43
+ def handle_error(e, on_error)
44
+ @client.stats.increment("prefab.ratelimit.error", tags: ["type:limit"])
45
+ case on_error
46
+ when :log_and_pass
47
+ @client.logger.warn(e)
48
+ It::Ratelim::Data::LimitResponse.new(passed: true, amount: 0)
49
+ when :log_and_hit
50
+ @client.logger.warn(e)
51
+ It::Ratelim::Data::LimitResponse.new(passed: false, amount: 0)
52
+ when :throw
53
+ raise e
54
+ end
55
+ end
56
+ end
57
+ end
58
+
@@ -0,0 +1,125 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: ratelimit.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ require 'google/protobuf/wrappers_pb'
7
+ Google::Protobuf::DescriptorPool.generated_pool.build do
8
+ add_message "it.ratelim.data.LimitResponse" do
9
+ optional :passed, :bool, 1
10
+ optional :expires_at, :int64, 2
11
+ optional :enforced_group, :string, 3
12
+ optional :current_bucket, :int64, 4
13
+ optional :policy_group, :string, 5
14
+ optional :policy_name, :enum, 6, "it.ratelim.data.LimitResponse.LimitPolicyNames"
15
+ optional :policy_limit, :int32, 7
16
+ optional :amount, :int64, 8
17
+ optional :limit_reset_at, :int64, 9
18
+ optional :safety_level, :enum, 10, "it.ratelim.data.LimitDefinition.SafetyLevel"
19
+ end
20
+ add_enum "it.ratelim.data.LimitResponse.LimitPolicyNames" do
21
+ value :NOT_SET, 0
22
+ value :SECONDLY_ROLLING, 1
23
+ value :MINUTELY_ROLLING, 3
24
+ value :HOURLY_ROLLING, 5
25
+ value :DAILY_ROLLING, 7
26
+ value :MONTHLY_ROLLING, 8
27
+ value :INFINITE, 9
28
+ value :YEARLY_ROLLING, 10
29
+ end
30
+ add_message "it.ratelim.data.LimitRequest" do
31
+ optional :account_id, :int64, 1
32
+ optional :acquire_amount, :int32, 2
33
+ repeated :groups, :string, 3
34
+ optional :limit_combiner, :enum, 4, "it.ratelim.data.LimitRequest.LimitCombiner"
35
+ optional :allow_partial_response, :bool, 5
36
+ end
37
+ add_enum "it.ratelim.data.LimitRequest.LimitCombiner" do
38
+ value :NOT_SET, 0
39
+ value :MINIMUM, 1
40
+ value :MAXIMUM, 2
41
+ end
42
+ add_message "it.ratelim.data.FeatureFlag" do
43
+ optional :account_id, :int64, 1
44
+ optional :feature, :string, 2
45
+ optional :pct, :double, 3
46
+ repeated :whitelisted, :string, 4
47
+ optional :prior_feature_name, :string, 5
48
+ end
49
+ add_message "it.ratelim.data.LimitDefinition" do
50
+ optional :group, :string, 1
51
+ optional :policy_name, :enum, 2, "it.ratelim.data.LimitResponse.LimitPolicyNames"
52
+ optional :limit, :int32, 3
53
+ optional :burst, :int32, 4
54
+ optional :account_id, :int64, 5
55
+ optional :last_modified, :int64, 6
56
+ optional :returnable, :bool, 7
57
+ optional :safety_level, :enum, 8, "it.ratelim.data.LimitDefinition.SafetyLevel"
58
+ end
59
+ add_enum "it.ratelim.data.LimitDefinition.SafetyLevel" do
60
+ value :NOT_SET, 0
61
+ value :L4_BEST_EFFORT, 4
62
+ value :L5_BOMBPROOF, 5
63
+ end
64
+ add_message "it.ratelim.data.LimitDefinitions" do
65
+ repeated :definitions, :message, 1, "it.ratelim.data.LimitDefinition"
66
+ end
67
+ add_message "it.ratelim.data.FeatureFlags" do
68
+ repeated :flags, :message, 1, "it.ratelim.data.FeatureFlag"
69
+ optional :cache_expiry, :int64, 2
70
+ end
71
+ add_message "it.ratelim.data.BucketWrite" do
72
+ optional :tokenBucket, :message, 1, "it.ratelim.data.TokenBucket"
73
+ optional :bucket, :string, 2
74
+ end
75
+ add_message "it.ratelim.data.TokenBucket" do
76
+ optional :current_value, :int64, 1
77
+ optional :time_key, :int64, 2
78
+ repeated :expiries, :int64, 3
79
+ end
80
+ add_message "it.ratelim.data.BufferedRequest" do
81
+ optional :account_id, :int64, 1
82
+ optional :method, :string, 2
83
+ optional :uri, :string, 3
84
+ optional :body, :string, 4
85
+ repeated :limit_groups, :string, 5
86
+ optional :content_type, :string, 6
87
+ optional :fifo, :bool, 7
88
+ end
89
+ add_message "it.ratelim.data.BatchRequest" do
90
+ optional :account_id, :int64, 1
91
+ optional :method, :string, 2
92
+ optional :uri, :string, 3
93
+ optional :body, :string, 4
94
+ repeated :limit_groups, :string, 5
95
+ optional :batch_template, :string, 6
96
+ optional :batch_separator, :string, 7
97
+ end
98
+ add_enum "it.ratelim.data.OnFailure" do
99
+ value :NOT_SET, 0
100
+ value :LOG_AND_PASS, 1
101
+ value :LOG_AND_FAIL, 2
102
+ value :THROW, 3
103
+ end
104
+ end
105
+
106
+ module It
107
+ module Ratelim
108
+ module Data
109
+ LimitResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitResponse").msgclass
110
+ LimitResponse::LimitPolicyNames = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitResponse.LimitPolicyNames").enummodule
111
+ LimitRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitRequest").msgclass
112
+ LimitRequest::LimitCombiner = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitRequest.LimitCombiner").enummodule
113
+ FeatureFlag = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.FeatureFlag").msgclass
114
+ LimitDefinition = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitDefinition").msgclass
115
+ LimitDefinition::SafetyLevel = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitDefinition.SafetyLevel").enummodule
116
+ LimitDefinitions = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.LimitDefinitions").msgclass
117
+ FeatureFlags = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.FeatureFlags").msgclass
118
+ BucketWrite = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.BucketWrite").msgclass
119
+ TokenBucket = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.TokenBucket").msgclass
120
+ BufferedRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.BufferedRequest").msgclass
121
+ BatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.BatchRequest").msgclass
122
+ OnFailure = Google::Protobuf::DescriptorPool.generated_pool.lookup("it.ratelim.data.OnFailure").enummodule
123
+ end
124
+ end
125
+ end
@@ -0,0 +1,29 @@
1
+ require "concurrent/atomics"
2
+
3
+ module EzConfig
4
+ class Store
5
+ def initialize
6
+ @store = Concurrent::Map
7
+ @lock = Concurrent::ReadWriteLock.new
8
+ end
9
+
10
+ def get(key)
11
+ @lock.with_read_lock do
12
+ @store[key]
13
+ end
14
+ end
15
+
16
+ def all
17
+ @lock.with_read_lock do
18
+ @store.all
19
+ end
20
+ end
21
+
22
+ def init(fs)
23
+ @lock.with_write_lock do
24
+ @store.replace(fs)
25
+ @initialized.make_true
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ Bundler.require(:default, :development)
5
+ require "concurrent/atomics"
6
+ require 'concurrent'
7
+ require_relative 'prefab/prefab_pb'
8
+ require_relative 'prefab/prefab_services_pb'
9
+ require_relative 'prefab/ratelimit_pb'
10
+ require_relative 'prefab/config_loader'
11
+ require_relative 'prefab/config_resolver'
12
+ require_relative 'prefab/client'
13
+ require_relative 'prefab/ratelimit_client'
14
+ require_relative 'prefab/config_client'
15
+ require_relative 'prefab/auth_interceptor'
16
+ require_relative 'prefab/noop_cache'
17
+ require_relative 'prefab/noop_stats'
18
+
19
+
20
+ client = Prefab::Client.new(api_key: ENV["RATELIMIT_API_KEY"], local: false)
21
+
22
+ start = Time.now
23
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
24
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
25
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
26
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
27
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
28
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
29
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
30
+ puts "pass? #{client.ratelimit_client.pass? "hubtest.secondly"}"
31
+
32
+ puts "took #{Time.now - start}"
33
+
34
+ # @@prefab = Prefab::Client.new(api_key: ENV["RATELIMIT_API_KEY"], local: true)
35
+ # @@prefab.rate_limits.check()
metadata CHANGED
@@ -1,51 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prefab-cloud-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: '0'
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Dwyer
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-22 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: concurrent-ruby
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.0'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.0.5
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.0'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.0.5
33
- - !ruby/object:Gem::Dependency
34
- name: faraday
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
- - !ruby/object:Gem::Dependency
48
- name: googleapis-common-protos-types
14
+ name: grpc
49
15
  requirement: !ruby/object:Gem::Requirement
50
16
  requirements:
51
17
  - - ">="
@@ -59,21 +25,7 @@ dependencies:
59
25
  - !ruby/object:Gem::Version
60
26
  version: '0'
61
27
  - !ruby/object:Gem::Dependency
62
- name: google-protobuf
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- type: :runtime
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: '0'
75
- - !ruby/object:Gem::Dependency
76
- name: ld-eventsource
28
+ name: concurrent-ruby
77
29
  requirement: !ruby/object:Gem::Requirement
78
30
  requirements:
79
31
  - - ">="
@@ -87,13 +39,13 @@ dependencies:
87
39
  - !ruby/object:Gem::Version
88
40
  version: '0'
89
41
  - !ruby/object:Gem::Dependency
90
- name: uuid
42
+ name: grpc-tools
91
43
  requirement: !ruby/object:Gem::Requirement
92
44
  requirements:
93
45
  - - ">="
94
46
  - !ruby/object:Gem::Version
95
47
  version: '0'
96
- type: :runtime
48
+ type: :development
97
49
  prerelease: false
98
50
  version_requirements: !ruby/object:Gem::Requirement
99
51
  requirements:
@@ -101,41 +53,13 @@ dependencies:
101
53
  - !ruby/object:Gem::Version
102
54
  version: '0'
103
55
  - !ruby/object:Gem::Dependency
104
- name: activesupport
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - ">="
108
- - !ruby/object:Gem::Version
109
- version: '4'
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- version: '4'
117
- - !ruby/object:Gem::Dependency
118
- name: actionpack
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '4'
124
- type: :runtime
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '4'
131
- - !ruby/object:Gem::Dependency
132
- name: semantic_logger
56
+ name: shoulda
133
57
  requirement: !ruby/object:Gem::Requirement
134
58
  requirements:
135
59
  - - ">="
136
60
  - !ruby/object:Gem::Version
137
61
  version: '0'
138
- type: :runtime
62
+ type: :development
139
63
  prerelease: false
140
64
  version_requirements: !ruby/object:Gem::Requirement
141
65
  requirements:
@@ -143,61 +67,47 @@ dependencies:
143
67
  - !ruby/object:Gem::Version
144
68
  version: '0'
145
69
  - !ruby/object:Gem::Dependency
146
- name: benchmark-ips
70
+ name: rdoc
147
71
  requirement: !ruby/object:Gem::Requirement
148
72
  requirements:
149
- - - ">="
73
+ - - "~>"
150
74
  - !ruby/object:Gem::Version
151
- version: '0'
75
+ version: '3.12'
152
76
  type: :development
153
77
  prerelease: false
154
78
  version_requirements: !ruby/object:Gem::Requirement
155
79
  requirements:
156
- - - ">="
80
+ - - "~>"
157
81
  - !ruby/object:Gem::Version
158
- version: '0'
82
+ version: '3.12'
159
83
  - !ruby/object:Gem::Dependency
160
84
  name: bundler
161
85
  requirement: !ruby/object:Gem::Requirement
162
86
  requirements:
163
- - - ">="
87
+ - - "~>"
164
88
  - !ruby/object:Gem::Version
165
- version: '0'
89
+ version: '1.0'
166
90
  type: :development
167
91
  prerelease: false
168
92
  version_requirements: !ruby/object:Gem::Requirement
169
93
  requirements:
170
- - - ">="
94
+ - - "~>"
171
95
  - !ruby/object:Gem::Version
172
- version: '0'
96
+ version: '1.0'
173
97
  - !ruby/object:Gem::Dependency
174
98
  name: juwelier
175
99
  requirement: !ruby/object:Gem::Requirement
176
100
  requirements:
177
101
  - - "~>"
178
102
  - !ruby/object:Gem::Version
179
- version: 2.4.9
103
+ version: 2.1.0
180
104
  type: :development
181
105
  prerelease: false
182
106
  version_requirements: !ruby/object:Gem::Requirement
183
107
  requirements:
184
108
  - - "~>"
185
109
  - !ruby/object:Gem::Version
186
- version: 2.4.9
187
- - !ruby/object:Gem::Dependency
188
- name: rdoc
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- version: '0'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: '0'
110
+ version: 2.1.0
201
111
  - !ruby/object:Gem::Dependency
202
112
  name: simplecov
203
113
  requirement: !ruby/object:Gem::Requirement
@@ -212,110 +122,37 @@ dependencies:
212
122
  - - ">="
213
123
  - !ruby/object:Gem::Version
214
124
  version: '0'
215
- description: Feature Flags, Live Config, and Dynamic Log Levels as a service
125
+ description: RateLimits & Config as a service
216
126
  email: jdwyer@prefab.cloud
217
- executables:
218
- - console
127
+ executables: []
219
128
  extensions: []
220
129
  extra_rdoc_files:
221
- - CHANGELOG.md
222
130
  - LICENSE.txt
223
- - README.md
224
131
  files:
225
- - ".envrc.sample"
226
- - ".github/workflows/ruby.yml"
227
- - ".gitmodules"
228
- - ".rubocop.yml"
229
- - ".tool-versions"
230
- - CHANGELOG.md
231
- - CODEOWNERS
132
+ - ".ruby-version"
232
133
  - Gemfile
233
134
  - Gemfile.lock
234
135
  - LICENSE.txt
235
- - README.md
236
136
  - Rakefile
237
137
  - VERSION
238
- - bin/console
239
- - compile_protos.sh
240
- - lib/prefab-cloud-ruby.rb
138
+ - lib/prefab/auth_interceptor.rb
241
139
  - lib/prefab/client.rb
242
140
  - lib/prefab/config_client.rb
243
- - lib/prefab/config_client_presenter.rb
244
141
  - lib/prefab/config_loader.rb
245
142
  - lib/prefab/config_resolver.rb
246
- - lib/prefab/config_value_unwrapper.rb
247
- - lib/prefab/config_value_wrapper.rb
248
- - lib/prefab/context.rb
249
- - lib/prefab/context_shape.rb
250
- - lib/prefab/context_shape_aggregator.rb
251
- - lib/prefab/criteria_evaluator.rb
252
- - lib/prefab/encryption.rb
253
- - lib/prefab/error.rb
254
- - lib/prefab/errors/env_var_parse_error.rb
255
- - lib/prefab/errors/initialization_timeout_error.rb
256
- - lib/prefab/errors/invalid_api_key_error.rb
257
- - lib/prefab/errors/missing_default_error.rb
258
- - lib/prefab/errors/missing_env_var_error.rb
259
- - lib/prefab/errors/uninitialized_error.rb
260
- - lib/prefab/evaluation.rb
261
- - lib/prefab/evaluation_summary_aggregator.rb
262
- - lib/prefab/example_contexts_aggregator.rb
263
- - lib/prefab/exponential_backoff.rb
264
- - lib/prefab/feature_flag_client.rb
265
- - lib/prefab/http_connection.rb
266
- - lib/prefab/internal_logger.rb
267
- - lib/prefab/local_config_parser.rb
268
- - lib/prefab/log_path_aggregator.rb
269
- - lib/prefab/logger_client.rb
270
- - lib/prefab/murmer3.rb
271
- - lib/prefab/options.rb
272
- - lib/prefab/periodic_sync.rb
273
- - lib/prefab/prefab.rb
274
- - lib/prefab/rate_limit_cache.rb
275
- - lib/prefab/resolved_config_presenter.rb
276
- - lib/prefab/time_helpers.rb
277
- - lib/prefab/weighted_value_resolver.rb
278
- - lib/prefab/yaml_config_parser.rb
279
- - lib/prefab_pb.rb
280
- - prefab-cloud-ruby.gemspec
281
- - test/.prefab.default.config.yaml
282
- - test/.prefab.unit_tests.config.yaml
283
- - test/integration_test.rb
284
- - test/integration_test_helpers.rb
285
- - test/support/common_helpers.rb
286
- - test/support/mock_base_client.rb
287
- - test/support/mock_config_client.rb
288
- - test/support/mock_config_loader.rb
289
- - test/test_client.rb
290
- - test/test_config_client.rb
291
- - test/test_config_loader.rb
292
- - test/test_config_resolver.rb
293
- - test/test_config_value_unwrapper.rb
294
- - test/test_config_value_wrapper.rb
295
- - test/test_context.rb
296
- - test/test_context_shape.rb
297
- - test/test_context_shape_aggregator.rb
298
- - test/test_criteria_evaluator.rb
299
- - test/test_encryption.rb
300
- - test/test_evaluation_summary_aggregator.rb
301
- - test/test_example_contexts_aggregator.rb
302
- - test/test_exponential_backoff.rb
303
- - test/test_feature_flag_client.rb
304
- - test/test_helper.rb
305
- - test/test_integration.rb
306
- - test/test_local_config_parser.rb
307
- - test/test_log_path_aggregator.rb
308
- - test/test_logger.rb
309
- - test/test_logger_initialization.rb
310
- - test/test_options.rb
311
- - test/test_prefab.rb
312
- - test/test_rate_limit_cache.rb
313
- - test/test_weighted_value_resolver.rb
143
+ - lib/prefab/noop_cache.rb
144
+ - lib/prefab/noop_stats.rb
145
+ - lib/prefab/prefab_pb.rb
146
+ - lib/prefab/prefab_services_pb.rb
147
+ - lib/prefab/ratelimit_client.rb
148
+ - lib/prefab/ratelimit_pb.rb
149
+ - lib/prefab/store.rb
150
+ - lib/prefab_client.rb
314
151
  homepage: http://github.com/prefab-cloud/prefab-cloud-ruby
315
152
  licenses:
316
153
  - MIT
317
154
  metadata: {}
318
- post_install_message:
155
+ post_install_message:
319
156
  rdoc_options: []
320
157
  require_paths:
321
158
  - lib
@@ -330,8 +167,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
167
  - !ruby/object:Gem::Version
331
168
  version: '0'
332
169
  requirements: []
333
- rubygems_version: 3.2.32
334
- signing_key:
170
+ rubyforge_project:
171
+ rubygems_version: 2.6.14
172
+ signing_key:
335
173
  specification_version: 4
336
174
  summary: Prefab Ruby Infrastructure
337
175
  test_files: []
data/.envrc.sample DELETED
@@ -1,3 +0,0 @@
1
- export AWS_ACCESS_KEY_ID=
2
- export AWS_SECRET_ACCESS_KEY=
3
- export PREFAB_INTEGRATION_TEST_API_KEY=
@@ -1,46 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on:
11
- push:
12
- branches: [ "main" ]
13
- pull_request:
14
- branches: [ "main" ]
15
-
16
- permissions:
17
- contents: read
18
-
19
- jobs:
20
- test:
21
-
22
- runs-on: ubuntu-latest
23
- strategy:
24
- matrix:
25
- ruby-version: ['2.7', '3.0', '3.1']
26
-
27
- steps:
28
- - uses: actions/checkout@v3
29
- with:
30
- submodules: recursive
31
- - name: Set up Ruby
32
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
33
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
34
- # uses: ruby/setup-ruby@v1
35
- # uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
36
- uses: ruby/setup-ruby@v1
37
- with:
38
- ruby-version: ${{ matrix.ruby-version }}
39
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
40
- - name: Run tests
41
- run: bundle exec rake
42
- env:
43
- PREFAB_INTEGRATION_TEST_API_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_API_KEY }}
44
- PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY: ${{ secrets.PREFAB_INTEGRATION_TEST_ENCRYPTION_KEY }}
45
- NOT_A_NUMBER: "abcd"
46
- IS_A_NUMBER: "1234"
data/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "test/prefab-cloud-integration-test-data"]
2
- path = test/prefab-cloud-integration-test-data
3
- url = git@github.com:prefab-cloud/prefab-cloud-integration-test-data
data/.rubocop.yml DELETED
@@ -1,13 +0,0 @@
1
- AllCops:
2
- NewCops: enable
3
- Exclude:
4
- - prefab-cloud-ruby.gemspec
5
- - lib/prefab_pb.rb
6
-
7
- Metrics:
8
- Exclude:
9
- - 'test/*.rb'
10
-
11
- Layout/LineLength:
12
- Exclude:
13
- - 'test/*.rb'
data/.tool-versions DELETED
@@ -1 +0,0 @@
1
- ruby 3.0.3