Class: Yelp::Fusion::Endpoint::Review

Inherits:
Object
  • Object
show all
Defined in:
lib/yelp/fusion/endpoint/review.rb

Overview

Class to search for business reviews

Constant Summary collapse

PATH =
'/v3/businesses/'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Review

Returns a new instance of Review.



35
36
37
# File 'lib/yelp/fusion/endpoint/review.rb', line 35

def initialize(client)
  @client = client
end

Instance Method Details

#review(id, locale = {}) ⇒ Response::Review

Make a request to the business endpoint on the API

Examples:

Get Review

id = 'xAG4O7l-t1ubbwVAlPnDKg'
locale = { lang: 'fr' }
response = client.review(id, locale)
response.name # => 'Yelp'
response.url  # => 'http://www.yelp.com/biz/yelp-san-francisco'

Parameters:

  • id (String)

    the business id

  • locale (Hash) (defaults to: {})

    a hash of supported locale-related parameters

Returns:

  • (Response::Review)

    the parsed response object from the API



51
52
53
# File 'lib/yelp/fusion/endpoint/review.rb', line 51

def review(id, locale = {})
  Responses::Review.new(JSON.parse(review_request(id, locale).body))
end