TaxJar. Requests. HTTPAdapters. ReqAdapter
(tax_jar v0.4.0)
Copy Markdown
An HTTP adapter using the Req library. See the Hex docs
for more information on it's features.
Summary
Functions
Perform a POST request to the API using the Req library.
Functions
Perform a POST request to the API using the Req library.
Options
The given options are passed to Req.post/2. See the Req docs
for all of the available options and what they do.
The following default options are provided (but can be overriden):
auth: The configured:api_keyis used.base_url: The configured:api_urlis used.headers: The default headers contain the configured:api_version.json: The givenbodyis encoded as JSON.
Errors
When a request is not successful a TaxJar.Requests.Error is returned.
When the API returns an error
The error fields will be as follows:
:details: TheReq.Responsestruct received as the response.:message: The error message as defined in the API. Default is"Request failed".:reason: An atom representing the status code. SeeTaxJar.Requests.Error.statuses_lookup.Default is `:api_error` if the status is outside what the API supports.
JSON Decoding Errors
When the response can't be decoded then the error struct is provided as the :details attribute
and the reason will be :json_decode_error.