flipt_client 0.5.0 → 0.7.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 +22 -13
- data/flipt-client-ruby.gemspec +1 -1
- data/lib/ext/darwin_arm64/libfliptengine.dylib +0 -0
- data/lib/ext/darwin_arm64/libfliptengine.rlib +0 -0
- data/lib/ext/darwin_x86_64/libfliptengine.d +1 -0
- data/lib/ext/darwin_x86_64/libfliptengine.dylib +0 -0
- data/lib/ext/darwin_x86_64/libfliptengine.rlib +0 -0
- 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.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 +10 -3
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6d2ba2cc57cac3446b5df105f61a2f1e15ca6bcbbcdfa7306c821f2c562fc5
|
4
|
+
data.tar.gz: 84ec8fa11e6910cbfc5fe50394806190c279be2f32587d7105d16687192fac93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b740a30f15d192a44d4ecf59bd682bdf6097b3260ec5d223c20f3cee4d4a3d5f6e812f705a5f53b03d0d9f9d872e48d520f7d4738f10ec23bb3398a534d641d
|
7
|
+
data.tar.gz: af4e1d93cc2b070488a9f5120f3cfe4ef4bff8bfdac29261b3e4b9ad84767efc9edcb6c42afeafe30049cbd0b971f1a82d912cc1e8ba9fd6b50a53c5c877707f
|
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
|
|
@@ -10,7 +10,16 @@ The `flipt-client-ruby` directory contains the Ruby source code for the Flipt [c
|
|
10
10
|
gem install flipt_client
|
11
11
|
```
|
12
12
|
|
13
|
-
##
|
13
|
+
## Supported Architectures
|
14
|
+
|
15
|
+
This SDK currently supports the following OSes/architectures:
|
16
|
+
|
17
|
+
- Linux x86_64
|
18
|
+
- Linux arm64
|
19
|
+
- MacOS x86_64
|
20
|
+
- MacOS arm64
|
21
|
+
|
22
|
+
### Using System Libffi
|
14
23
|
|
15
24
|
If you are experiencing segfaults when using this gem, you may need to configure `ffi` to use the system libffi instead of the bundled one.
|
16
25
|
|
@@ -34,10 +43,10 @@ require 'flipt_client'
|
|
34
43
|
# "url": "http://localhost:8080",
|
35
44
|
# "update_interval": 120,
|
36
45
|
# "authentication": {
|
37
|
-
# "client_token": "secret"
|
46
|
+
# "client_token": "secret"
|
38
47
|
# }
|
39
48
|
# }
|
40
|
-
#
|
49
|
+
#
|
41
50
|
# You can replace the url with where your upstream Flipt instance points to, the update interval for how long you are willing
|
42
51
|
# to wait for updated flag state, and the auth token if your Flipt instance requires it.
|
43
52
|
client = Flipt::EvaluationClient.new()
|
@@ -50,17 +59,17 @@ puts resp
|
|
50
59
|
|
51
60
|
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
61
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
62
|
+
```bash
|
63
|
+
docker run -d \
|
64
|
+
-p 8080:8080 \
|
65
|
+
-p 9000:9000 \
|
66
|
+
docker.flipt.io/flipt/flipt:latest
|
67
|
+
```
|
59
68
|
|
60
69
|
2. You'll also need to have the `flipt_client` gem installed locally. See [Installation](#installation) above.
|
61
70
|
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
71
|
4. You can then run the load test by running the following command from this folder:
|
63
72
|
|
64
|
-
|
65
|
-
|
66
|
-
|
73
|
+
```bash
|
74
|
+
bundle exec ruby load_test.rb
|
75
|
+
```
|
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'
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
/Users/runner/work/flipt-client-sdks/flipt-client-sdks/target/x86_64-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
|
Binary file
|
Binary file
|
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
|
|
@@ -17,6 +18,8 @@ module Flipt
|
|
17
18
|
case RbConfig::CONFIG['arch']
|
18
19
|
when /arm64-darwin/
|
19
20
|
"ext/darwin_arm64/#{FLIPTENGINE}.dylib"
|
21
|
+
when /x86_64-darwin/
|
22
|
+
"ext/darwin_x86_64/#{FLIPTENGINE}.dylib"
|
20
23
|
when /arm64-linux|aarch64-linux/
|
21
24
|
"ext/linux_arm64/#{FLIPTENGINE}.so"
|
22
25
|
when /x86_64-linux/
|
@@ -55,8 +58,11 @@ module Flipt
|
|
55
58
|
@namespace = namespace
|
56
59
|
|
57
60
|
# set default no auth if not provided
|
58
|
-
authentication = opts.fetch(:authentication,
|
59
|
-
|
61
|
+
authentication = opts.fetch(:authentication, NoAuthentication.new)
|
62
|
+
unless authentication.is_a?(AuthenticationStrategy)
|
63
|
+
raise ArgumentError,
|
64
|
+
'invalid authentication strategy'
|
65
|
+
end
|
60
66
|
|
61
67
|
opts[:authentication] = authentication.strategy
|
62
68
|
|
@@ -98,7 +104,7 @@ module Flipt
|
|
98
104
|
# - :entity_id [String] entity id
|
99
105
|
# - :flag_key [String] flag key
|
100
106
|
def evaluate_batch(batch_evaluation_request = [])
|
101
|
-
|
107
|
+
batch_evaluation_request.each do |request|
|
102
108
|
validate_evaluation_request(request)
|
103
109
|
end
|
104
110
|
|
@@ -115,6 +121,7 @@ module Flipt
|
|
115
121
|
end
|
116
122
|
|
117
123
|
private
|
124
|
+
|
118
125
|
def validate_evaluation_request(evaluation_request)
|
119
126
|
if evaluation_request[:entity_id].nil? || evaluation_request[:entity_id].empty?
|
120
127
|
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.7.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-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flipt Client Evaluation SDK
|
14
14
|
email:
|
@@ -22,6 +22,9 @@ 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/darwin_x86_64/libfliptengine.d
|
26
|
+
- lib/ext/darwin_x86_64/libfliptengine.dylib
|
27
|
+
- lib/ext/darwin_x86_64/libfliptengine.rlib
|
25
28
|
- lib/ext/flipt_engine.h
|
26
29
|
- lib/ext/linux_arm64/libfliptengine.d
|
27
30
|
- lib/ext/linux_arm64/libfliptengine.rlib
|