README.md

Closex ✨

Installation

Add closex to your list of dependencies in mix.exs:

defdepsdo
[
{:closex, ">= 0.0.0"} # or the current stable version
]
end

Configuration

In your config.exs:

config :closex,
# This should be accessible from your user's account page in close.ioapi_key:"YOUR_API_KEY",
# This is a beta feature which will wait and retry `find_lead` and# `find_opportunity` requests *once* if you hit your rate limit. The intention# is that this will be gradually rolled out across other requests as needed.rate_limit_retry:true# Defaults to `false` (don't retry)

You can also read the API key from an environment variable, such as:

config :closex,
api_key: {:system, "MY_ENV_VAR"}

Usage

It follows the Close.IO API naming conventions as closely as possible. It supports almost everything that the REST API supports including querying leads, opportunities, users, organizations, statuses and more.

Options

Rate limit retry

When we hit a rate limit on certain requests, there's a beta configuration to get the client to take this into account, wait a second longer than the remaining rate limit window then retry again. This can be enabled for all affected requests (see Configuration) or on a per-request basis:

Closex.HTTPClient.get_lead("my_lead_id", rate_limit_retry:true)

This is only limited to certain requests as it's being trialled, if useful then we'll roll it out across other requests. The requests are:

find_leads

find_opportunities

find_all_opportunities

get_users

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

Report bugs

Fix bugs and submit pull requests

Write, clarify, or fix documentation

Suggest or add new features

Please use the git hooks provided in the hooks directory. Use the following command to set these hooks up.