All Projects → Yelp → Yelp Ruby

Yelp / Yelp Ruby

Licence: mit
A Ruby gem for communicating with the Yelp REST API

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Yelp Ruby

Openvulnapi
Documentation and Tools for Cisco's PSIRT openVuln API
Stars: ✭ 73 (-31.78%)
Mutual labels:  api-client
Shlink Web Client
A React-based client application for Shlink
Stars: ✭ 81 (-24.3%)
Mutual labels:  api-client
Adyen Php Api Library
Adyen API Library for PHP
Stars: ✭ 93 (-13.08%)
Mutual labels:  api-client
Kraken Node
Official Kraken.io module for Node.js
Stars: ✭ 76 (-28.97%)
Mutual labels:  api-client
Parse Dashboard For Ios
A beautiful mobile client for managing your Parse apps while you are on the go! Now you can easily view and modify your data in the same way you would on the offical desktop client.
Stars: ✭ 81 (-24.3%)
Mutual labels:  api-client
Contextio Node
[DEPRECATED] - Official Node.js client library for the Context.IO Email API
Stars: ✭ 86 (-19.63%)
Mutual labels:  api-client
Russianpost
SDK для работы с API Почты России (pochta.ru)
Stars: ✭ 72 (-32.71%)
Mutual labels:  api-client
Nodejs Youtube
Access public YouTube data feeds from your Node.js apps
Stars: ✭ 102 (-4.67%)
Mutual labels:  api-client
Cistern
Ruby API client framework
Stars: ✭ 81 (-24.3%)
Mutual labels:  api-client
Sypht Java Client
A Java client for the Sypht API
Stars: ✭ 93 (-13.08%)
Mutual labels:  api-client
Linodego
Go client for Linode REST v4 API
Stars: ✭ 76 (-28.97%)
Mutual labels:  api-client
Node Wolfram
Wolfram|Alpha API wrapper for node.js
Stars: ✭ 80 (-25.23%)
Mutual labels:  api-client
Rapidql
Query multiple APIs and DBs and join them in a single query
Stars: ✭ 91 (-14.95%)
Mutual labels:  api-client
Node Bitbucket
Bitbucket API client for Browser and Node.js
Stars: ✭ 73 (-31.78%)
Mutual labels:  api-client
Instagram api gem
A Ruby wrapper for the Instagram API
Stars: ✭ 100 (-6.54%)
Mutual labels:  api-client
Python2 Krakenex
(UNMAINTAINED) REST Exchange API for Kraken.com, Python 2
Stars: ✭ 72 (-32.71%)
Mutual labels:  api-client
Google Searchconsole
A wrapper for the Google Search Console API.
Stars: ✭ 83 (-22.43%)
Mutual labels:  api-client
Python Scaleway
🐍 Python SDK to query Scaleway APIs.
Stars: ✭ 107 (+0%)
Mutual labels:  api-client
Tracker api
Ruby Wrapper for Pivotal Tracker v5 API
Stars: ✭ 102 (-4.67%)
Mutual labels:  api-client
Algoliasearch Client Android
Algolia Search API Client for Android
Stars: ✭ 92 (-14.02%)
Mutual labels:  api-client

yelp-ruby

Gem Version Build Status Code Climate

This is a Ruby Gem for the Yelp API. It'll simplify the process of consuming data from the Yelp API for developers using Ruby. The library encompasses both Search and Business API functions.

Please remember to read and follow the Terms of Use and display requirements before creating your applications.

Installation

Add this line to your application's Gemfile:

gem 'yelp', require: 'yelp'

And then execute:

$ bundle

Or install it yourself as:

$ gem install yelp

Usage

Basic usage

The gem uses a client model to query against the API. You create and configure a client with your API keys and make requests through that.

require 'yelp'

client = Yelp::Client.new({ consumer_key: YOUR_CONSUMER_KEY,
                            consumer_secret: YOUR_CONSUMER_SECRET,
                            token: YOUR_TOKEN,
                            token_secret: YOUR_TOKEN_SECRET
                          })

Alternatively, you can also globally configure the client using a configure block, and access a client singleton using Yelp.client. If you intend to use the gem with Rails, the client should be configured in an initializer.

require 'yelp'

Yelp.client.configure do |config|
  config.consumer_key = YOUR_CONSUMER_KEY
  config.consumer_secret = YOUR_CONSUMER_SECRET
  config.token = YOUR_TOKEN
  config.token_secret = YOUR_TOKEN_SECRET
end

Yelp.client.search('San Francisco', { term: 'food' })

After creating the client you're able to make requests to either the Search API or Business API. Note: all four keys are required for making requests against the Yelp API. If you need any keys sign up and get access from http://www.yelp.com/developers.

Search API

Once you have a client you can use #search to make a request to the Search API.

client.search('San Francisco')

You can also pass in general params and locale options to the method as hashes

params = { term: 'food',
           limit: 3,
           category_filter: 'discgolf'
         }

locale = { lang: 'fr' }

client.search('San Francisco', params, locale)

Key names and options for params and locale match the documented names on the Yelp Search API

Additionally there are two more search methods for searching by a bounding box or for geographical coordinates:

# bounding box
bounding_box = { sw_latitude: 37.7577, sw_longitude: -122.4376, ne_latitude: 37.785381, ne_longitude: -122.391681 }
client.search_by_bounding_box(bounding_box, params, locale)

# coordinates
coordinates = { latitude: 37.7577, longitude: -122.4376 }
client.search_by_coordinates(coordinates, params, locale)

Business API

To use the Business API after you have a client you just need to call #business with a business id

client.business('yelp-san-francisco')

You can pass in locale information as well

locale = { lang: 'fr' }

client.business('yelp-san-francisco', locale)

Phone Search API

To use the Phone Search API after you have a client you just need to call #phone_search with a phone number

client.phone_search('+15555555555')

You can pass in country code information as well

options = { cc: 'US', category: 'fashion' }

client.phone_search('5555555555', options)

Responses

Responses from the API are all parsed and converted into Ruby objects. You're able to access information using dot-notation

## search
response = client.search('San Francisco')

response.businesses
# [<Business 1>, <Business 2>, ...]

response.businesses[0].name
# "Kim Makoi, DC"

response.businesses[0].rating
# 5.0


## business
response = client.business('yelp-san-francisco')

response.business.name
# Yelp

response.business.categories
# [["Local Flavor", "localflavor"], ["Mass Media", "massmedia"]]

For specific response values check out the docs for the Search API and the Business API. You can also look at the responses and models inside of lib/yelp/responses and lib/yelp/responses/models to see the methods available.

Contributing

  1. Fork it ( http://github.com/yelp/yelp-ruby/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Our rspec test suite expects environment variables to be populated with your Yelp API Access Tokens.

You can generate and find your Access Tokens at https://www.yelp.com/developers/manage_api_keys.

Git Workflow

We are using the git flow workflow. Atlassian has a solid overview. Essentially, new development is merged into the develop branch from feature branches, then merged from develop to a release branch, then to master from the release branch. Master should always contain the most recently released version of the gem.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].