Sha256: 340a22038e72c2083a34b48eb221d5332f7b327ac712d995759cd5d918e22901

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
VIAJERO-0.1.74 lib/VIAJERO/internal.rb
VIAJERO-0.1.73 lib/VIAJERO/internal.rb