google-maps
google-places
Crystal wrapper around the Google Places API
Installation
Add this to your application's shard.yml
:
dependencies:
google-places:
github: liepaja/google-places
Usage
require "google-places"
Place Autocomplete
https://developers.google.com/places/web-service/autocomplete
Default options
#GooglePlaces::Api::Client.new(api_key : String, @format = Formats::Json, tls = true)
client = GooglePlaces::Api::Client.new("AIzaSyAdutrZU_b83yb4Otn-6yuJ79QvFR9anIM") # Xml currently not supported
response = client.autocomplete("Riga")
response.status # Ok
response.predictions[0].description # Riga, Latvia
Custom options
client = GooglePlaces::Api::Client.new("AIzaSyAdutrZU_b83yb4Otn-6yuJ79QvFR9anIM")
response = client.autocomplete("Riga", {"types" => "(cities)", "language" => "nl"})
response.status # Ok
response.predictions[0].description # Riga, Letland
OpenSSL workaround
# Some users face OpenSSL issues, in this case tls can be made insecure
client = GooglePlaces::Api::Client.new("AIzaSyAdutrZU_b83yb4Otn-6yuJ79QvFR9anIM", GooglePlaces::Formats::Json, tls = false)
Development
- Expand api
- Write tests
- Solve OpenSSL issues
Contributing
- Fork it ( https://github.com/liepaja/google-places/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- liepaja Ernests Elksnis - creator, maintainer
Repository
google-maps
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- over 6 years ago
- February 21, 2018
License
MIT License
Links
Synced at
Fri, 22 Nov 2024 10:31:40 GMT
Languages