Uribe v0.2.0 Uribe
Documentation for Uribe. Uribe always receives URI in the first argument and always returns URI
Link to this section Summary
Functions
Add query to URI
Remove the entire path, query and set path
Set path for URI
Remove param from URI query
Link to this section Functions
Link to this function
add_query(uri, query)
Add query to URI
Examples
iex> uri = URI.parse("https://google.com") |> Uribe.add_query(%{"foo" => "bar"})
iex> uri.query
"foo=bar"
iex> uri = URI.parse("https://google.com") |> Uribe.add_query(%{"foo" => "bar"}) |> Uribe.add_query(%{"foo" => "baz"})
iex> uri.query
"foo=baz"
iex> uri = URI.parse("https://google.com?foo=bar") |> Uribe.add_query(%{"foo" => "baz", "bar" => "baz"})
iex> uri.query
"bar=baz&foo=baz"
Link to this function
cut(uri, path)
Remove the entire path, query and set path
Examples
iex> uri = URI.parse("https://google.com") |> Uribe.cut("/foo/bar")
iex> uri.path
"/foo/bar"
iex> uri = URI.parse("https://google.com/bar?baz=qux") |> Uribe.cut("/foo")
iex> URI.to_string(uri)
"https://google.com/foo"
Link to this function
path(uri, path)
Set path for URI
Examples
iex> uri = URI.parse("https://google.com") |> Uribe.path("/foo/bar")
iex> uri.path
"/foo/bar"
iex> uri = URI.parse("https://google.com/bar") |> Uribe.path("/foo")
iex> URI.to_string(uri)
"https://google.com/foo"
Link to this function
remove(uri, param)
Remove param from URI query
Examples
iex> uri = URI.parse("https://google.com?foo=bar&baz=foo") |> Uribe.remove("foo")
iex> uri.query
"baz=foo"
iex> uri = URI.parse("https://google.com?foo=bar&baz=foo") |> Uribe.remove("baz")
iex> uri.query
"foo=bar"
iex> uri = URI.parse("https://google.com?foo=bar&baz=foo") |> Uribe.remove(["baz", "foo"])
iex> uri.query
""