class Yelp::Fusion::Endpoint::Match

Class for requests to find matching businesses

Constants

PATH

Public Class Methods

new(client) click to toggle source
# File lib/yelp/fusion/endpoint/match.rb, line 35
def initialize(client)
  @client = client
end

Public Instance Methods

match(params = {}) click to toggle source

Make a request to the business endpoint

@param params [Hash] a hash of the required location parameters @return [Response::Match] a parsed object of the response.

For a complete sample response visit:
https://www.yelp.com/developers/documentation/v3/business_match

@example Search for business with params

params = { name: 'swissbakers', address1:
'168 Western Ave', city: 'allston', state:
'MA', country: 'US' }
response = client.mathc(params)
response.businesses # [<Business 1>, <Business 2>, <Business 3>]
response.businesses[0].name # 'Yelp'
# File lib/yelp/fusion/endpoint/match.rb, line 53
def match(params = {})
  Responses::Match.new(JSON.parse(match_request(params).body))
end

Private Instance Methods

match_request(params = {}) click to toggle source
# File lib/yelp/fusion/endpoint/match.rb, line 59
def match_request(params = {})
  result = @client.connection.get(PATH, params)
  Error.check_for_error(result)
  result
end