flipt_client 0.4.0 → 0.4.2
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: 4289fd15a6a4040047940ea2974e85332b10609dad576b782a52f78d7c2c9175
|
4
|
+
data.tar.gz: d009b4b11452c56a7107215187f615edc4c8d8a299b6a0e4a4ae11177b0dde01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f3377ae30f37600b455a272942feee35d49b1f1f47d494b20f0d2c7b27b3a49d2a973f92a74fa9808d9df1af5ab7e7fdc810158694f82371f5b9decd04b6937
|
7
|
+
data.tar.gz: c38b2823d4f9bc15b7e66a1bbe338e30ebf9de0c5beacfb0869cf9579dddb8980cd8373ca48b0249b9f5ec43a8306507bcebf2a69051797c9efc43db1fb537f4
|
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.2
|
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-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Flipt Client Evaluation SDK
|
14
14
|
email:
|