Provides a convenient Java Client Library for interfacing with Yelp
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
.travis.yml
LICENSE
README.md
pom.xml

README.md

YelpJavaClient

Jenkins Travis Maven Central Version


The YelpJavaClient provides a simple Java interface for interacting with Yelp's API.

Download

Maven

<dependency>
	<groupId>tech.redroma.yelp</groupId>
	<artifactId>yelp-api</artifactId>
    <version>1.0</version>
</dependency>

Creating a Client

Create a client using the App ID and App Secret that you obtained from the Yelp Developer console.

String clientId = "...";
String clientSecret = "...";
YelpAPI yelp = YelpAPI.newInstance(clientId, clientSecret);

Searching Businesses

Yelp API Documentation

Searching businesses is as easy as making a request object and using the searchForBusinesses() method.

//Create a request object
YelpSearchRequest request =  YelpSearchRequest.newBuilder()
    .withSearchTerm("Deli")
    .withCoordinate(Coordinate.of(34.018363, -118.492343))
    .withLimit(10)
    .withSortBy(YelpSearchRequest.SortType.DISTANCE)
    .build();

//Make the request
List<YelpBusiness> results = yelp.searchForBusinesses(request);

LOG.info("Found {} results for request {}", results.size(), request);

Business Details

Yelp API Documentation

Sometimes you want more detailed information about a business, such as the business hours, additional photos, and price information.

Simply call the getBusinessDetails() method.

//Using any business
YelpBusiness business = Lists.oneOf(results);

//Make the request to get business details.
YelpBusinessDetails businessDetails = yelp.getBusinessDetails(business);

LOG.info("Received detailed info for business named {}: [{}]", business.name, businessDetails);

if (businessDetails.isOpenNow())
{
    LOG.info("{} is open now.", businessDetails.name)
}

Reviews

Yelp API Documentation

YelpBusiness business = Lists.oneof(business);
List<YelpReview> reviews = yelp.getReviewsForBusiness(business);

LOG.info("Business named")

Javadocs

Currently Unsupported

We do not yet support the following API calls:

Guiding Philosophy

We used Alchemy Design Principles when designing this library.

Swift

We wanted our code to feel like it was barely there. This meant keeping things minimal and light.

Intuitive

Yelp already designed a great intuitive API. We didn't want to add a pool of unnecessary soda.

Solid

Nearly everything is unit tested, and it is already being used in production by BlackNectar, and others.

Invigorating

We wanted you to have fun, and to feel powerful.
We ditched the no-fun java get() set() pojo style in favor of open public variables. We trust you.

License

This Software is licensed under the Apache 2.0 License

http://www.apache.org/licenses/LICENSE-2.0