Search⌘ K
AI Features

Modifying the Boundary of the Mastery Project

Explore how to modify the API boundary of your Elixir mastery project by adding optional arguments and adapting the backend implementation. Understand testing strategies for these changes within the OTP framework to ensure smooth integration and maintain project compatibility.

We’ll start with /lib/mastery.ex to make the API changes, enabling that new API in the boundary.

Modifying the API

In Mastery, we need to change the API to accept our new notify_pid, like this:

C++
def schedule_quiz(quiz, templates, start_at, end_at, notify_pid \\ nil) do
with :ok <- QuizValidator.errors(quiz),
true <- Enum.all?(templates, &(:ok == TemplateValidator.errors(&1))),
:ok <-
Proctor.schedule_quiz(
quiz,
templates,
start_at,
end_at,
notify_pid),
do: :ok, else: (error -> error)
end

That’s simple enough:

  • We add a new optional argument to ...