require_relative 'google_api_inter' module Google class GooglePlaceRating attr_reader :rating_rawdata,:attracs def initialize(data,input) @googleapi = ENV['GOOGLE_API'] @queryVal = input[0] @attracs = rating_analysis(data) # @info = data[0] end def self.find(query:) rating_rawdata = InternalGoogleApi.this_rating(query) @queryRating_input = {googleapi:ENV['GOOGLE_API'],queryKey:query} new(rating_rawdata,@queryRating_input) end def return_rating @info end private def rating_analysis(queryresult) queryresult.map do |place| { rating: place['rating'], lat: place['geometry']['location']['lat'], lng: place['geometry']['location']['lng'], placeid: place['place_id'], types: place['types'], address: place['formatted_address'], placename: place['name'], id: place['id'], icon: place['icon'], opening_hours: place['opening_hours'] } end end end end