WebService::Yelp - Yelp.com API Client Implementation
use strict; use WebService::Yelp; my $yelp = WebService::Yelp->new({ywsid => 'XXXXXXXXXXXX'}); my $biz_res = $yelp->search_review_hood({ term => 'cream puffs', location => 'San Francisco', }; for my $biz (@{$biz_res->businesses()}) { my @reviews = $biz->reviews(); my @hoods = $biz->neighborhoods(); }
This module implements a programmatic interface to yelp.com's public REST API.
Before you can use this module, you'll need to obtain your very own "Yelp Web Service ID" (ywsid) from http://www.yelp.com/developers. While you are there, I'd also urge you to read Yelp's Terms of Use and documentation.
Much more documentation is available on Yelp's site:
http://www.yelp.com/developers/documentation
Most of the functions here map directly to API commands, so it would be a good idea to familiarize yourself with their documentation first and then take a look at the methods and parameters here.
my $yelp = WebService::Yelp->new($hash_ref);
* ywsid - your Yelp Web Service ID.
* http_proxy - specify a proxy server to use
* http_timeout - specify a timeout (Default is 10 seconds)
* A new WebService::Yelp object, or undef if there were problems.
This set of functions searches for and returns review and business information. The following two parameters are common across these functions. Note that output determines the return values for all search functions as well.
* output - Result output type.
This controls what is returned by the API. The default is WebService::Yelp::* objects. Other options are 'php', 'json', and 'pickle'. If one of these three options is specified, the raw data will be returned by the search function as a scalar value. Otherwise, a WebService::Yelp::Result object will be returned. If there was a transport level error, search functions simply return undef and print the requests status line to STDERR.
Your first step should be to check the WebService::Yelp::Message object available by calling the WebService::Yelp::Result->message() method and checking the value of code(). See:
http://www.yelp.com/developers/documentation/search_api#rCode
for more information on the return codes, messages, and error descriptions.
* category - Narrow results to specific categories.
By selecting only specific categories, search results can be confined to businesses that match those categories. Multiple categories can be speficied by combining them with a plus sign, i.e. bars+poolhalls
Limit the search to an area within a specific geographical box specified by four geographic points.
* tl_lat - Top Left latitude of bounding box
* tl_long - Top Left longitude of bounding box
* br_lat - Bottom right latitude of bounding box
* br_long - Bottom right longitude of bounding box
* term - Business name or search term.
* num_biz_requested - Number of businesses to return (1-20, Default 10).
Given a point and an outward radius, search for businesses within the area.
* lat - The latitude of the point.
* long - The longitude of the point.
* radius - The outward radius from the two points above, Max is 25.
Given a general or specific location, search for matching businesses.
* location - An address, neighborhood, city, state, or zip code.
Find a specific business by phone number.
* phone - An all digit phone number (like 1-234-567-8901)
The following functions return neighborhood data. The output parameter as described above is valid for these as well.
Given a latitude and longitude, return neighborhood information for the location.
* lat - The latitude.
* long - The longitude.
Given a general or specific location, search for matching neighborhoods.
Call is the actual search implementation. The other functions call it by specifying the search function first, so if you'd prefer you can use it directly. Search functions names are separated by periods (in the same way the methods above use underscores) i.e.
$yelp->search_review_gpr({ ....
is the same as
$yelp->call('search.review.gpr', { ....
LWP::UserAgent
This module's source and other documentation is hosted at http://code.google.com/p/perl-www-yelp-api/
josh rotenberg, <joshrotenberg@gmail.com>
Copyright (C) 2008 by josh rotenberg
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
Note that this software is not maintained, endorsed, sponsored, supported, or otherwise managed by Yelp. All inquiries related to this software should be directed to the author.
To install WebService::Yelp, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Yelp
CPAN shell
perl -MCPAN -e shell install WebService::Yelp
For more information on module installation, please visit the detailed CPAN module installation guide.