Giter Club home page Giter Club logo

googlemaps-services's People

Contributors

amrfaissal avatar kevgrig avatar nerfologist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

googlemaps-services's Issues

Error: undefined method `+' for nil:NilClass with OVER_QUERY_LIMIT response

Hello, I'm using this nice library to query the Google geocoding API, and I just went over the query limit of 2500 requests/day. Immediately, in the middle of my script, I started getting errors such as this:

undefined method `+' for nil:NilClass
  googlemaps-services-1.4.7/lib/googlemaps/services/client.rb:170:in `rescue in request'
  googlemaps-services-1.4.7/lib/googlemaps/services/client.rb:150:in `request'
  googlemaps-services-1.4.7/lib/googlemaps/services/geocoding.rb:60:in `query'

This is generated when responses such as the following are received:

status: 200 OK
body:
{
    "error_message": "You have exceeded your daily request quota for this API.",
    "results": [],
    "status": "OVER_QUERY_LIMIT"
}

I assume it's related to retry_counter being nil (declared as a param with a default value of nil in lib/googlemaps/services/client.rb:102 and incremented in the rescue block at line 170 in the same file.

Do you think retry_counter should have a default value of 0 instead?

Thanks for your library, HTH

Asset tracking api

Hi,

Does it support Asset Tracking api ?

If yes then how to use ?

Thanks.

FrozenError (can't modify frozen String: ""): distance_to

First of all thanks for making an awesome gem. It was so simple to get it working.

My code was working fine, but recently i started getting a frozen string error.

This is calling the distance matrix api. Implemented as a concern on a model called 'Address':

The error is thrown when calling the query:

Address.distance.query(origins: origin, destinations: dest, mode: 'driving', units: units)

Full concern code is this:

require 'googlemaps/services/client'
require 'googlemaps/services/distancematrix'

module Mappable
  extend ActiveSupport::Concern
  include GoogleMaps::Services

  # https://maps.googleapis.com/maps/api/distancematrix/json?&key=

  included do
    client = GoogleClient.new(key: Rails.application.secrets.google_api_key, response_format: :json)
    self.distance = DistanceMatrix.new(client) # creates a class instance variable (so this will be a singleton)
  end
  
  module ClassMethods
    attr_accessor :distance
  end

  def distance_to(destination, units)
    dest = []
    origin = []
    dest << {lat:"#{destination.latitude}", lng:"#{destination.longitude}"}
    origin << {lat:"#{self.latitude}", lng:"#{self.longitude}"}
    result = Address.distance.query(origins: origin, destinations: dest, mode: 'driving', units: units)
    puts 'result is ****', result
    return result['rows'][0]['elements'][0]['distance']
  end

end

Bump http gem to 3.0

Would it be possible to bump up this dependency? It's conflicting with another gem's dependency :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.