https://github.com/jdesilvio/yelp_ex
An Elixir wrapper for the Yelp API
https://github.com/jdesilvio/yelp_ex
elixir yelp
Last synced: 8 months ago
JSON representation
An Elixir wrapper for the Yelp API
- Host: GitHub
- URL: https://github.com/jdesilvio/yelp_ex
- Owner: jdesilvio
- License: mit
- Created: 2017-01-03T02:12:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-10T15:56:09.000Z (almost 8 years ago)
- Last Synced: 2025-10-21T14:56:31.757Z (8 months ago)
- Topics: elixir, yelp
- Language: Elixir
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YelpEx
An Elixir client for the Yelp Fusion API (aka *Yelp's API v3*).
See the Yelp API docs
[here](https://www.yelp.com/developers/documentation/v3/).
See the [Hex documentation](https://hex.pm/packages/yelp_ex)
for more information.
## Installation
Add `:yelp_ex` to your `mix.exs` file as a dependency and to
your `extra_applications` list:
```elixir
def application do
[extra_applications: [:logger, :yelp_ex]]
end
defp deps do
[{:yelp_ex, "~> 0.2.0"}]
end
```
*Important:* You must use `YelpEx` version 0.2.0 or higher due
to a change in how the Yelp Fusion API authenticates.
Then, run: `mix do deps.get, compile`
## Yelp Setup
In order to use `YelpEx`, you need to create an application on
[Yelp's developer website](https://www.yelp.com/developers/v3/manage_app).
After you do this, you will get an "App ID" and an "App Secret".
Yelp uses an *API key* to authenticate.
Before starting your application, you will need to save your
Yelp API key as an **environment variable**...
One way to do this is to create a file called `.env` in your
project root with the following:
```bash
export YELP_API_KEY=""
```
Execute the file from the command line:
```bash
$ source .env
```
_**When you start your application, an authenticated, supervised
`YelpEx.Client` will also be started.**_
```bash
$ iex -S mix
```
## Usage
_Click endpoint links to see all valid parameters that can be
passed in `options`._
#### [/businesses/search](https://www.yelp.com/developers/documentation/v3/business_search) Endpoint
```elixir
iex> options = [params: [sort_by: "distance", longitude: -75.145101, latitude: 39.54364]]
[params: [sort_by: "distance", longitude: -75.145101, latitude: 39.54364]]
iex> YelpEx.Client.search(options)
{:ok, {}}
iex> YelpEx.Client.search!(options)
{}
```
#### [/businesses/search/phone](https://www.yelp.com/developers/documentation/v3/business_search_phone) Endpoint
```elixir
iex> options = [params: [phone: "+14159083801"]]
iex> YelpEx.Client.search_phone(options)
{:ok, {}}
iex> YelpEx.Client.search_phone!(options)
{}
```