Exop v0.3.7 Exop.Operation behaviour

Provides macros for an operation’s contract definition and process/1 function.

Example

defmodule SomeOperation do
  use Exop.Operation

  parameter :param1, type: :integer, required: true
  parameter :param2, type: :string, length: %{max: 3}, format: ~r/foo/

  def process(params) do
    "This is the operation's result with one of the params = " <> params[:param1]
  end
end

Summary

Types

auth_result ::
  :ok |
  {:error, {:auth, :undefined_user}} |
  {:error, {:auth, :undefined_policy}} |
  {:error, {:auth, :undefined_action}} |
  {:error, {:auth, atom}}
interrupt_error :: {:error, {:interrupt, any}}

Macros

authorize(user, opts \\ [])

Specs

authorize(term, any, Keyword.t | nil) :: auth_result
current_policy()

Specs

current_policy(term) :: {Exop.Policy.t, atom}
parameter(name, opts \\ [])

Specs

parameter(term, atom, Keyword.t) :: no_return
policy(policy_module, action_name)

Specs

policy(term, Exop.Policy.t, atom) :: no_return

Callbacks

process(arg0)

Specs