Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ola_maps

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ola_maps

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Ola Maps

A Ruby gem for interacting with the Ola Maps API, providing a simple interface for location-based services like autocomplete, geocoding, and reverse geocoding.

Installation

Add this line to your application's Gemfile:

gem 'ola_maps'

Then, execute:

$ bundle install

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install 'ola_maps'

Configuration

Before using the gem, set up your environment variables in a .env file:

API_KEY=your_api_key
CLIENT_ID=your_client_id
CLIENT_SECRET=your_client_secret

Usage

Here's how to use the OlaMaps gem:

require 'dotenv/load'
require 'ola_maps'

client = OlaMaps::Client.new(
  api_key: ENV['API_KEY']
)

# Autocomplete
autocomplete_response = client.autocomplete('kempe')
puts autocomplete_response.body

# Geocode
geocode_response = client.geocode('Bangalore')
puts geocode_response.body

# Reverse Geocode
reverse_geocode_response = client.reverse_geocode('12.931316595874005,77.61649243443775')
puts reverse_geocode_response.body

API Methods

#autocomplete(input, origin: nil, location: nil, radius: nil, strictbounds: nil)

Returns autocomplete suggestions based on the input string.

  • Parameters:
    • input: The input string for autocomplete.
    • origin: (Optional) The origin location.
    • location: (Optional) The location to bias the results.
    • radius: (Optional) The radius within which to return results.
    • strictbounds: (Optional) If true, restrict results to the specified area.

#geocode(address, bounds: nil, language: 'English')

Returns geocoded address information.

  • Parameters:
    • address: The address to geocode.
    • bounds: (Optional) The bounds within which to search.
    • language: (Optional) The language for the response (default is 'English').

#reverse_geocode(latlng)

Returns reverse geocoded address information for a given latitude and longitude.

  • Parameters:
    • latlng: The latitude and longitude in the format lat,lng.

Running Tests

To run the tests for this gem, ensure you have the required environment variables set in your .env file, then execute:

bundle exec rspec

Contributing

  1. Fork it (https://github.com/shobhit-shukla/ola_maps/fork)
  2. Create your feature branch (git checkout -b feature/YourFeature)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/YourFeature)
  5. Create a new Pull Request

Bug reports and pull requests are welcome on GitHub at ola_maps. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

This gem is available as open-source under the terms of the MIT License.

Customization

Feel free to modify sections like the installation instructions or API method descriptions to match your specific implementation details.

Code of Conduct

Everyone interacting in the OlaMaps project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 13 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc