flipt_client 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ext/darwin_arm64/libfliptengine.dylib +0 -0
- data/lib/ext/darwin_arm64/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/flipt_engine.h +8 -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/version.rb +1 -1
- data/lib/flipt_client.rb +15 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b215784ecdfee2e32670729baa30065fa62cb5a15892b771be440f23a59cf369
|
4
|
+
data.tar.gz: 3bf57a74117b84e369de9ebc02060c56ca3a4c1418e1a1ac103f98ec14d03918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c6a4f7da51c788a3162531ca0d71375f2c831c23577e8f6eb09a0b8bf937209f72e8310918b06a750b60cedf21b74cd41aae8e64a3c9b885d0778b23ffd737e
|
7
|
+
data.tar.gz: 124eac66ca2f98e1fd42fded512d6cf46bdc1e0d6b945ee45539c05eb6f4a0ca15e89f183bc8ae00fd9997fa3af84d7f018083323c6cc4019ade59b8c314ab89
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -44,3 +44,11 @@ const char *list_flags(void *engine_ptr);
|
|
44
44
|
* This function will free the memory occupied by the engine.
|
45
45
|
*/
|
46
46
|
void destroy_engine(void *engine_ptr);
|
47
|
+
|
48
|
+
/**
|
49
|
+
* # Safety
|
50
|
+
*
|
51
|
+
* This function will take in a pointer to the string and free the memory.
|
52
|
+
* See Rust the safety section in CString::from_raw.
|
53
|
+
*/
|
54
|
+
void destroy_string(char *ptr);
|
Binary file
|
Binary file
|
data/lib/flipt_client/version.rb
CHANGED
data/lib/flipt_client.rb
CHANGED
@@ -33,13 +33,15 @@ module Flipt
|
|
33
33
|
# void destroy_engine(void *engine_ptr);
|
34
34
|
attach_function :destroy_engine, [:pointer], :void
|
35
35
|
# const char *evaluate_variant(void *engine_ptr, const char *evaluation_request);
|
36
|
-
attach_function :evaluate_variant, %i[pointer string], :
|
36
|
+
attach_function :evaluate_variant, %i[pointer string], :strptr
|
37
37
|
# const char *evaluate_boolean(void *engine_ptr, const char *evaluation_request);
|
38
|
-
attach_function :evaluate_boolean, %i[pointer string], :
|
38
|
+
attach_function :evaluate_boolean, %i[pointer string], :strptr
|
39
39
|
# const char *evaluate_batch(void *engine_ptr, const char *batch_evaluation_request);
|
40
|
-
attach_function :evaluate_batch, %i[pointer string], :
|
40
|
+
attach_function :evaluate_batch, %i[pointer string], :strptr
|
41
41
|
# const char *list_flags(void *engine_ptr);
|
42
|
-
attach_function :list_flags, [:pointer], :
|
42
|
+
attach_function :list_flags, [:pointer], :strptr
|
43
|
+
# void destroy_string(const char *ptr);
|
44
|
+
attach_function :destroy_string, [:pointer], :void
|
43
45
|
|
44
46
|
# Create a new Flipt client
|
45
47
|
#
|
@@ -73,7 +75,8 @@ module Flipt
|
|
73
75
|
# @option evaluation_request [String] :flag_key flag key
|
74
76
|
def evaluate_variant(evaluation_request = {})
|
75
77
|
validate_evaluation_request(evaluation_request)
|
76
|
-
resp = self.class.evaluate_variant(@engine, evaluation_request.to_json)
|
78
|
+
resp, ptr = self.class.evaluate_variant(@engine, evaluation_request.to_json)
|
79
|
+
ptr = FFI::AutoPointer.new(ptr, EvaluationClient.method(:destroy_string))
|
77
80
|
JSON.parse(resp)
|
78
81
|
end
|
79
82
|
|
@@ -84,10 +87,11 @@ module Flipt
|
|
84
87
|
# @option evaluation_request [String] :flag_key flag key
|
85
88
|
def evaluate_boolean(evaluation_request = {})
|
86
89
|
validate_evaluation_request(evaluation_request)
|
87
|
-
resp = self.class.evaluate_boolean(@engine, evaluation_request.to_json)
|
90
|
+
resp, ptr = self.class.evaluate_boolean(@engine, evaluation_request.to_json)
|
91
|
+
ptr = FFI::AutoPointer.new(ptr, EvaluationClient.method(:destroy_string))
|
88
92
|
JSON.parse(resp)
|
89
93
|
end
|
90
|
-
|
94
|
+
|
91
95
|
# Evaluate a batch of flags for a given request
|
92
96
|
#
|
93
97
|
# @param batch_evaluation_request [Array<Hash>] batch evaluation request
|
@@ -98,13 +102,15 @@ module Flipt
|
|
98
102
|
validate_evaluation_request(request)
|
99
103
|
end
|
100
104
|
|
101
|
-
resp = self.class.evaluate_batch(@engine, batch_evaluation_request.to_json)
|
105
|
+
resp, ptr = self.class.evaluate_batch(@engine, batch_evaluation_request.to_json)
|
106
|
+
ptr = FFI::AutoPointer.new(ptr, EvaluationClient.method(:destroy_string))
|
102
107
|
JSON.parse(resp)
|
103
108
|
end
|
104
109
|
|
105
110
|
# List all flags in the namespace
|
106
111
|
def list_flags
|
107
|
-
resp = self.class.list_flags(@engine)
|
112
|
+
resp, ptr = self.class.list_flags(@engine)
|
113
|
+
ptr = FFI::AutoPointer.new(ptr, EvaluationClient.method(:destroy_string))
|
108
114
|
JSON.parse(resp)
|
109
115
|
end
|
110
116
|
|
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.
|
4
|
+
version: 0.4.1
|
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-03-
|
11
|
+
date: 2024-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flipt Client Evaluation SDK
|
14
14
|
email:
|