class Yelp::Fusion::Endpoint::Business
Endpoint
to make client requests to the Businesses API
Constants
- PATH
Public Class Methods
# File lib/yelp/fusion/endpoint/business.rb, line 35 def initialize(client) @client = client end
Public Instance Methods
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::Business] the parsed response object from the API
@example Get business
business = client.business('yelp-san-francisco') business.name # => 'Yelp' buinesss.url # => 'http://www.yelp.com/biz/yelp-san-francisco'
# File lib/yelp/fusion/endpoint/business.rb, line 49 def business(id, locale = {}) Responses::Business.new(JSON.parse(business_request(id, locale).body)) end
Private Instance Methods
Make a request to the business endpoint of the API The endpoint requires a format of /v3/business/{business-id} 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, Integer] 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/business.rb, line 64 def business_request(id, locale = {}) result = @client.connection.get (PATH + ERB::Util.url_encode(id)), locale Error.check_for_error(result) result end