{"id":17159640,"url":"https://github.com/jvillarejo/spyme","last_synced_at":"2025-04-09T16:16:58.361Z","repository":{"id":24060939,"uuid":"27446994","full_name":"jvillarejo/spyme","owner":"jvillarejo","description":"Rails plugin that stores the browser geolocation","archived":false,"fork":false,"pushed_at":"2023-02-10T17:14:23.000Z","size":84,"stargazers_count":109,"open_issues_count":15,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-09T16:16:44.561Z","etag":null,"topics":["geocoding","geolocation","rails","ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jvillarejo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-02T18:30:35.000Z","updated_at":"2025-02-26T13:07:24.000Z","dependencies_parsed_at":"2023-02-17T07:00:51.905Z","dependency_job_id":null,"html_url":"https://github.com/jvillarejo/spyme","commit_stats":{"total_commits":39,"total_committers":4,"mean_commits":9.75,"dds":"0.23076923076923073","last_synced_commit":"c656a2b8f04688bcbaae9ada8b3035fb43f908f3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvillarejo%2Fspyme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvillarejo%2Fspyme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvillarejo%2Fspyme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jvillarejo%2Fspyme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jvillarejo","download_url":"https://codeload.github.com/jvillarejo/spyme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065285,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["geocoding","geolocation","rails","ruby"],"created_at":"2024-10-14T22:14:46.550Z","updated_at":"2025-04-09T16:16:58.332Z","avatar_url":"https://github.com/jvillarejo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spyme\n\nTrack your visits location using the **Geolocation Browser API** easily\n\nLocation is stored in the session, it doesn't generate any model so you can persist it in anyway you like.\n\nYou get:\n\n- **better geolocation** - Browser geolocation has much better exactness than IP-based geocoding.\n- **persist it the way you want it** - As Spyme doesn't define any persisting model, you can map it to your model in any way you like.\n\n## How it works\n\nWhen someone visits your site Spyme will check if the browser support the Geolocation API and if the user accepts to be tracked it automatically stores the the location in the session.\n\nUse `current_location` to access the Location object for the current visit.\n\n## Power up\n\nUse [Geocoder](https://github.com/alexreisner/geocoder) with Spyme to track your model objects near the visit current location.\n\n### Example: \n\n```ruby\nVenue.near(current_location.coords, 20) # venues within 20 miles current visit location\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'spyme'\n```\n\nLastly, include the javascript file in `app/assets/javascripts/application.js` after jQuery.\n\n```javascript\n//= require jquery\n//= require spyme\n```\n\n### Location\n\nSpyme automatically stores the current location at the session you can access in your controller with this helper method\n\n```ruby\ncurrent_location\n```\n\nSometimes the user deny the tracking or the browser doesn't support geolocation, you can check if the current location is valid\n\n```ruby\ncurrent_location.valid?\n```\n\nAlso the `Spyme::Model::Location` object has some useful methods\n\n#### to_hash\n```ruby\ncurrent_location.to_hash\n```\n\nreturns `{ latitude: # tracked_latitude, longitude: # tracked_longitude }`\n\n#### coords\n```ruby\ncurrent_location.coords\n```\n\nreturns `[ # tracked_latitude, # tracked_longitude]`\n\n## Contributing\n\nEveryone is encouraged to help improve this project. Here are a few ways you can help:\n\n- [Report bugs](https://github.com/jvillarejo/spyme/issues)\n- Fix bugs and [submit pull requests](https://github.com/jvillarejo/spyme/pulls)\n- Suggest or add new features\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvillarejo%2Fspyme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjvillarejo%2Fspyme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjvillarejo%2Fspyme/lists"}