RegulaEx
An Elixir client to Regula. It provides a practical api to perform evaluation of rulesets against given parameters and will return the appropriate Elixir type.
It can be instrumented by overriding callbacks defined by Regula.Service
in a custom module. See the tests for an example of doing so.
Example
First let’s create a client:
client = %Regula.client(endpoint: "http://localhost:5331")
Given the server has the following ruleset defined:
- ruleset path:
/foo/bar
- params: string named “baz”
- returns: int64
Regula.get_string(client, "/foo/bar", %{"baz" => "value"})
# {:ok, 42, %Regula.EvalResult{data: "42", type: "int64", version: "some-ksuid"}}
Installation
If available in Hex, the package can be installed
by adding regula
to your list of dependencies in mix.exs
:
def deps do
[
{:regula, "~> 0.1.0"}
]
end
Others
mix dialyzer
to run dyalizer on the codemix test --cover
to check code coverage
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/regula.