Overpex v0.2.0 Overpex.API

Provides a function to query the Overpass API

Summary

Functions

query(query, options \\ %{})
query(String.t, map) ::
  {:ok, %Overpex.API.Response{body: term, headers: term, status_code: term}} |
  {:error, String.t}

Query Overpass API

Options

The :url option is used to define the URL to access the Overpass API. The default URL is http://overpass-api.de/api/interpreter

The :adapter option defines the API adapter used to access the Overpass API. Currently the only adapters available are Overpex.API.Adapter.HTTPoison and Overpex.API.Adapter.Fake. Defaults to Overpex.API.Adapter.HTTPoison on all envs except test. On test it defaults to Overpex.API.Adapter.Fake

The default values can be overriden using options or by setting the appropiate values on your config file:

config :overpex,
  url:     "http://overpass-api.de/api/interpreter",
  adapter: Overpex.API.Adapter.HTTPoison

Return values

If the query is successfull, the function returns {:ok, response}, where response is an Overpex.API.Response struct. If an error occurs, the function returns {:error, error}, where error is a String describing the error.