prefab-cloud-ruby 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/VERSION +1 -1
- data/lib/prefab/client.rb +4 -3
- data/lib/prefab/logger_client.rb +2 -3
- data/prefab-cloud-ruby.gemspec +6 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b859100b5f964bd49e82089cca141a425f85d38
|
4
|
+
data.tar.gz: 257e08f0c4999df0412116fadd89d7522b3c4773
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53fee2f2d78247d657c829616b32c4807f94049147e1ad0f537ff887626e88724329931c4301e4471271d1376517045e8f858c79b594e0d990893a8dc5017d63
|
7
|
+
data.tar.gz: 614ef6c55d2d0e669b42cd564b5c01fca42a195c47335cd3ace3a738d1daf24b07f584394f53c792432a681ea44cec2cd37b7df7041bc489d6c6f7644beb73fd
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# prefab-cloud-ruby
|
2
|
+
Ruby Client for Prefab RateLimits, FeatureFlags, Config as a Service: https://www.prefab.cloud
|
3
|
+
|
4
|
+
```ruby
|
5
|
+
client = Prefab::Client.new
|
6
|
+
@feature_flags = client.feature_flag_client
|
7
|
+
|
8
|
+
# Create a flag that is on for 10% of traffic, the entire beta group and user:1
|
9
|
+
@feature_flags.upsert(Prefab::FeatureFlag.new(feature: "MyFeature", pct: 0.1, whitelisted: ["betas", "user:1"]))
|
10
|
+
|
11
|
+
# Use Flags By Themselves
|
12
|
+
puts @feature_flags.feature_is_on? "MyFeature" # returns yes 10 pct of the time
|
13
|
+
|
14
|
+
# A single user should get the same result each time
|
15
|
+
puts @feature_flags.feature_is_on? "MyFeature", "user:1123"
|
16
|
+
```
|
17
|
+
See full documentation https://www.prefab.cloud/documentation/installation
|
18
|
+
|
19
|
+
|
20
|
+
## Supports
|
21
|
+
|
22
|
+
* [RateLimits](https://www.prefab.cloud/documentation/basic_rate_limits)
|
23
|
+
* Millions of individual limits sharing the same policies
|
24
|
+
* WebUI for tweaking limits & feature flags
|
25
|
+
* Infinite retention for [deduplication workflows](https://www.prefab.cloud/documentation/once_and_only_once)
|
26
|
+
* [FeatureFlags](https://www.prefab.cloud/documentation/feature_flags) as a Service
|
27
|
+
|
28
|
+
|
29
|
+
## Contributing to ratelimit-ruby
|
30
|
+
|
31
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
32
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
33
|
+
* Fork the project.
|
34
|
+
* Start a feature/bugfix branch.
|
35
|
+
* Commit and push until you are happy with your contribution.
|
36
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
37
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
38
|
+
|
39
|
+
## Copyright
|
40
|
+
|
41
|
+
Copyright (c) 2018 Jeff Dwyer. See LICENSE.txt for
|
42
|
+
further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.20
|
data/lib/prefab/client.rb
CHANGED
@@ -11,11 +11,12 @@ module Prefab
|
|
11
11
|
stats: nil, # receives increment("prefab.limitcheck", {:tags=>["policy_group:page_view", "pass:true"]})
|
12
12
|
shared_cache: nil, # Something that quacks like Rails.cache ideally memcached
|
13
13
|
local: false,
|
14
|
-
namespace: ""
|
14
|
+
namespace: "",
|
15
|
+
log_formatter: nil
|
15
16
|
)
|
16
17
|
raise "No API key. Set PREFAB_API_KEY env var" if api_key.empty?
|
17
|
-
|
18
18
|
@logdev = (logdev || $stdout)
|
19
|
+
@log_formatter = log_formatter
|
19
20
|
@local = local
|
20
21
|
@stats = (stats || NoopStats.new)
|
21
22
|
@shared_cache = (shared_cache || NoopCache.new)
|
@@ -47,7 +48,7 @@ module Prefab
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def log
|
50
|
-
@logger_client ||= Prefab::LoggerClient.new(@logdev)
|
51
|
+
@logger_client ||= Prefab::LoggerClient.new(@logdev, formatter: @log_formatter)
|
51
52
|
end
|
52
53
|
|
53
54
|
def log_internal(level, msg)
|
data/lib/prefab/logger_client.rb
CHANGED
@@ -4,8 +4,8 @@ module Prefab
|
|
4
4
|
SEP = ".".freeze
|
5
5
|
BASE = "log_level".freeze
|
6
6
|
|
7
|
-
def initialize(logdev, shift_age = 0, shift_size = 1048576)
|
8
|
-
super(logdev, shift_age, shift_size)
|
7
|
+
def initialize(logdev, shift_age = 0, shift_size = 1048576, formatter: nil)
|
8
|
+
super(logdev, shift_age, shift_size, formatter: formatter)
|
9
9
|
@config_client = BootstrappingConfigClient.new
|
10
10
|
end
|
11
11
|
|
@@ -22,7 +22,6 @@ module Prefab
|
|
22
22
|
def log_internal(message, path, progname, severity)
|
23
23
|
level = level_of(path)
|
24
24
|
progname = "#{path}: #{progname}"
|
25
|
-
|
26
25
|
severity ||= UNKNOWN
|
27
26
|
if @logdev.nil? or severity < level
|
28
27
|
return true
|
data/prefab-cloud-ruby.gemspec
CHANGED
@@ -2,26 +2,28 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: prefab-cloud-ruby 0.0.
|
5
|
+
# stub: prefab-cloud-ruby 0.0.20 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "prefab-cloud-ruby".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.20"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Jeff Dwyer".freeze]
|
14
|
-
s.date = "2018-04-
|
14
|
+
s.date = "2018-04-20"
|
15
15
|
s.description = "RateLimits & Config as a service".freeze
|
16
16
|
s.email = "jdwyer@prefab.cloud".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt"
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
19
20
|
]
|
20
21
|
s.files = [
|
21
22
|
".ruby-version",
|
22
23
|
"Gemfile",
|
23
24
|
"Gemfile.lock",
|
24
25
|
"LICENSE.txt",
|
26
|
+
"README.md",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
27
29
|
"compile_protos.sh",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prefab-cloud-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Dwyer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -134,11 +134,13 @@ executables: []
|
|
134
134
|
extensions: []
|
135
135
|
extra_rdoc_files:
|
136
136
|
- LICENSE.txt
|
137
|
+
- README.md
|
137
138
|
files:
|
138
139
|
- ".ruby-version"
|
139
140
|
- Gemfile
|
140
141
|
- Gemfile.lock
|
141
142
|
- LICENSE.txt
|
143
|
+
- README.md
|
142
144
|
- Rakefile
|
143
145
|
- VERSION
|
144
146
|
- compile_protos.sh
|