Exling

Build StatusHex pmhex.pm downloads

Exling is a fluent HTTP request builder for Elixir, inspired by the sling library in Go. Exling uses Elixir pipes to make building and executing HTTP requests clear and concise, and is geared towards simplifying HTTP-based API library development, but should be useful any time HTTP requests need to be made.

Installation

If available in Hex, the package can be installed by adding exling to your list of dependencies in mix.exs:

def deps do
  [{:exling, "~> 0.1.1"}]
end

Usage

# retrieve your ip address from httpbin.org
{:ok, response} = Exling.new |>
              Exling.base("http://httpbin.org") |>
          Exling.path("ip") |>
          Exline.receive()

# send some post data and get JSON back
{:ok, response} = Exling.new |>
            Exling.base("http://httpbin.org") |>
            Exling.accept(:json)
            Exling.post("post") |>
            Exling.body(%{foo: "bar"}, :json) |>
            Exling.receive()

TODO

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/exling.