class Yelp::Fusion::Endpoint::Review
Class to search for business reviews
Constants
- PATH
Public Class Methods
new(client)
click to toggle source
# File lib/yelp/fusion/endpoint/review.rb, line 35 def initialize(client) @client = client end
Public Instance Methods
review(id, locale = {})
click to toggle source
Make a request to the business endpoint on the API
@param id [String] the business id @param locale [Hash] a hash of supported locale-related parameters @return [Response::Review] the parsed response object from the API
@example 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'
# File lib/yelp/fusion/endpoint/review.rb, line 51 def review(id, locale = {}) Responses::Review.new(JSON.parse(review_request(id, locale).body)) end
Private Instance Methods
review_request(id, locale = {})
click to toggle source
Make a request to the review endpoint of the API The endpoint requires a format of v3/businesses/{id}/reviews so the primary request parameter is concatenated. After getting the response back it's checked to see if there are any API errors and raises the relevant one if there is.
@param id [String] the business id @param locale [Hash] a hash of supported locale-related parameters @return [Faraday::Response] the raw response back from the connection
# File lib/yelp/fusion/endpoint/review.rb, line 66 def review_request(id, locale = {}) result = @client.connection.get (PATH + ERB::Util.url_encode(id) + '/reviews'), locale Error.check_for_error(result) result end