| 1 | package WebService::Yelp::Result; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use base qw/Class::Accessor/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | __PACKAGE__->mk_ro_accessors(qw/businesses neighborhoods message/); | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | WebService::Yelp::Result - Yelp.cpm API Search Result Container | ||
| 12 | |||
| 13 | =head1 SYNOPSIS | ||
| 14 | |||
| 15 | use strict; | ||
| 16 | use WebService::Yelp; | ||
| 17 | |||
| 18 | my $yelp = WebService::Yelp->new({ywsid => 'XXXXXXXXXXXX'}); | ||
| 19 | |||
| 20 | my $biz_res = $yelp->search_review_hood({ | ||
| 21 | term => 'cream puffs', | ||
| 22 | location => 'San Francisco', | ||
| 23 | }; | ||
| 24 | |||
| 25 | if($biz_res->message->code() == 0) { | ||
| 26 | # returns an array ref of businesses | ||
| 27 | my $businesses = $biz_res->businesses(); | ||
| 28 | # ... | ||
| 29 | } | ||
| 30 | |||
| 31 | my $hood_res = $yelp->search_neigborhood_location({ | ||
| 32 | location => 'Shattuck Avenue, Berkeley, CA', | ||
| 33 | }); | ||
| 34 | if($hood_res->message->code() == 0) { | ||
| 35 | # returns an array ref of neighborhoods | ||
| 36 | my $neighborhoods = $hood_res->neighborhoods(); | ||
| 37 | # ... | ||
| 38 | } | ||
| 39 | |||
| 40 | =head1 DESCRIPTION | ||
| 41 | |||
| 42 | This class simply contains the results of a Review or Neighborhood | ||
| 43 | search, as well as the result B<WebService::Yelp::Message> class. It | ||
| 44 | is the return value of all search methods (including the raw call() | ||
| 45 | method) from B<WebService::Yelp> *if* no other output type was | ||
| 46 | specified. | ||
| 47 | |||
| 48 | If the call was a review search, the businesses method will return an | ||
| 49 | array reference of B<WebService::Yelp::Business> objects. Likewise, a | ||
| 50 | neighborhood search returns an array reference of | ||
| 51 | B<WebService::Yelp::Neighborhood> objects via the neighborhoods | ||
| 52 | method. | ||
| 53 | |||
| 54 | =head1 METHODS (Read Only) | ||
| 55 | |||
| 56 | =head2 businesses | ||
| 57 | |||
| 58 | Returns an array reference of B<WebService::Yelp::Business> objects. | ||
| 59 | |||
| 60 | =head2 neighborhoods | ||
| 61 | |||
| 62 | Returns an array reference of B<WebService::Yelp::Neighborhood> objects. | ||
| 63 | |||
| 64 | =head2 message | ||
| 65 | |||
| 66 | Returns a B<WebService::Yelp::Message> object. | ||
| 67 | |||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | 1; | ||
| 72 | |||