Add doctests to Hunter.Config
parent
69a885a735
commit
3473d33566
|
@ -3,18 +3,52 @@ defmodule Hunter.Config do
|
||||||
Hunter configuration.
|
Hunter configuration.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns adapter module to do run API calls.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> Hunter.Config.hunter_api()
|
||||||
|
Hunter.ApiMock
|
||||||
|
|
||||||
|
"""
|
||||||
def hunter_api do
|
def hunter_api do
|
||||||
Application.get_env(:hunter, :hunter_api, Hunter.Api.HTTPClient)
|
Application.get_env(:hunter, :hunter_api, Hunter.Api.HTTPClient)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns the API base URL
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> Hunter.Config.api_base_url()
|
||||||
|
"https://mastodon.social"
|
||||||
|
|
||||||
|
"""
|
||||||
def api_base_url do
|
def api_base_url do
|
||||||
Application.get_env(:hunter, :api_base_url, "https://mastodon.social")
|
Application.get_env(:hunter, :api_base_url, "https://mastodon.social")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns the Hunter home directory
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
iex> Path.extname(Hunter.Config.home())
|
||||||
|
".hunter"
|
||||||
|
|
||||||
|
"""
|
||||||
def home do
|
def home do
|
||||||
Path.expand(System.get_env("HUNTER_HOME") || "~/.hunter")
|
Path.expand(System.get_env("HUNTER_HOME") || "~/.hunter")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@doc """
|
||||||
|
Returns HTTP options
|
||||||
|
|
||||||
|
iex> Hunter.Config.http_options()
|
||||||
|
[]
|
||||||
|
|
||||||
|
"""
|
||||||
def http_options do
|
def http_options do
|
||||||
Application.get_env(:hunter, :http_options, [])
|
Application.get_env(:hunter, :http_options, [])
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
defmodule HunterTest do
|
||||||
|
use ExUnit.Case, async: true
|
||||||
|
|
||||||
|
doctest Hunter.Config
|
||||||
|
end
|
Loading…
Reference in New Issue