aboutsummaryrefslogtreecommitdiff
path: root/lib/zendex/connection.ex
blob: 248c253c1bc6afb9849d1091431182ffd40fc7c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
defmodule Zendex.Connection do
  @moduledoc """
  Establishes connection details with Zendex by the user providing a base url,
  username and password.
  """

  @typedoc "The connection paramters"
  @type t :: %{base_url: String.t, authentication: binary}

  @spec setup(String.t, String.t, String.t) :: t
  def setup(base_url, username, password) do
    authentication = Base.encode64("#{username}:#{password}")

    %{base_url: base_url, authentication: authentication}
  end

end