Socket
Book a DemoInstallSign in
Socket

timezone_teleporter

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone_teleporter

0.5.0
bundlerRubygems
Version published
Maintainers
3
Created
Source

TimezoneTeleporter

TimezoneTeleporter

TimezoneTeleporter anonymizes users' GPS coordinates by generating random coordinates in the same time zone. These new coordinates may be used then safely by 3rd party systems to process the users' location, without disclosing their actual physical position, providing more privacy, and anonymity to users.

Dependencies

  • Uses the gem timezone_finder for time zone lookup.

Installation

Add this line to your application's Gemfile:

gem 'timezone_teleporter'

And then execute:

$ bundle

Or install it yourself as:

$ gem install timezone_teleporter

Configuration

TimezoneTeleporter can be configured in an initializer:

TimezoneTeleporter.configure do |c|
  c.silent_exceptions       = true
  c.use_proximity_algorithm = true
  c.delta_degree            = 1
end

Use following configuration flags to customise the library's behaviour:

  • silent_exceptions: if set to true, no errors are raised and teleport returns nil in case no location could be found (default is true),
  • use_proximity_algorithm: if the timezone is not found, TimezoneTeleporter tries to find the closest timezone within +-1 delta_degree longitude and +-1 delta_degree latitude (default is true),
  • delta_degree: defines the radius for the proximity algorithm (default is 1).

Usage

Teleport with coordinates or timezone

Use TimezoneTeleporter.teleport(lat, lng) or TimezoneTeleporter.teleport(timezone) to generate randomized coordinates inside the same time zone by passing coordinates:

TimezoneTeleporter.teleport(52.520007, 13.404954)
# => [51.165691, 10.451526]
TimezoneTeleporter.teleport("Europe/Berlin")
# => [51.165691, 10.451526]

Note: If time zone is not found, TimezoneTeleporter.teleport will return nil if silent_exceptions is set to true.

To get the best result, use both versions together with silent exceptions:

TimezoneTeleporter.configure { |c| c.silent_exceptions = true }

TimezoneTeleporter.teleport("Europe/Berlin") || TimezoneTeleporter.teleport(52.520007, 13.404954)
# => [51.165691, 10.451526]

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 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.

License

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

Code of Conduct

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

FAQs

Package last updated on 12 Aug 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.