Class: Yelp::Endpoint::PhoneSearch

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

Constant Summary collapse

PATH =
'/v2/phone_search/'

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PhoneSearch

Returns a new instance of PhoneSearch.



10
11
12
# File 'lib/yelp/endpoint/phone_search.rb', line 10

def initialize(client)
  @client = client
end

Instance Method Details

#phone_search(phone, options = {}) ⇒ Response::PhoneSearch

Make a request to the business endpoint on the API

Examples:

Search for business with params and locale

options = { code: 'US',
           category: 'localflavor' }

response = client.phone_search('+14159083801', options)
response.businesses # [<Business 1>, <Business 2>, <Business 3>]
response.businesses[0].name # 'Yelp'

Parameters:

  • phone_number (String)

    the phone number

Returns:



29
30
31
32
33
34
# File 'lib/yelp/endpoint/phone_search.rb', line 29

def phone_search(phone, options={})
  params = {phone: phone}
  params.merge!(options)

  Response::PhoneSearch.new(JSON.parse(phone_search_request(params).body))
end