Skip to content

Commit

Permalink
feat: rename methods (#21)
Browse files Browse the repository at this point in the history
* chore: rename methods for node, go, and python

* chore: fix linting

* chore: rename ruby methods

* chore: remove errant csv file

* chore: rename underlying calls

* chore: update ruby readme

---------

Co-authored-by: Mark Phelps <[email protected]>
  • Loading branch information
yquansah and markphelps authored Dec 4, 2023
1 parent c26e878 commit d6e669e
Show file tree
Hide file tree
Showing 19 changed files with 204 additions and 52 deletions.
7 changes: 5 additions & 2 deletions build/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ module go.flipt.io/flipt/client-sdks/build
go 1.21.3

require (
dagger.io/dagger v0.9.3 // indirect
dagger.io/dagger v0.9.3
golang.org/x/sync v0.4.0
)

require (
github.com/99designs/gqlgen v0.17.31 // indirect
github.com/Khan/genqlient v0.6.0 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/vektah/gqlparser/v2 v2.5.6 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect
)
6 changes: 6 additions & 0 deletions build/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ github.com/Khan/genqlient v0.6.0/go.mod h1:rvChwWVTqXhiapdhLDV4bp9tz/Xvtewwkon4D
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/vektah/gqlparser/v2 v2.5.6 h1:Ou14T0N1s191eRMZ1gARVqohcbe1e8FrcONScsq8cRU=
github.com/vektah/gqlparser/v2 v2.5.6/go.mod h1:z8xXUff237NntSuH8mLFijZ+1tjV1swDbpDqjJmk6ME=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
Expand All @@ -36,3 +41,4 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2 changes: 1 addition & 1 deletion flipt-client-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
}
defer evaluationClient.Close()

