cookie_jar v1.0.5 CookieJar View Source
CookieJar is here to store your cookie
Link to this section Summary
Functions
See what's in the cookie jar, the individual cookies
Pour cookies into a cookie jar
Put cookie into a cookie jar
Put new cookie into a cookie jar
Create a new cookie jar
Destroy a cookie jar
Get the cookies in Cookie format
Link to this section Functions
Link to this function
label(jar) View Source
Link to this function
new(opts \\ []) View Source
Link to this function
peek(jar)
View Source
peek(jar)
View Source
peek(GenServer.server()) :: map()
peek(GenServer.server()) :: map()
See what's in the cookie jar, the individual cookies
Examples
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"name", "john doe"})
iex> CookieJar.peek(jar)
%{"name" => "john doe"}
Link to this function
pour(jar, cookies)
View Source
pour(jar, cookies)
View Source
pour(GenServer.server(), map()) :: :ok
pour(GenServer.server(), map()) :: :ok
Pour cookies into a cookie jar
Examples
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.pour(jar, %{"a" => 1, "b" => 2})
iex> CookieJar.peek(jar)
%{"a" => 1, "b" => 2}
Link to this function
put(jar, cookie)
View Source
put(jar, cookie)
View Source
put(GenServer.server(), {term(), term()}) :: :ok
put(GenServer.server(), {term(), term()}) :: :ok
Put cookie into a cookie jar
Examples
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put(jar, {"b", 2})
iex> CookieJar.to_string(jar)
"a=1; b=2"
Link to this function
put_new(jar, cookie)
View Source
put_new(jar, cookie)
View Source
put_new(GenServer.server(), {term(), term()}) :: :ok
put_new(GenServer.server(), {term(), term()}) :: :ok
Put new cookie into a cookie jar
Examples
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.peek(jar)
%{}
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put_new(jar, {"a", 3})
iex> CookieJar.to_string(jar)
"a=1"
Link to this function
smash(jar) View Source
Link to this function
start_link(opts \\ [])
View Source
start_link(opts \\ [])
View Source
start_link(keyword()) :: GenServer.onstart()
start_link(keyword()) :: GenServer.onstart()
Create a new cookie jar
Examples
CookieJar.start_link
# or
CookieJar.new
Link to this function
stop(jar)
View Source
stop(jar)
View Source
stop(GenServer.server()) :: :ok
stop(GenServer.server()) :: :ok
Destroy a cookie jar
Examples
CookieJar.stop(jar)
# or
CookieJar.smash(jar)
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.stop(jar)
iex> Process.alive?(jar)
false
Link to this function
to_string(jar)
View Source
to_string(jar)
View Source
to_string(GenServer.server()) :: String.t()
to_string(GenServer.server()) :: String.t()
Get the cookies in Cookie format
Examples
CookieJar.to_string(jar)
# or
CookieJar.label(jar)
iex> {:ok, jar} = CookieJar.new
iex> CookieJar.to_string(jar)
""
iex> CookieJar.put(jar, {"a", 1})
iex> CookieJar.put(jar, {"b", 2})
iex> CookieJar.to_string(jar)
"a=1; b=2"