geokit-rails 2.3.2 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +80 -0
  3. data/.gitignore +44 -37
  4. data/CHANGELOG.md +106 -96
  5. data/CONFIG.markdown +67 -67
  6. data/Gemfile +3 -3
  7. data/MIT-LICENSE +19 -19
  8. data/README.markdown +726 -726
  9. data/Rakefile +17 -17
  10. data/gemfiles/rails7.1.gemfile +11 -0
  11. data/gemfiles/{rails3.gemfile → rails7.2.gemfile} +7 -7
  12. data/gemfiles/{rails4.gemfile → rails8.0.gemfile} +7 -8
  13. data/gemfiles/{rails5.gemfile → rails8.1.gemfile} +7 -8
  14. data/geokit-rails.gemspec +34 -33
  15. data/lib/generators/geokit_rails/install_generator.rb +13 -13
  16. data/lib/generators/templates/geokit_config.rb +100 -100
  17. data/lib/geokit-rails/acts_as_mappable/class_methods.rb +299 -0
  18. data/lib/geokit-rails/acts_as_mappable/glue.rb +54 -0
  19. data/lib/geokit-rails/acts_as_mappable.rb +78 -425
  20. data/lib/geokit-rails/adapters/abstract.rb +30 -30
  21. data/lib/geokit-rails/adapters/mysql.rb +21 -21
  22. data/lib/geokit-rails/adapters/mysql2.rb +8 -8
  23. data/lib/geokit-rails/adapters/mysql2spatial.rb +8 -8
  24. data/lib/geokit-rails/adapters/oracleenhanced.rb +32 -32
  25. data/lib/geokit-rails/adapters/postgresql.rb +21 -21
  26. data/lib/geokit-rails/adapters/sqlite.rb +53 -53
  27. data/lib/geokit-rails/adapters/sqlserver.rb +45 -45
  28. data/lib/geokit-rails/{core_extensions.rb → distance_collection.rb} +8 -8
  29. data/lib/geokit-rails/geocoder_control.rb +19 -19
  30. data/lib/geokit-rails/ip_geocode_lookup.rb +44 -48
  31. data/lib/geokit-rails/railtie.rb +37 -37
  32. data/lib/geokit-rails/version.rb +3 -3
  33. data/lib/geokit-rails.rb +11 -9
  34. data/test/acts_as_mappable_test.rb +486 -478
  35. data/test/adapter_resolution_test.rb +46 -0
  36. data/test/boot.rb +40 -32
  37. data/test/database.yml +31 -28
  38. data/test/distance_collection_test.rb +42 -0
  39. data/test/dummy/Rakefile +6 -0
  40. data/test/dummy/app/assets/images/.keep +0 -0
  41. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  42. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  43. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  44. data/test/dummy/app/controllers/application_controller.rb +3 -0
  45. data/test/dummy/app/controllers/concerns/.keep +0 -0
  46. data/test/dummy/app/controllers/location_aware_controller.rb +43 -0
  47. data/test/dummy/app/helpers/application_helper.rb +2 -0
  48. data/test/dummy/app/jobs/application_job.rb +7 -0
  49. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  50. data/test/dummy/app/models/application_record.rb +3 -0
  51. data/test/dummy/app/models/concerns/.keep +0 -0
  52. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  53. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  54. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  55. data/test/dummy/bin/rails +4 -0
  56. data/test/dummy/bin/rake +4 -0
  57. data/test/dummy/bin/setup +33 -0
  58. data/test/dummy/config/application.rb +22 -0
  59. data/test/dummy/config/boot.rb +5 -0
  60. data/test/dummy/config/cable.yml +10 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +68 -0
  64. data/test/dummy/config/environments/production.rb +87 -0
  65. data/test/dummy/config/environments/test.rb +60 -0
  66. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  67. data/test/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  68. data/test/dummy/config/initializers/inflections.rb +16 -0
  69. data/test/dummy/config/initializers/permissions_policy.rb +11 -0
  70. data/test/dummy/config/locales/en.yml +33 -0
  71. data/test/dummy/config/puma.rb +43 -0
  72. data/test/dummy/config/routes.rb +6 -0
  73. data/test/dummy/config/storage.yml +34 -0
  74. data/test/dummy/config.ru +6 -0
  75. data/test/dummy/lib/assets/.keep +0 -0
  76. data/test/dummy/log/.keep +0 -0
  77. data/test/dummy/public/404.html +67 -0
  78. data/test/dummy/public/422.html +67 -0
  79. data/test/dummy/public/500.html +66 -0
  80. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  81. data/test/dummy/public/apple-touch-icon.png +0 -0
  82. data/test/dummy/public/favicon.ico +0 -0
  83. data/test/dummy/storage/.keep +0 -0
  84. data/test/dummy/tmp/.keep +0 -0
  85. data/test/dummy/tmp/pids/.keep +0 -0
  86. data/test/dummy/tmp/storage/.keep +0 -0
  87. data/test/fixtures/companies.yml +9 -9
  88. data/test/fixtures/custom_locations.yml +61 -61
  89. data/test/fixtures/locations.yml +61 -61
  90. data/test/fixtures/mock_addresses.yml +16 -16
  91. data/test/fixtures/mock_families.yml +2 -2
  92. data/test/fixtures/mock_houses.yml +8 -8
  93. data/test/fixtures/mock_organizations.yml +4 -4
  94. data/test/fixtures/mock_people.yml +4 -4
  95. data/test/ip_geocode_lookup_test.rb +53 -0
  96. data/test/models/company.rb +2 -2
  97. data/test/models/custom_location.rb +11 -11
  98. data/test/models/location.rb +3 -3
  99. data/test/models/mock_address.rb +3 -3
  100. data/test/models/mock_family.rb +4 -4
  101. data/test/models/mock_house.rb +2 -2
  102. data/test/models/mock_organization.rb +5 -5
  103. data/test/models/mock_person.rb +6 -6
  104. data/test/models/store.rb +2 -2
  105. data/test/schema.rb +61 -61
  106. data/test/tasks.rake +37 -37
  107. data/test/test_helper.rb +83 -56
  108. metadata +137 -37
  109. data/.travis.yml +0 -29
  110. data/test/ip_geocode_lookup_test.disabled.rb +0 -82
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8abd196ef01725dfea499611d751fe08d1f42da5473c7896d526b16044e5c7a
4
- data.tar.gz: aef079a740792c981bb86d07d48c3686b2d939d5ce1792dd50d7d5c4bfe6bc05
3
+ metadata.gz: 7bc2b5e4c6de16393de8702315f0b01bc98e30038a5ecee3f54a48fe156f948f
4
+ data.tar.gz: 84d6fbc137e77051518c4d20c26dd6c6c0c2c0b16345de8a8c3363765194fd85
5
5
  SHA512:
