<commit_before>require 'rubygems'
require 'oauth'
require 'pry'
require 'json'

class Yelp
	def initialize(array)
		@array = array
	end

	def get_values
		consumer_key = 'h-PhZkg6N-RV08KQAoHbkQ'
		consumer_secret = '<KEY>'
		token = '<KEY>'
		token_secret = '<KEY>'

		api_host = 'api.yelp.com'

		@food_path = "/v2/search?term=food&ll=#{@array[0]},#{@array[1]}&limit=#{@array[2]}"

		consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {:site => "http://#{api_host}"})
		access_token = OAuth::AccessToken.new(consumer, token, token_secret)

		@yelp_data = JSON.parse(access_token.get(@food_path).body)
	end

	def returning
		rest = [] 
		get_values
		i = 0
		while i < @array[2].to_i
			rest.push(
				@yelp_data["businesses"][i]["name"], 
				@yelp_data["businesses"][i]["rating"],
				@yelp_data["businesses"][i]["rating_img_url_small"],
				@yelp_data["businesses"][i]["url"],
				@yelp_data["businesses"][i]["image_url"])
			i += 1
		end
		rest
	end
end<commit_msg>Added bars functionality, it works<commit_after>require 'rubygems'
require 'oauth'
require 'pry'
require 'json'

class Yelp
	def initialize(array)
		@array = array
	end

	def get_values
		consumer_key = 'h-PhZkg6N-RV08KQAoHbkQ'
		consumer_secret = '<KEY>'
		token = '<KEY>'
		token_secret = '<KEY>'

		api_host = 'api.yelp.com'

		@food_path = "/v2/search?term=food&ll=#{@array[0]},#{@array[1]}&limit=#{@array[2]}"
		@bar_path = "/v2/search?term=bar&ll=#{@array[0]},#{@array[1]}&limit=#{@array[2]}"
		consumer = OAuth::Consumer.new(consumer_key, consumer_secret, {:site => "http://#{api_host}"})
		access_token = OAuth::AccessToken.new(consumer, token, token_secret)

		@restaurant_data = JSON.parse(access_token.get(@food_path).body)
		@bar_data = JSON.parse(access_token.get(@bar_path).body)
	end

	def restaurant_yelp
		restaurant = [] 
		get_values
		i = 0
		while i < @array[2].to_i
			restaurant.push(
				@restaurant_data["businesses"][i]["name"], 
				@restaurant_data["businesses"][i]["rating"],
				@restaurant_data["businesses"][i]["rating_img_url_small"],
				@restaurant_data["businesses"][i]["url"],
				@restaurant_data["businesses"][i]["image_url"])
			i += 1
		end
		restaurant
	end
		def bar_yelp
		bar = []
		get_values
		i = 0
		while i < @array[2].to_i
			bar.push(
				@bar_data["businesses"][i]["name"], 
				@bar_data["businesses"][i]["rating"],
				@bar_data["businesses"][i]["rating_img_url_small"],
				@bar_data["businesses"][i]["url"],
				@bar_data["businesses"][i]["image_url"])
			i += 1  	
		end  
		bar
	end
end
{'fraction_non_alphanumeric': 0.1904950495049505, 'fraction_numerical': 0.010693069306930694, 'mean_word_length': 4.971631205673759, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3578762', 'n_tokens_mistral': 1162, 'n_tokens_neox': 1010, 'n_words': 151}