Gem Build Status Code Climate Dependency Status Test Coverage

YandexLocator

Ruby gem for Yandex locator (https://tech.yandex.ru/locator/). Yandex locator is a service that finds mobile devices in a region delineated by a circle. The service returns longitude, latitude and precision.

Installation

Add this line to your application's Gemfile:

gem 'yandex_locator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install yandex_locator

Usage

Configure gem credentials

 YandexLocator.configure do |config|
    config.api_key = ENV['YANDEX_API_KEY']
    config.version = "1.0"
 end

Make request

  conn = YandexLocator::Client.new
  result = conn.lookup(ip: "109.252.52.39")
  # => {"position"=>{"altitude"=>0.0, "altitude_precision"=>30.0, "latitude"=>55.75395965576172, "longitude"=>37.62039184570312, "precision"=>100000.0, "type"=>"ip"}}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sergey-chechaev/yandex_locator.