Class: Yelp::Fusion::Endpoint::Business

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

Overview

Endpoint to make client requests to the Businesses API

Constant Summary collapse

PATH =
'/v3/businesses/'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Business

Returns a new instance of Business.



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

def initialize(client)
  @client = client
end

Instance Method Details

#business(id, locale = {}) ⇒ Response::Business

Make a request to the business endpoint on the API

Examples:

Get business

business = client.business('yelp-san-francisco')
business.name # => 'Yelp'
buinesss.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::Business)

    the parsed response object from the API



49
50
51
# File 'lib/yelp/fusion/endpoint/business.rb', line 49

def business(id, locale = {})
  Responses::Business.new(JSON.parse(business_request(id, locale).body))
end