README.md

# Mercadolibre

**TODO: Add description**

## Installation

  1. Add `mercadolibre` to your list of dependencies in `mix.exs`:

```elixir
def deps do
  [{:mercadolibre, "~> 0.1.0"}]
end
```

## Usage

You can do api calls by using one of two methods:
```elixir
Mercadolibre.request(:get, "/items/MLA123", [])
```

Which simply does a request and returns a tuple like
```elixir
{http_status_code, decoded_response}
```

Or
```elixir
Mercadolibre.authenticated_request(client_pid, verb, url, data)`
```

which requires the pid of a Mercadolibre.Authentication process.

## Example

```elixir
{:ok, auth} = Mercadolibre.Authentication.start_link(%{client_id: "x", client_secret: "y"}) 
Mercadolibre.authenticated_request(auth, :get, "items/MLA123")
```
    
Probably you'll want a supervised Authentication process.

```elixir
# ...
children = [
  worker(Authentication, [%{client_id: "x", client_secret: "y"}, name: :account1])
]
supervise(children, strategy: one_for_one)
```

and then:
```elixir
Mercadolibre.authenticated_request(:account1, :post, "items", %{title: "Title", price: 10})
```