GithubHelp home page GithubHelp logo

locationiq-ruby-client's Introduction

locationiq-ruby-client

LocationIQClient - the Ruby gem for the LocationIQ

LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.0
  • Package version: 1.1.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build locationiq-ruby-client.gemspec

Then either install the gem locally:

gem install ./locationiq-ruby-client-1.1.0.gem

(for development, run gem install --dev ./locationiq-ruby-client-1.1.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'locationiq-ruby-client', '~> 1.1.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/location-iq/locationiq-ruby-client, then add the following in the Gemfile:

gem 'locationiq-ruby-client', :git => 'https://github.com/location-iq/locationiq-ruby-client.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'locationiq-ruby-client'

# Setup authorization
LocationIQClient.configure do |config|
  # Configure API key authorization: key
  config.api_key['key'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  #config.api_key_prefix['key'] = 'Bearer'
end

api_instance = LocationIQClient::AutocompleteApi.new
q = 'Empire state' # String | Address to geocode
normalizecity = 1 # Integer | For responses with no city value in the address section, the next available element in this order - city_district, locality, town, borough, municipality, village, hamlet, quarter, neighbourhood - from the address section will be normalized to city. Defaults to 1 for SDKs.
opts = {
  limit: 10, # Integer | Limit the number of returned results. Default is 10.
  viewbox: '-132.84908,47.69382,-70.44674,30.82531', # String | The preferred area to find search results.  To restrict results to those within the viewbox, use along with the bounded option. Tuple of 4 floats. Any two corner points of the box - `max_lon,max_lat,min_lon,min_lat` or `min_lon,min_lat,max_lon,max_lat` - are accepted in any order as long as they span a real box. 
  bounded: 1, # Integer | Restrict the results to only items contained with the viewbox
  countrycodes: 'us', # String | Limit search to a list of countries.
  accept_language: 'en', # String | Preferred language order for showing search results, overrides the value specified in the Accept-Language HTTP header. Defaults to en. To use native language for the response when available, use accept-language=native
  tag: 'place' # String | Restricts the autocomplete search results to elements of specific OSM class and type.  Example - To restrict results to only class place and type city: tag=place:city, To restrict the results to all of OSM class place: tag=place
}

begin
  result = api_instance.autocomplete(q, normalizecity, opts)
  p result
rescue LocationIQClient::ApiError => e
  puts "Exception when calling AutocompleteApi->autocomplete: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://eu1.locationiq.com/v1

Class Method HTTP request Description
LocationIQClient::AutocompleteApi autocomplete GET /autocomplete.php
LocationIQClient::BalanceApi balance GET /balance.php
LocationIQClient::DirectionsApi directions GET /directions/driving/{coordinates} Directions Service
LocationIQClient::MatchingApi matching GET /matching/driving/{coordinates} Matching Service
LocationIQClient::MatrixApi matrix GET /matrix/driving/{coordinates} Matrix Service
LocationIQClient::NearestApi nearest GET /nearest/driving/{coordinates} Nearest Service
LocationIQClient::ReverseApi reverse GET /reverse.php Reverse Geocoding
LocationIQClient::SearchApi search GET /search.php Forward Geocoding

Documentation for Models

Documentation for Authorization

key

  • Type: API key
  • API key parameter name: key
  • Location: URL query string

locationiq-ruby-client's People

Contributors

drupeshunwired avatar rocainunwired avatar

Watchers

 avatar

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.