CookieJar is here to store your cookie
Summary
Functions
See what's in the cookie jar, the individual cookies
See what's in the cookie jar, the individual cookies available to a URI
Pour cookies into a cookie jar
Pour cookies into a cookie jar, using cookie strings and a uri string
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
Get the cookies in Cookie format for the given URI
Functions
@spec 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"}
@spec peek(GenServer.server(), String.t()) :: map()
See what's in the cookie jar, the individual cookies available to a URI
@spec pour(GenServer.server(), list() | 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}
@spec pour(GenServer.server(), list(), String.t()) :: :ok
Pour cookies into a cookie jar, using cookie strings and a uri string
@spec put(GenServer.server(), CookieJar.Cookie.t() | {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"
@spec put_new(GenServer.server(), CookieJar.Cookie.t() | {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"
See CookieJar.stop/1.
@spec start_link(keyword()) :: GenServer.on_start()
Create a new cookie jar
Examples
CookieJar.start_link
# or
CookieJar.new
@spec 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
@spec 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"
@spec to_string(GenServer.server(), String.t()) :: String.t()
Get the cookies in Cookie format for the given URI