Skip to content

Provides a convenient Java Client Library for interfacing with Yelp

License

Notifications You must be signed in to change notification settings

RedRoma/YelpJavaClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YelpJavaClient

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.1</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

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

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

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

LOG.info("Business named")

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

About

Provides a convenient Java Client Library for interfacing with Yelp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages