Mpx
Elixir wrapper for the Ministry Platform REST API
Installation
If available in Hex, the package can be installed
by adding mpx
to your list of dependencies in mix.exs
:
def deps do
[
{:mpx, "~> 0.1.2"}
]
end
Usage
Currently only a few endpoints are supported:
/tables
(get and delete)/tables/:id
(get)
Set configuration options to authenticate with MP in your config.exs. You can use
{:system, "ENV_NAME"}
for runtime configuration.
config :mpx,
mp_base_url: {:system, "MP_HOST"},
mp_username: System.get_env("MP_USERNAME"),
mp_password: {:system, "MP_PASSWORD"},
mp_client_id: {:system, "MP_CLIENT_ID"},
mp_client_secret: {:system, "MP_CLIENT_SECRET"}
Now call
{:ok, token} = Mpx.Authentication.authenticate()
to get a reuseable authentication token.
If you prefer not to use elixir configuration to setup you user credentials:
{:ok, token} = Mpx.Authentication.authenticate(username: "username", password: "password", client_id: "clientid", client_secret: "clientsecret")