** An Elixir client for accessing Amazon's Merchant Web Services **
Inspired by ruby https://github.com/hakanensari/peddler gem api and elixir https://github.com/zachgarwood/elixir-amazon-product-advertising-client for signature signing.
Only implemented APIs for what I needed, other API's need to be ported as I go along.
- Fill out a %MWSClient.Config struct that holds credentials needed for signature creation.
config = %MWSClient.Config{aws_access_key_id: ..., mws_auth_token: ...}
- An api call is done in two parts, the operation piped to the request
MWSClient.Products.get_matching_product(["B00KO1C94A"]) |> MWSClient.request(config)
The first part creates an %MWSClient.Operation struct holding basic parts of the API call, e.g map of parameters to send, the path, the method.
The second part the MWSClient.request appends additional parameters from your config struct, creates a signature and makes the API call. The result is a %HTTPoison{} struct.
- Pipe that into a parser to facilitate enumerating over csv or xml response body.
MWSClient.Products.get_matching_product(["B00KO1C94A"]) |> MWSClient.request(config)
|> MWSClient.Parse.parse
MWSClient.Parser.parse determines the enumerable based on the response header content-type.
======== TODO: file upload
If available in Hex, the package can be installed as:
- Add
mws_client
to your list of dependencies inmix.exs
:
```elixir
def deps do
[{:mws_client, "~> 0.0.1"}]
end
```
- Ensure
mws_client
is started before your application:
```elixir
def application do
[applications: [:mws_client]]
end
```