LOLCATION CLIENT
A Rails GEM to use Lolcation Service.
Getting started
Add to your Gemfile
:
gem 'lolcation_client'
Then run bundle install
Run the generator:
rails generate lolcation_client:install`
In your model add follow code:
class LolcalizationModel < ApplicationRecord
extend LolcationClient
end
You can also define lolcation_fields and lolcation_custom_fields, so you can filter later when you need
class LolcalizationModel < ApplicationRecord
extend LolcationClient
lolcation_fields latitude: :my_latitude_attr, address_street: :my_street_attr
lolcation_custom_fields :foo, :bar, :baz
end
Run the generator to create location fields:
rails generate lolcation_client:migration MODEL
Run your migrate:
rails db:migrate
You must set your token at : config/lolcation.yml
development:
token: 'TOKEN'
sandbox: true
staging:
token: 'TOKEN'
sandbox: true
production:
token: 'TOKEN'
Finding closest localizations with the method near_me
method
LocalizationModel.near_in(latitude: lat, longitude: lgt, distance: 10.0, filter: {foo: 'bar'})
- Note that filter will look up for custom_fields!
If you want just return the lolcationId field, just add option only_ids: true like:
LocalizationModel.near_in(latitude: lat, longitude: lgt, distance: 10.0, filter: {foo: 'bar'}, only_ids: true)
Versioning
LOLCATION CLIENT follows the Semantic Versioning standard.
Issues
If you have problems, please create a Github Issue.
Contributing
Please see CONTRIBUTING.md for details.
Maintainers
Release
Follow this steps to release a new version of the gem.
- Test if everything is running ok;
- Change version of the gem on
VERSION
constant; - Add the release date on the
CHANGELOG
; - Do a commit "Bump version x.x.x", follow the semantic version;
- Run
$ rake release
, this will send the gem to the rubygems; - Check if the gem is on the rubygems and the tags are correct on the github;
Made with love by LolDesign
This gem was created and is maintained by LolDesign.