variantResult, err := evaluationClient.Variant(context.Background(), "flag1", "someentity", map[string]string{
variantResult, err := evaluationClient.EvaluateVariant(context.Background(), "flag1", "someentity", map[string]string{
"fizz": "buzz",
})
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions flipt-client-go/evaluation.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ func WithUpdateInterval(updateInterval int) clientOption {
}
}

// Variant makes an evaluation on a variant flag.
func (e *Client) Variant(_ context.Context, flagKey, entityID string, evalContext map[string]string) (*VariantResult, error) {
// EvaluateVariant makes an evaluation on a variant flag.
func (e *Client) EvaluateVariant(_ context.Context, flagKey, entityID string, evalContext map[string]string) (*VariantResult, error) {
ereq, err := json.Marshal(evaluationRequest{
NamespaceKey: e.namespace,
FlagKey: flagKey,
Expand All @@ -95,7 +95,7 @@ func (e *Client) Variant(_ context.Context, flagKey, entityID string, evalContex
return nil, err
}

variant := C.variant(e.engine, C.CString(string(ereq)))
variant := C.evaluate_variant(e.engine, C.CString(string(ereq)))
defer C.free(unsafe.Pointer(variant))

b := C.GoBytes(unsafe.Pointer(variant), (C.int)(C.strlen(variant)))
Expand All @@ -110,7 +110,7 @@ func (e *Client) Variant(_ context.Context, flagKey, entityID string, evalContex
}

// Boolean makes an evaluation on a boolean flag.
func (e *Client) Boolean(_ context.Context, flagKey, entityID string, evalContext map[string]string) (*BooleanResult, error) {
func (e *Client) EvaluateBoolean(_ context.Context, flagKey, entityID string, evalContext map[string]string) (*BooleanResult, error) {
ereq, err := json.Marshal(evaluationRequest{
NamespaceKey: e.namespace,
FlagKey: flagKey,
Expand All @@ -121,7 +121,7 @@ func (e *Client) Boolean(_ context.Context, flagKey, entityID string, evalContex
return nil, err
}

boolean := C.boolean(e.engine, C.CString(string(ereq)))
boolean := C.evaluate_boolean(e.engine, C.CString(string(ereq)))
defer C.free(unsafe.Pointer(boolean))

b := C.GoBytes(unsafe.Pointer(boolean), (C.int)(C.strlen(boolean)))
Expand Down
4 changes: 2 additions & 2 deletions flipt-client-go/evaluation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestVariant(t *testing.T) {
evaluationClient, err := evaluation.NewClient(evaluation.WithURL(fliptUrl))
require.NoError(t, err)

variant, err := evaluationClient.Variant(context.TODO(), "flag1", "someentity", map[string]string{
variant, err := evaluationClient.EvaluateVariant(context.TODO(), "flag1", "someentity", map[string]string{
"fizz": "buzz",
})
require.NoError(t, err)
Expand All @@ -40,7 +40,7 @@ func TestBoolean(t *testing.T) {
evaluationClient, err := evaluation.NewClient(evaluation.WithURL(fliptUrl))
require.NoError(t, err)

boolean, err := evaluationClient.Boolean(context.TODO(), "flag_boolean", "someentity", map[string]string{
boolean, err := evaluationClient.EvaluateBoolean(context.TODO(), "flag_boolean", "someentity", map[string]string{
"fizz": "buzz",
})
require.NoError(t, err)
Expand Down
3 changes: 3 additions & 0 deletions flipt-client-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ require github.com/stretchr/testify v1.8.4

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
15 changes: 14 additions & 1 deletion flipt-client-go/go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion flipt-client-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { FliptEvaluationClient } from 'flipt-client-node';
// to wait for updated flag state.
const fliptEvaluationClient = new FliptEvaluationClient();

const variant = fliptEvaluationClient.variant("flag1", "someentity", {"fizz": "buzz"});
const variant = fliptEvaluationClient.evaluateVariant("flag1", "someentity", {"fizz": "buzz"});

console.log(variant);
```
Expand Down
6 changes: 4 additions & 2 deletions flipt-client-node/src/evaluation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (!fliptUrl) {
test('variant', () => {
const fec = new FliptEvaluationClient('default', { url: fliptUrl });

const variant = fec.variant('flag1', 'someentity', { fizz: 'buzz' });
const variant = fec.evaluateVariant('flag1', 'someentity', { fizz: 'buzz' });

expect(variant.error_message).toBeNull();
expect(variant.status).toEqual('success');
Expand All @@ -24,7 +24,9 @@ test('variant', () => {
test('boolean', () => {
const fec = new FliptEvaluationClient('default', { url: fliptUrl });

const boolean = fec.boolean('flag_boolean', 'someentity', { fizz: 'buzz' });
const boolean = fec.evaluateBoolean('flag_boolean', 'someentity', {
fizz: 'buzz'
});

expect(boolean.error_message).toBeNull();
expect(boolean.status).toEqual('success');
Expand Down
12 changes: 6 additions & 6 deletions flipt-client-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const engineLib = ffi.Library(
process.env.FLIPT_ENGINE_LIB_PATH || 'libfliptengine.so',
{
initialize_engine: ['void *', ['char **', 'string']],
variant: ['string', ['void *', 'string']],
boolean: ['string', ['void *', 'string']],
evaluate_variant: ['string', ['void *', 'string']],
evaluate_boolean: ['string', ['void *', 'string']],
destroy_engine: ['void', ['void *']]
}
);
Expand All @@ -36,7 +36,7 @@ export class FliptEvaluationClient {
this.engine = engine;
}

public variant(
public evaluateVariant(
flag_key: string,
entity_id: string,
context: {}
Expand All @@ -49,7 +49,7 @@ export class FliptEvaluationClient {
};

const response = Buffer.from(
engineLib.variant(
engineLib.evaluate_variant(
this.engine,
allocCString(JSON.stringify(evaluation_request))
)
Expand All @@ -59,7 +59,7 @@ export class FliptEvaluationClient {
return variantResult;
}

public boolean(
public evaluateBoolean(
flag_key: string,
entity_id: string,
context: {}
Expand All @@ -72,7 +72,7 @@ export class FliptEvaluationClient {
};

const response = Buffer.from(
engineLib.boolean(
engineLib.evaluate_boolean(
this.engine,
allocCString(JSON.stringify(evaluation_request))
)
Expand Down
2 changes: 1 addition & 1 deletion flipt-client-python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ from flipt_client_python import FliptEvaluationClient
# engine_opts: follows the model EngineOpts in the models.py file. Configures the url of the upstream Flipt instance, and the interval in which to fetch new flag state
flipt_evaluation_client = FliptEvaluationClient()

variant_result = flipt_evaluation_client.variant(flag_key="flag1", entity_id="entity", context={"fizz": "buzz"})
variant_result = flipt_evaluation_client.evaluate_variant(flag_key="flag1", entity_id="entity", context={"fizz": "buzz"})

print(variant_result)
```
20 changes: 12 additions & 8 deletions flipt-client-python/flipt_client_python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def __init__(self, namespace: str = "default", engine_opts: EngineOpts = {}):
self.ffi_core.initialize_engine.restype = ctypes.c_void_p
self.ffi_core.destroy_engine.argtypes = [ctypes.c_void_p]

self.ffi_core.variant.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self.ffi_core.variant.restype = ctypes.c_char_p
self.ffi_core.evaluate_variant.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self.ffi_core.evaluate_variant.restype = ctypes.c_char_p

self.ffi_core.boolean.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self.ffi_core.boolean.restype = ctypes.c_char_p
self.ffi_core.evaluate_boolean.argtypes = [ctypes.c_void_p, ctypes.c_char_p]
self.ffi_core.evaluate_boolean.restype = ctypes.c_char_p

namespace_list = [namespace]

Expand All @@ -42,8 +42,10 @@ def __del__(self):
if hasattr(self, "engine") and self.engine is not None:
self.ffi_core.destroy_engine(self.engine)

def variant(self, flag_key: str, entity_id: str, context: dict) -> VariantResult:
response = self.ffi_core.variant(
def evaluate_variant(
self, flag_key: str, entity_id: str, context: dict
) -> VariantResult:
response = self.ffi_core.evaluate_variant(
self.engine,
serialize_evaluation_request(
self.namespace_key, flag_key, entity_id, context
Expand All @@ -56,8 +58,10 @@ def variant(self, flag_key: str, entity_id: str, context: dict) -> VariantResult

return variant_result

def boolean(self, flag_key: str, entity_id: str, context: dict) -> BooleanResult:
response = self.ffi_core.boolean(
def evaluate_boolean(
self, flag_key: str, entity_id: str, context: dict
) -> BooleanResult:
response = self.ffi_core.evaluate_boolean(
self.engine,
serialize_evaluation_request(
self.namespace_key, flag_key, entity_id, context
Expand Down
6 changes: 4 additions & 2 deletions flipt-client-python/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def setUp(self) -> None:
)

def test_variant(self):
variant = self.flipt_client.variant("flag1", "someentity", {"fizz": "buzz"})
variant = self.flipt_client.evaluate_variant(
"flag1", "someentity", {"fizz": "buzz"}
)
self.assertIsNone(variant.error_message)
self.assertEqual("success", variant.status)
self.assertEqual("flag1", variant.result.flag_key)
Expand All @@ -25,7 +27,7 @@ def test_variant(self):
self.assertIn("segment1", variant.result.segment_keys)

def test_boolean(self):
boolean = self.flipt_client.boolean(
boolean = self.flipt_client.evaluate_boolean(
"flag_boolean", "someentity", {"fizz": "buzz"}
)
self.assertIsNone(boolean.error_message)
Expand Down
4 changes: 2 additions & 2 deletions flipt-client-ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You can then build the gem and install it locally:

```bash
rake build
gem install pkg/flipt_client-0.1.0.gem
gem install pkg/flipt_client-{version}.gem
```

In your Ruby code you can import this client and use it as so:
Expand All @@ -33,7 +33,7 @@ In your Ruby code you can import this client and use it as so:
require 'flipt_client'

client = Flipt::EvaluationClient.new() # uses 'default' namespace
resp = client.variant({ flag_key: 'buzz', entity_id: 'someentity', context: { fizz: 'buzz' } })
resp = client.evaluate_variant({ flag_key: 'buzz', entity_id: 'someentity', context: { fizz: 'buzz' } })

puts resp
```
16 changes: 8 additions & 8 deletions flipt-client-ruby/lib/evaluation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def self.platform_specific_lib
attach_function :initialize_engine, %i[pointer string], :pointer
# void destroy_engine(void *engine_ptr);
attach_function :destroy_engine, [:pointer], :void
# const char *variant(void *engine_ptr, const char *evaluation_request);
attach_function :variant, %i[pointer string], :string
# const char *boolean(void *engine_ptr, const char *evaluation_request);
attach_function :boolean, %i[pointer string], :string
# const char *evaluate_variant(void *engine_ptr, const char *evaluation_request);
attach_function :evaluate_variant, %i[pointer string], :string
# const char *evaluate_boolean(void *engine_ptr, const char *evaluation_request);
attach_function :evaluate_boolean, %i[pointer string], :string

def initialize(namespace = 'default', opts = {})
@namespace = namespace
Expand All @@ -51,17 +51,17 @@ def self.finalize(engine)
proc { destroy_engine(engine) }
end

def variant(evaluation_request = {})
def evaluate_variant(evaluation_request = {})
evaluation_request[:namespace_key] = @namespace
validate_evaluation_request(evaluation_request)
resp = self.class.variant(@engine, evaluation_request.to_json)
resp = self.class.evaluate_variant(@engine, evaluation_request.to_json)
JSON.parse(resp)
end

def boolean(evaluation_request = {})
def evaluate_boolean(evaluation_request = {})
evaluation_request[:namespace_key] = @namespace
validate_evaluation_request(evaluation_request)
resp = self.class.boolean(@engine, evaluation_request.to_json)
resp = self.class.evaluate_boolean(@engine, evaluation_request.to_json)
JSON.parse(resp)
end

Expand Down
12 changes: 6 additions & 6 deletions flipt-client-ruby/spec/evaluation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
end
end

describe '#variant' do
it 'returns a variant' do
describe '#evaluate_variant' do
it 'returns a variant result' do
url = ENV.fetch('FLIPT_URL', 'http://localhost:8080')
client = Flipt::EvaluationClient.new('default', { url: url })

resp = client.variant({ flag_key: 'flag1', entity_id: 'someentity', context: { "fizz": 'buzz' } })
resp = client.evaluate_variant({ flag_key: 'flag1', entity_id: 'someentity', context: { "fizz": 'buzz' } })

expect(resp).to_not be_nil
expect(resp['status']).to eq('success')
Expand All @@ -29,12 +29,12 @@
end
end

describe '#boolean' do
it 'returns a boolean' do
describe '#evaluate_boolean' do
it 'returns a boolean result' do
url = ENV.fetch('FLIPT_URL', 'http://localhost:8080')
client = Flipt::EvaluationClient.new('default', { url: url })

resp = client.boolean({ flag_key: 'flag_boolean', entity_id: 'someentity', context: { "fizz": 'buzz' } })
resp = client.evaluate_boolean({ flag_key: 'flag_boolean', entity_id: 'someentity', context: { "fizz": 'buzz' } })

expect(resp).to_not be_nil
expect(resp['status']).to eq('success')
Expand Down
Loading

0 comments on commit d6e669e

Please sign in to comment.