Class: Yelp::Fusion::Endpoint::Match

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

Overview

Class for requests to find matching businesses

Constant Summary collapse

PATH =
'/v3/businesses/matches'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Match

Returns a new instance of Match.



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

def initialize(client)
  @client = client
end

Instance Method Details

#match(params = {}) ⇒ Response::Match

Make a request to the business endpoint

Examples:

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'

Parameters:

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

    a hash of the required location parameters

Returns:



53
54
55
# File 'lib/yelp/fusion/endpoint/match.rb', line 53

def match(params = {})
  Responses::Match.new(JSON.parse(match_request(params).body))
end