flipt_client 0.4.3 → 0.6.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 +4 -4
- data/README.md +12 -12
- data/flipt-client-ruby.gemspec +1 -1
- data/lib/ext/darwin_arm64/libfliptengine.d +1 -1
- data/lib/ext/darwin_arm64/libfliptengine.dylib +0 -0
- data/lib/ext/darwin_arm64/libfliptengine.rlib +0 -0
- data/lib/ext/linux_arm64/libfliptengine.d +1 -1
- data/lib/ext/linux_arm64/libfliptengine.rlib +0 -0
- data/lib/ext/linux_arm64/libfliptengine.so +0 -0
- data/lib/ext/linux_x86_64/libfliptengine.d +1 -1
- data/lib/ext/linux_x86_64/libfliptengine.rlib +0 -0
- data/lib/ext/linux_x86_64/libfliptengine.so +0 -0
- data/lib/flipt_client/models.rb +7 -3
- data/lib/flipt_client/version.rb +1 -1
- data/lib/flipt_client.rb +8 -3
- metadata +3 -3
- /data/lib/ext/{linux_x86_64/flipt_engine.h → flipt_engine.h} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de6ff1869c9845250a2eaafa0e9b85d9135eabac78b61ddbbe682a8843a2f28
|
4
|
+
data.tar.gz: 2b38cb9f4b60554cdadf1da74904f050f5594f13ef95b69e44ae40b7ceeb3b78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79fbec0e50c4139231536225a8faa53c44e13d87957e624e0078ef897abe574986e2aa8693dfcee5d6ee9920f095b058c250a6d713ab5c78bf27b0314cfff8fe
|
7
|
+
data.tar.gz: 4800d4efa7d12f6f439445f454ce9cb1b3829ec5d470c8624655b9e11985413b792309daf7ad5112cf4948ac05678cb9d3dbf956d0eae5b44bbd717eaaa3fa36
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/flipt_client)
|
4
4
|
|
5
|
-
The `flipt-client-ruby`
|
5
|
+
The `flipt-client-ruby` library contains the Ruby source code for the Flipt [client-side evaluation](https://www.flipt.io/docs/integration/client) client.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -34,10 +34,10 @@ require 'flipt_client'
|
|
34
34
|
# "url": "http://localhost:8080",
|
35
35
|
# "update_interval": 120,
|
36
36
|
# "authentication": {
|
37
|
-
# "client_token": "secret"
|
37
|
+
# "client_token": "secret"
|
38
38
|
# }
|
39
39
|
# }
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# You can replace the url with where your upstream Flipt instance points to, the update interval for how long you are willing
|
42
42
|
# to wait for updated flag state, and the auth token if your Flipt instance requires it.
|
43
43
|
client = Flipt::EvaluationClient.new()
|
@@ -50,17 +50,17 @@ puts resp
|
|
50
50
|
|
51
51
|
1. To run the load test, you'll need to have Flipt running locally. You can do this by running the following command from the root of the repository:
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
53
|
+
```bash
|
54
|
+
docker run -d \
|
55
|
+
-p 8080:8080 \
|
56
|
+
-p 9000:9000 \
|
57
|
+
docker.flipt.io/flipt/flipt:latest
|
58
|
+
```
|
59
59
|
|
60
60
|
2. You'll also need to have the `flipt_client` gem installed locally. See [Installation](#installation) above.
|
61
61
|
3. In the Flipt UI (<http://localhost:8080>) you'll also need to create a new boolean flag with the key `my-feature` in the default namespace.
|
62
62
|
4. You can then run the load test by running the following command from this folder:
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
```bash
|
65
|
+
bundle exec ruby load_test.rb
|
66
|
+
```
|
data/flipt-client-ruby.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
17
17
|
|
18
18
|
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
-
spec.metadata[
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/flipt-io/flipt-client-sdks'
|
20
20
|
|
21
21
|
spec.files = Dir.glob('{lib}/**/*') + ['README.md', 'flipt-client-ruby.gemspec']
|
22
22
|
spec.bindir = 'exe'
|
@@ -1 +1 @@
|
|
1
|
-
/Users/runner/work/flipt-client-sdks/flipt-client-sdks/target/aarch64-apple-darwin/release/libfliptengine.rlib: /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/
|
1
|
+
/Users/runner/work/flipt-client-sdks/flipt-client-sdks/target/aarch64-apple-darwin/release/libfliptengine.rlib: /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/evaluator/mod.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/lib.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/parser/http.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/parser/mod.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/error/mod.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/lib.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/common.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/flipt.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/mod.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/source.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/parser/mod.rs /Users/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/store/mod.rs
|
Binary file
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
/target/aarch64-unknown-linux-gnu/release/libfliptengine.rlib: /project/flipt-engine-ffi/
|
1
|
+
/target/aarch64-unknown-linux-gnu/release/libfliptengine.rlib: /project/flipt-engine-ffi/src/evaluator/mod.rs /project/flipt-engine-ffi/src/lib.rs /project/flipt-engine-ffi/src/parser/http.rs /project/flipt-engine-ffi/src/parser/mod.rs /project/flipt-evaluation/src/error/mod.rs /project/flipt-evaluation/src/lib.rs /project/flipt-evaluation/src/models/common.rs /project/flipt-evaluation/src/models/flipt.rs /project/flipt-evaluation/src/models/mod.rs /project/flipt-evaluation/src/models/source.rs /project/flipt-evaluation/src/parser/mod.rs /project/flipt-evaluation/src/store/mod.rs
|
Binary file
|
Binary file
|
@@ -1 +1 @@
|
|
1
|
-
/home/runner/work/flipt-client-sdks/flipt-client-sdks/target/x86_64-unknown-linux-gnu/release/libfliptengine.rlib: /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/
|
1
|
+
/home/runner/work/flipt-client-sdks/flipt-client-sdks/target/x86_64-unknown-linux-gnu/release/libfliptengine.rlib: /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/evaluator/mod.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/lib.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/parser/http.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-engine-ffi/src/parser/mod.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/error/mod.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/lib.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/common.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/flipt.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/mod.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/models/source.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/parser/mod.rs /home/runner/work/flipt-client-sdks/flipt-client-sdks/flipt-evaluation/src/store/mod.rs
|
Binary file
|
Binary file
|
data/lib/flipt_client/models.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Flipt
|
4
|
+
# AuthenticationStrategy is a base class for different authentication strategies
|
4
5
|
class AuthenticationStrategy
|
5
6
|
def strategy
|
6
|
-
|
7
|
+
raise NotImplementedError
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
11
|
+
# NoAuthentication is a strategy that does not require authentication
|
10
12
|
class NoAuthentication < AuthenticationStrategy
|
11
13
|
def strategy
|
12
14
|
nil
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
18
|
+
# ClientTokenAuthentication is a strategy that uses a client token for authentication
|
16
19
|
class ClientTokenAuthentication < AuthenticationStrategy
|
17
20
|
def initialize(token)
|
18
|
-
|
21
|
+
@token = token
|
19
22
|
end
|
20
23
|
|
21
24
|
def strategy
|
@@ -25,6 +28,7 @@ module Flipt
|
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
31
|
+
# JWTAuthentication is a strategy that uses a JWT token for authentication
|
28
32
|
class JWTAuthentication < AuthenticationStrategy
|
29
33
|
def initialize(token)
|
30
34
|
@token = token
|
@@ -36,4 +40,4 @@ module Flipt
|
|
36
40
|
}
|
37
41
|
end
|
38
42
|
end
|
39
|
-
end
|
43
|
+
end
|
data/lib/flipt_client/version.rb
CHANGED
data/lib/flipt_client.rb
CHANGED
@@ -8,6 +8,7 @@ require 'json'
|
|
8
8
|
module Flipt
|
9
9
|
class Error < StandardError; end
|
10
10
|
|
11
|
+
# EvaluationClient is a Ruby Client Side Evaluation Library for Flipt
|
11
12
|
class EvaluationClient
|
12
13
|
extend FFI::Library
|
13
14
|
|
@@ -55,8 +56,11 @@ module Flipt
|
|
55
56
|
@namespace = namespace
|
56
57
|
|
57
58
|
# set default no auth if not provided
|
58
|
-
authentication = opts.fetch(:authentication,
|
59
|
-
|
59
|
+
authentication = opts.fetch(:authentication, NoAuthentication.new)
|
60
|
+
unless authentication.is_a?(AuthenticationStrategy)
|
61
|
+
raise ArgumentError,
|
62
|
+
'invalid authentication strategy'
|
63
|
+
end
|
60
64
|
|
61
65
|
opts[:authentication] = authentication.strategy
|
62
66
|
|
@@ -98,7 +102,7 @@ module Flipt
|
|
98
102
|
# - :entity_id [String] entity id
|
99
103
|
# - :flag_key [String] flag key
|
100
104
|
def evaluate_batch(batch_evaluation_request = [])
|
101
|
-
|
105
|
+
batch_evaluation_request.each do |request|
|
102
106
|
validate_evaluation_request(request)
|
103
107
|
end
|
104
108
|
|
@@ -115,6 +119,7 @@ module Flipt
|
|
115
119
|
end
|
116
120
|
|
117
121
|
private
|
122
|
+
|
118
123
|
def validate_evaluation_request(evaluation_request)
|
119
124
|
if evaluation_request[:entity_id].nil? || evaluation_request[:entity_id].empty?
|
120
125
|
raise ArgumentError, 'entity_id is required'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipt_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flipt Devs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flipt Client Evaluation SDK
|
14
14
|
email:
|
@@ -22,10 +22,10 @@ files:
|
|
22
22
|
- lib/ext/darwin_arm64/libfliptengine.d
|
23
23
|
- lib/ext/darwin_arm64/libfliptengine.dylib
|
24
24
|
- lib/ext/darwin_arm64/libfliptengine.rlib
|
25
|
+
- lib/ext/flipt_engine.h
|
25
26
|
- lib/ext/linux_arm64/libfliptengine.d
|
26
27
|
- lib/ext/linux_arm64/libfliptengine.rlib
|
27
28
|
- lib/ext/linux_arm64/libfliptengine.so
|
28
|
-
- lib/ext/linux_x86_64/flipt_engine.h
|
29
29
|
- lib/ext/linux_x86_64/libfliptengine.d
|
30
30
|
- lib/ext/linux_x86_64/libfliptengine.rlib
|
31
31
|
- lib/ext/linux_x86_64/libfliptengine.so
|
File without changes
|