# `CookieJar.Cookie`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L1)

Model individual Cookie as specified by the
[MDN doc](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies)
Some of the functionalities are irrelevant so only the following attributes are kept:
domain, include_subdomain, path, secure, expires, name and value

# `t`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L17)

```elixir
@type t() :: %CookieJar.Cookie{
  domain: String.t(),
  expires: integer(),
  include_subdomain: boolean(),
  name: String.t(),
  path: String.t(),
  secure: boolean(),
  value: String.t()
}
```

# `equal?`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L37)

```elixir
@spec equal?(t(), t()) :: boolean()
```

Return true if cookie2 is superseding cookie1. Only compare domain, path and name. 

# `matched?`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L86)

```elixir
@spec matched?(t(), URI.t()) :: boolean()
```

Return true if the cookie shall be sent to the uri

# `new`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L31)

```elixir
@spec new(String.t(), String.t()) :: t()
```

simple constructor

# `parse`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L50)

```elixir
@spec parse(String.t()) :: nil | t()
```

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found

# `parse`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L57)

```elixir
@spec parse(String.t(), nil | URI.t()) :: nil | t()
```

parse a cookie from the Set-Cookie: value. return nil if no valid cookie found
taking additional infomatio ffrom the requesting URI

# `to_string`
[🔗](https://github.com/princemaple/cookie_jar/blob/v1.1.0/lib/cookie_jar/cookie.ex#L100)

```elixir
@spec to_string(t()) :: String.t()
```

return name=value as string

---

*Consult [api-reference.md](api-reference.md) for complete listing*
