SudregEx.Client (sudreg_ex v0.1.0)

Copy Markdown View Source

Configuration carrier for the Sudski registar v3 "javni" (public) API.

Build one with new/1, supplying at least :client_id and :client_secret (obtained by registering at https://sudreg-data.gov.hr/). Values omitted from the call fall back to config :sudreg_ex, :client, [...], then to the built-in production defaults.

SudregEx.Client.new(client_id: "abc..", client_secret: "xyz..")

The generated credentials legitimately end in .. — pass them verbatim.

The :req_options keyword list is merged into every underlying Req request, which is the seam tests use to inject plug: {Req.Test, _}.

Summary

Functions

Builds a t/0, merging (in increasing precedence) the production defaults, config :sudreg_ex, :client, and opts.

Types

t()

@type t() :: %SudregEx.Client{
  base_url: String.t(),
  client_id: String.t(),
  client_secret: String.t(),
  req_options: keyword(),
  token_url: String.t()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Builds a t/0, merging (in increasing precedence) the production defaults, config :sudreg_ex, :client, and opts.

Raises ArgumentError if :client_id or :client_secret cannot be resolved.