6
- metadata.gz: 7de113ad53d0ae12a3919337e70ec69d91a59f1ae9147235ee2eb42ccdd20e73438784bba5eb6122da7bb1185e28cd8d321af7a63c654b153ead266ac96d548b
7
- data.tar.gz: ad3e5699a610b9ef8ef451bd76bef841f36272a96896a04c2610d8cb21603f869a0c670a4754366d8b3df5dc13e3f03a3807f9a96848abe63ae0e30aa45b40e9
6
+ metadata.gz: 603470542be8033cf17f8976bb1b9488727cc11b1c311039c3074318f93b9bc8dfbf2c1509f8b11a5dceb8320255f89763a27c03ad23e043ecea53da20cb3f4d
7
+ data.tar.gz: f5212fc66504f5daa74b6f147132c941cb87e615d22df26525b7a4c890f53eeacf5434b347f7a0b9c6e6881c0673ca7f6e8298fca3b913ccb4312e4a5638b275
@@ -0,0 +1,80 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ sqlite:
12
+ name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }} / sqlite
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: ['3.2', '3.3', '3.4', '4.0']
19
+ gemfile: [rails7.1, rails7.2, rails8.0, rails8.1]
20
+
21
+ env:
22
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
23
+
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+
27
+ - uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: ${{ matrix.ruby }}
30
+ bundler-cache: true
31
+
32
+ - run: bundle exec rake test
33
+
34
+ mysql:
35
+ name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }} / ${{ matrix.db }}
36
+ runs-on: ubuntu-latest
37
+
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ db: [mysql]
42
+ ruby: ['3.2', '4.0']
43
+ include:
44
+ - ruby: '3.2'
45
+ gemfile: rails7.1
46
+ - ruby: '4.0'
47
+ gemfile: rails8.1
48
+
49
+ services:
50
+ mysql:
51
+ image: mysql:8.4
52
+ env:
53
+ MYSQL_ROOT_PASSWORD: root
54
+ MYSQL_USER: tests
55
+ MYSQL_PASSWORD: tests
56
+ MYSQL_DATABASE: geokit_rails_tests
57
+ ports:
58
+ - 3306:3306
59
+ options: >-
60
+ --health-cmd "mysqladmin ping -h 127.0.0.1"
61
+ --health-interval 5s
62
+ --health-timeout 5s
63
+ --health-retries 20
64
+
65
+ env:
66
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
67
+ DB: ${{ matrix.db }}
68
+ DB_HOST: 127.0.0.1
69
+ DB_USERNAME: tests
70
+ DB_PASSWORD: tests
71
+
72
+ steps:
73
+ - uses: actions/checkout@v7
74
+
75
+ - uses: ruby/setup-ruby@v1
76
+ with:
77
+ ruby-version: ${{ matrix.ruby }}
78
+ bundler-cache: true
79
+
80
+ - run: bundle exec rake test
data/.gitignore CHANGED
@@ -1,37 +1,44 @@
1
- # Bundler
2
- # http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
3
- Gemfile.lock
4
-
5
- # Test log files
6
- test/*-debug.log
7
-
8
- # SQLite Test DB
9
- test/test.sqlite3
10
-
11
- # SVN
12
- .svn
13
-
14
- # RVM
15
- .rvmrc
16
-
17
- # TextMate
18
- *.tmproj
19
-
20
- # rcov generated
21
- coverage
22
-
23
- # rdoc generated
24
- rdoc
25
-
26
- # yard generated
27
- doc
28
- .yardoc
29
-
30
- # bundler
31
- .bundle
32
-
33
- # builds
34
- *.gem
35
-
36
- # For MacOS:
37
- .DS_Store
1
+ # Bundler
2
+ # http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
3
+ Gemfile.lock
4
+ gemfiles/*.lock
5
+
6
+ # Test log files
7
+ test/*-debug.log
8
+
9
+ # SQLite Test DB
10
+ test/test.sqlite3*
11
+
12
+ # SVN
13
+ .svn
14
+
15
+ # RVM
16
+ .rvmrc
17
+
18
+ # TextMate
19
+ *.tmproj
20
+
21
+ # rcov generated
22
+ coverage
23
+
24
+ # rdoc generated
25
+ rdoc
26
+
27
+ # yard generated
28
+ doc
29
+ .yardoc
30
+
31
+ # bundler
32
+ .bundle
33
+
34
+ # builds
35
+ *.gem
36
+
37
+ # For MacOS:
38
+ .DS_Store
39
+
40
+ # Dummy app artifacts
41
+ test/dummy/db/*.sqlite3*
42
+ test/dummy/test/*.sqlite3*
43
+ test/dummy/log/*.log
44
+ test/dummy/tmp/
data/CHANGELOG.md CHANGED
@@ -1,96 +1,106 @@
1
- ## 2.3.2
2
-
3
- * Fix sqlite3 adapter error
4
-
5
- ## 2.3.1
6
-
7
- * Fix Rails 5.2 deprecation warning
8
-
9
- ## 2.3.0
10
-
11
- * Drop ruby 1.9 and add 2.3 support
12
- * Add an option to skip loading
13
- * Remove excessive debug statement
14
-
15
- ## 2.2.0
16
-
17
- * Add rails config aenerator
18
- * Add NOT NULL checks for latitude and longitude, otherwise nonsense
19
- values are being returned for distance calculations involving such
20
- objects.
21
- * Fix inconsistent case where retrieve_location_from_cookie_or_services
22
- returned a Hash instead of a GeoLoc
23
- * Speed up SQL with bounding box
24
- * Tests against rails 4 & 5
25
-
26
- ## 2.1.0
27
-
28
- * Add OracleEnhanced adapter
29
- * Fix bug with custom latitude/longitude names
30
- * BREAKING: Nearest and fathest return scopes not arrays
31
- * Drop support for ruby 1.8/1.9
32
-
33
- ## 2.0.1
34
-
35
- * Fix GeoKit naming compatibility
36
-
37
- ## 2.0.0 / 2013-06-19
38
-
39
- * Integrated geokit-rails3 into geokit-rails (use 1.x for rails2 support)
40
-
41
- ## 1.2.0 / 2009-10-02
42
-
43
- * Overhaul the test suite to be independent of a Rails project
44
- * Added concept of database adapter. Ported mysql/postgresql conditional code to their own adapter.
45
- * Added SQL Server support. THANKS http://github.com/brennandunn for all the improvements in this release
46
-
47
- ## 1.1.3 / 2009-09-26
48
-
49
- * documentation updates and updated to work with Geokit gem v1.5.0
50
- * IMPORTANT: in the Geokit gem, Geokit::Geocoders::timeout became Geokit::Geocoders::request_timeout for jruby compatibility.
51
- The plugin sets this in config/initializers/geokit_config.rb. So if you've upgraded the gem to 1.5.0, you need to
52
- make the change manually from Geokit::Geocoders::timeout to Geokit::Geocoders::request_timeout in config/initializers/geokit_config.rb
53
-
54
- ## 1.1.2 / 2009-06-08
55
-
56
- * Added support for hashes in :through. So you can do: acts_as_mappable :through => { :state => :country } (Thanks José Valim).
57
-
58
- ## 1.1.1 / 2009-05-22
59
- * Support for multiple ip geocoders (Thanks dreamcat4)
60
- * Now checks if either :origin OR :bounds is passed, and proceeds with geokit query if this is true (Thanks Glenn Powell)
61
- * Raises a helpful error if someone uses through but the association does not exists or was not defined yet (Thanks José Valim)
62
-
63
- ## 1.1.0 / 2009-04-11
64
-
65
- * Fixed :through usages so that the through model is only included in the query if there
66
- is an :origin passed in (Only if it is a geokit search) (Thanks Glenn Powell)
67
- * Move library initialisation into lib/geokit-rails. init.rb uses lib/geokit-rails now (thanks Alban Peignier)
68
- * Handle the case where a user passes a hash to the :conditions Finder option (thanks Adam Greene)
69
- * Added ability to specify domain-specific API keys (Thanks Glenn Powell)
70
-
71
- ## 2009-02-20
72
-
73
- * More powerful assosciations in the Rails Plugin:You can now specify a model as mappable "through" an associated model.
74
- In other words, that associated model is the actual mappable model with "lat" and "lng" attributes, but this "through" model
75
- can still utilize all Geokit's "find by distance" finders. Also Rails 2.3 compatibility (thanks github/glennpow)
76
-
77
- ## 2008-12-18
78
-
79
- * Split Rails plugin from geocoder gem
80
- * updated for Rails 2.2.2
81
-
82
- ## 2008-08-20
83
-
84
- * Further fix of distance calculation, this time in SQL. Now uses least() function, which is available in MySQL version 3.22.5+ and postgres versions 8.1+
85
-
86
- ## 2008-01-16
87
-
88
- * fixed the "zero-distance" bug (calculating between two points that are the same)
89
-
90
- ## 2007-11-12
91
-
92
- * fixed a small but with queries crossing meridian, and also fixed find(:closest)
93
-
94
- ## 2007-10-11
95
-
96
- * Fixed Rails2/Edge compatability
1
+ ## 2.5.1
2
+
3
+ * Run the test suite on GitHub Actions against Ruby 3.2 to 4.0, Rails 7.1 to 8.1, SQLite and MySQL
4
+ * Only look up finder adapters in `Geokit::Adapters`, so a top-level constant with the same name defined by another gem isn't mistaken for one
5
+
6
+ ## 2.5.0
7
+
8
+ * Fixed dangerous YAML loading vulnerability
9
+ * Rebuilt integration tests
10
+
11
+ ## 2.3.2
12
+
13
+ * Fix sqlite3 adapter error
14
+
15
+ ## 2.3.1
16
+
17
+ * Fix Rails 5.2 deprecation warning
18
+
19
+ ## 2.3.0
20
+
21
+ * Drop ruby 1.9 and add 2.3 support
22
+ * Add an option to skip loading
23
+ * Remove excessive debug statement
24
+
25
+ ## 2.2.0
26
+
27
+ * Add rails config aenerator
28
+ * Add NOT NULL checks for latitude and longitude, otherwise nonsense
29
+ values are being returned for distance calculations involving such
30
+ objects.
31
+ * Fix inconsistent case where retrieve_location_from_cookie_or_services
32
+ returned a Hash instead of a GeoLoc
33
+ * Speed up SQL with bounding box
34
+ * Tests against rails 4 & 5
35
+
36
+ ## 2.1.0
37
+
38
+ * Add OracleEnhanced adapter
39
+ * Fix bug with custom latitude/longitude names
40
+ * BREAKING: Nearest and fathest return scopes not arrays
41
+ * Drop support for ruby 1.8/1.9
42
+
43
+ ## 2.0.1
44
+
45
+ * Fix GeoKit naming compatibility
46
+
47
+ ## 2.0.0 / 2013-06-19
48
+
49
+ * Integrated geokit-rails3 into geokit-rails (use 1.x for rails2 support)
50
+
51
+ ## 1.2.0 / 2009-10-02
52
+
53
+ * Overhaul the test suite to be independent of a Rails project
54
+ * Added concept of database adapter. Ported mysql/postgresql conditional code to their own adapter.
55
+ * Added SQL Server support. THANKS http://github.com/brennandunn for all the improvements in this release
56
+
57
+ ## 1.1.3 / 2009-09-26
58
+
59
+ * documentation updates and updated to work with Geokit gem v1.5.0
60
+ * IMPORTANT: in the Geokit gem, Geokit::Geocoders::timeout became Geokit::Geocoders::request_timeout for jruby compatibility.
61
+ The plugin sets this in config/initializers/geokit_config.rb. So if you've upgraded the gem to 1.5.0, you need to
62
+ make the change manually from Geokit::Geocoders::timeout to Geokit::Geocoders::request_timeout in config/initializers/geokit_config.rb
63
+
64
+ ## 1.1.2 / 2009-06-08
65
+
66
+ * Added support for hashes in :through. So you can do: acts_as_mappable :through => { :state => :country } (Thanks José Valim).
67
+
68
+ ## 1.1.1 / 2009-05-22
69
+ * Support for multiple ip geocoders (Thanks dreamcat4)
70
+ * Now checks if either :origin OR :bounds is passed, and proceeds with geokit query if this is true (Thanks Glenn Powell)
71
+ * Raises a helpful error if someone uses through but the association does not exists or was not defined yet (Thanks José Valim)
72
+
73
+ ## 1.1.0 / 2009-04-11
74
+
75
+ * Fixed :through usages so that the through model is only included in the query if there
76
+ is an :origin passed in (Only if it is a geokit search) (Thanks Glenn Powell)
77
+ * Move library initialisation into lib/geokit-rails. init.rb uses lib/geokit-rails now (thanks Alban Peignier)
78
+ * Handle the case where a user passes a hash to the :conditions Finder option (thanks Adam Greene)
79
+ * Added ability to specify domain-specific API keys (Thanks Glenn Powell)
80
+
81
+ ## 2009-02-20
82
+
83
+ * More powerful assosciations in the Rails Plugin:You can now specify a model as mappable "through" an associated model.
84
+ In other words, that associated model is the actual mappable model with "lat" and "lng" attributes, but this "through" model
85
+ can still utilize all Geokit's "find by distance" finders. Also Rails 2.3 compatibility (thanks github/glennpow)
86
+
87
+ ## 2008-12-18
88
+
89
+ * Split Rails plugin from geocoder gem
90
+ * updated for Rails 2.2.2
91
+
92
+ ## 2008-08-20
93
+
94
+ * Further fix of distance calculation, this time in SQL. Now uses least() function, which is available in MySQL version 3.22.5+ and postgres versions 8.1+
95
+
96
+ ## 2008-01-16
97
+
98
+ * fixed the "zero-distance" bug (calculating between two points that are the same)
99
+
100
+ ## 2007-11-12
101
+
102
+ * fixed a small but with queries crossing meridian, and also fixed find(:closest)
103
+
104
+ ## 2007-10-11
105
+
106
+ * Fixed Rails2/Edge compatability
data/CONFIG.markdown CHANGED
@@ -1,67 +1,67 @@
1
- # You can configure Geokit in your environment files
2
-
3
- These defaults are used in `Geokit::Mappable.distance_to` and in `acts_as_mappable`
4
-
5
- config.geokit.default_units = :miles
6
- config.geokit.default_formula = :sphere
7
-
8
- This is the timeout value in seconds to be used for calls to the geocoder web services. For no timeout at all, comment out the setting. The timeout unit is in seconds.
9
-
10
- config.geokit.geocoders.request_timeout = 3
11
-
12
- These settings are used if web service calls must be routed through a proxy.
13
- These setting can be `nil` if not needed, otherwise, addr and port must be filled in at a minimum. If the proxy requires authentication, the username and password can be provided as well.
14
-
15
- config.geokit.geocoders.proxy_addr = nil
16
- config.geokit.geocoders.proxy_port = nil
17
- config.geokit.geocoders.proxy_user = nil
18
- config.geokit.geocoders.proxy_pass = nil
19
-
20
- This is your yahoo application key for the Yahoo Geocoder.
21
-
22
- See [http://developer.yahoo.com/faq/index.html#appid](http://developer.yahoo.com/faq/index.html#appid)
23
- and [http://developer.yahoo.com/maps/rest/V1/geocode.html](http://developer.yahoo.com/maps/rest/V1/geocode.html)
24
-
25
- config.geokit.geocoders.yahoo = 'REPLACE_WITH_YOUR_YAHOO_KEY'
26
-
27
- This is your Google Maps geocoder key.
28
-
29
- See [http://www.google.com/apis/maps/signup.html](http://www.google.com/apis/maps/signup.html)
30
- and [http://www.google.com/apis/maps/documentation/#Geocoding_Examples](http://www.google.com/apis/maps/documentation/#Geocoding_Examples)
31
-
32
- config.geokit.geocoders.google = 'REPLACE_WITH_YOUR_GOOGLE_KEY'
33
-
34
- This is your username and password for **geocoder.us**.
35
- To use the free service, the value can be set to `nil` or `false`.
36
- For usage tied to an account, the value should be set to `username:password`.
37
-
38
- See [http://geocoder.us](http://geocoder.us)
39
- and [http://geocoder.us/user/signup](http://geocoder.us/user/signup)
40
-
41
- config.geokit.geocoders.geocoder_us = false
42
-
43
- This is your authorization key for **geocoder.ca**.
44
- To use the free service, the value can be set to `nil` or `false`. For usage tied to an account, set the value to the key obtained from
45
- **Geocoder.ca**.
46
-
47
- See [http://geocoder.ca](http://geocoder.ca)
48
- and [http://geocoder.ca/?register=1](http://geocoder.ca/?register=1)
49
-
50
- config.geokit.geocoders.geocoder_ca = false
51
-
52
- Add this to use a username with the Geonames geocoder
53
-
54
- config.geokit.geocoders.geonames="REPLACE_WITH_YOUR_GEONAMES_USERNAME"
55
-
56
- This is the order in which the geocoders are called in a failover scenario.
57
- If you only want to use a single geocoder, put a single symbol in the array.
58
- Valid symbols are `:google`, `:yahoo`, `:us`, and `:ca`.
59
- Be aware that there are **Terms of Use** restrictions on how you can use the various geocoders. Make sure you read up on relevant **Terms of Use** for each geocoder you are going to use.
60
-
61
- config.geokit.geocoders.provider_order = [:google,:us]
62
-
63
- The IP provider order. Valid symbols are `:ip`, `:geo_plugin`.
64
- As before, make sure you read up on relevant **Terms of Use** for each
65
-
66
- config.geokit.geocoders.ip_provider_order = [:geo_plugin,:ip]
67
-
1
+ # You can configure Geokit in your environment files
2
+
3
+ These defaults are used in `Geokit::Mappable.distance_to` and in `acts_as_mappable`
4
+
5
+ config.geokit.default_units = :miles
6
+ config.geokit.default_formula = :sphere
7
+
8
+ This is the timeout value in seconds to be used for calls to the geocoder web services. For no timeout at all, comment out the setting. The timeout unit is in seconds.
9
+
10
+ config.geokit.geocoders.request_timeout = 3
11
+
12
+ These settings are used if web service calls must be routed through a proxy.
13
+ These setting can be `nil` if not needed, otherwise, addr and port must be filled in at a minimum. If the proxy requires authentication, the username and password can be provided as well.
14
+
15
+ config.geokit.geocoders.proxy_addr = nil
16
+ config.geokit.geocoders.proxy_port = nil
17
+ config.geokit.geocoders.proxy_user = nil
18
+ config.geokit.geocoders.proxy_pass = nil
19
+
20
+ This is your yahoo application key for the Yahoo Geocoder.
21
+
22
+ See [http://developer.yahoo.com/faq/index.html#appid](http://developer.yahoo.com/faq/index.html#appid)
23
+ and [http://developer.yahoo.com/maps/rest/V1/geocode.html](http://developer.yahoo.com/maps/rest/V1/geocode.html)
24
+
25
+ config.geokit.geocoders.yahoo = 'REPLACE_WITH_YOUR_YAHOO_KEY'
26
+
27
+ This is your Google Maps geocoder key.
28
+
29
+ See [http://www.google.com/apis/maps/signup.html](http://www.google.com/apis/maps/signup.html)
30
+ and [http://www.google.com/apis/maps/documentation/#Geocoding_Examples](http://www.google.com/apis/maps/documentation/#Geocoding_Examples)
31
+
32
+ config.geokit.geocoders.google = 'REPLACE_WITH_YOUR_GOOGLE_KEY'
33
+
34
+ This is your username and password for **geocoder.us**.
35
+ To use the free service, the value can be set to `nil` or `false`.
36
+ For usage tied to an account, the value should be set to `username:password`.
37
+
38
+ See [http://geocoder.us](http://geocoder.us)
39
+ and [http://geocoder.us/user/signup](http://geocoder.us/user/signup)
40
+
41
+ config.geokit.geocoders.geocoder_us = false
42
+
43
+ This is your authorization key for **geocoder.ca**.
44
+ To use the free service, the value can be set to `nil` or `false`. For usage tied to an account, set the value to the key obtained from
45
+ **Geocoder.ca**.
46
+
47
+ See [http://geocoder.ca](http://geocoder.ca)
48
+ and [http://geocoder.ca/?register=1](http://geocoder.ca/?register=1)
49
+
50
+ config.geokit.geocoders.geocoder_ca = false
51
+
52
+ Add this to use a username with the Geonames geocoder
53
+
54
+ config.geokit.geocoders.geonames="REPLACE_WITH_YOUR_GEONAMES_USERNAME"
55
+
56
+ This is the order in which the geocoders are called in a failover scenario.
57
+ If you only want to use a single geocoder, put a single symbol in the array.
58
+ Valid symbols are `:google`, `:yahoo`, `:us`, and `:ca`.
59
+ Be aware that there are **Terms of Use** restrictions on how you can use the various geocoders. Make sure you read up on relevant **Terms of Use** for each geocoder you are going to use.
60
+
61
+ config.geokit.geocoders.provider_order = [:google,:us]
62
+
63
+ The IP provider order. Valid symbols are `:ip`, `:geo_plugin`.
64
+ As before, make sure you read up on relevant **Terms of Use** for each
65
+
66
+ config.geokit.geocoders.ip_provider_order = [:geo_plugin,:ip]
67
+
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2013 Michael Noack, James Cox, Bill Eisenhauer & Andre Lewis
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1
+ Copyright (c) 2013 Michael Noack, James Cox, Bill Eisenhauer & Andre Lewis
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.