geocoder 0.9.13 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of geocoder might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +16 -7
- data/README.rdoc +116 -51
- data/bin/geocode +5 -0
- data/lib/geocoder.rb +30 -43
- data/lib/geocoder/calculations.rb +4 -21
- data/lib/geocoder/cli.rb +111 -0
- data/lib/geocoder/configuration.rb +6 -7
- data/lib/geocoder/lookups/base.rb +36 -9
- data/lib/geocoder/lookups/bing.rb +33 -0
- data/lib/geocoder/lookups/google.rb +4 -0
- data/lib/geocoder/lookups/yahoo.rb +5 -2
- data/lib/geocoder/lookups/yandex.rb +39 -0
- data/lib/geocoder/models/base.rb +5 -1
- data/lib/geocoder/results/base.rb +16 -0
- data/lib/geocoder/results/bing.rb +48 -0
- data/lib/geocoder/results/freegeoip.rb +10 -3
- data/lib/geocoder/results/geocoder_ca.rb +14 -12
- data/lib/geocoder/results/google.rb +15 -2
- data/lib/geocoder/results/yahoo.rb +10 -2
- data/lib/geocoder/results/yandex.rb +48 -0
- data/lib/geocoder/stores/active_record.rb +2 -7
- data/lib/geocoder/stores/base.rb +2 -10
- data/lib/geocoder/version.rb +3 -0
- data/test/fixtures/bing_madison_square_garden.json +40 -0
- data/test/fixtures/bing_no_results.json +16 -0
- data/test/fixtures/bing_reverse.json +42 -0
- data/test/fixtures/yandex_invalid_key.json +1 -0
- data/test/fixtures/yandex_kremlin.json +48 -0
- data/test/fixtures/yandex_no_results.json +16 -0
- data/test/geocoder_test.rb +58 -8
- data/test/test_helper.rb +39 -3
- metadata +69 -58
- data/VERSION +0 -1
- data/lib/geocoder/stores/active_record_legacy.rb +0 -62
metadata
CHANGED
@@ -2,71 +2,82 @@
|
|
2
2
|
name: geocoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Alex Reisner
|
8
|
+
- Alex Reisner
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-09 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
17
|
-
description: Provides object geocoding (by street or IP address), reverse geocoding (coordinates to street address),
|
17
|
+
description: Provides object geocoding (by street or IP address), reverse geocoding (coordinates to street address), distance queries for ActiveRecord and Mongoid, result caching, and more. Designed for Rails but works with Sinatra and other Rack frameworks too.
|
18
18
|
email:
|
19
|
-
- alex@alexreisner.com
|
20
|
-
executables:
|
21
|
-
|
19
|
+
- alex@alexreisner.com
|
20
|
+
executables:
|
21
|
+
- geocode
|
22
22
|
extensions: []
|
23
23
|
|
24
24
|
extra_rdoc_files: []
|
25
25
|
|
26
26
|
files:
|
27
|
-
- .gitignore
|
28
|
-
- CHANGELOG.rdoc
|
29
|
-
- LICENSE
|
30
|
-
- README.rdoc
|
31
|
-
- Rakefile
|
32
|
-
-
|
33
|
-
- lib/geocoder.rb
|
34
|
-
- lib/geocoder/cache.rb
|
35
|
-
- lib/geocoder/calculations.rb
|
36
|
-
- lib/geocoder/
|
37
|
-
- lib/geocoder/
|
38
|
-
- lib/geocoder/lookups/
|
39
|
-
- lib/geocoder/lookups/
|
40
|
-
- lib/geocoder/lookups/
|
41
|
-
- lib/geocoder/lookups/
|
42
|
-
- lib/geocoder/
|
43
|
-
- lib/geocoder/
|
44
|
-
- lib/geocoder/
|
45
|
-
- lib/geocoder/
|
46
|
-
- lib/geocoder/
|
47
|
-
- lib/geocoder/
|
48
|
-
- lib/geocoder/
|
49
|
-
- lib/geocoder/
|
50
|
-
- lib/geocoder/results/
|
51
|
-
- lib/geocoder/results/
|
52
|
-
- lib/geocoder/
|
53
|
-
- lib/geocoder/
|
54
|
-
- lib/geocoder/
|
55
|
-
- lib/geocoder/
|
56
|
-
- lib/
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
- test/fixtures/
|
63
|
-
- test/fixtures/
|
64
|
-
- test/fixtures/
|
65
|
-
- test/fixtures/
|
66
|
-
- test/fixtures/
|
67
|
-
- test/fixtures/
|
68
|
-
- test/
|
69
|
-
- test/
|
27
|
+
- .gitignore
|
28
|
+
- CHANGELOG.rdoc
|
29
|
+
- LICENSE
|
30
|
+
- README.rdoc
|
31
|
+
- Rakefile
|
32
|
+
- bin/geocode
|
33
|
+
- lib/geocoder.rb
|
34
|
+
- lib/geocoder/cache.rb
|
35
|
+
- lib/geocoder/calculations.rb
|
36
|
+
- lib/geocoder/cli.rb
|
37
|
+
- lib/geocoder/configuration.rb
|
38
|
+
- lib/geocoder/lookups/base.rb
|
39
|
+
- lib/geocoder/lookups/bing.rb
|
40
|
+
- lib/geocoder/lookups/freegeoip.rb
|
41
|
+
- lib/geocoder/lookups/geocoder_ca.rb
|
42
|
+
- lib/geocoder/lookups/google.rb
|
43
|
+
- lib/geocoder/lookups/yahoo.rb
|
44
|
+
- lib/geocoder/lookups/yandex.rb
|
45
|
+
- lib/geocoder/models/active_record.rb
|
46
|
+
- lib/geocoder/models/base.rb
|
47
|
+
- lib/geocoder/models/mongoid.rb
|
48
|
+
- lib/geocoder/railtie.rb
|
49
|
+
- lib/geocoder/request.rb
|
50
|
+
- lib/geocoder/results/base.rb
|
51
|
+
- lib/geocoder/results/bing.rb
|
52
|
+
- lib/geocoder/results/freegeoip.rb
|
53
|
+
- lib/geocoder/results/geocoder_ca.rb
|
54
|
+
- lib/geocoder/results/google.rb
|
55
|
+
- lib/geocoder/results/yahoo.rb
|
56
|
+
- lib/geocoder/results/yandex.rb
|
57
|
+
- lib/geocoder/stores/active_record.rb
|
58
|
+
- lib/geocoder/stores/base.rb
|
59
|
+
- lib/geocoder/stores/mongoid.rb
|
60
|
+
- lib/geocoder/version.rb
|
61
|
+
- lib/tasks/geocoder.rake
|
62
|
+
- test/fixtures/bing_madison_square_garden.json
|
63
|
+
- test/fixtures/bing_no_results.json
|
64
|
+
- test/fixtures/bing_reverse.json
|
65
|
+
- test/fixtures/freegeoip_74_200_247_59.json
|
66
|
+
- test/fixtures/geocoder_ca_madison_square_garden.json
|
67
|
+
- test/fixtures/geocoder_ca_no_results.json
|
68
|
+
- test/fixtures/geocoder_ca_reverse.json
|
69
|
+
- test/fixtures/google_garbage.json
|
70
|
+
- test/fixtures/google_madison_square_garden.json
|
71
|
+
- test/fixtures/google_no_locality.json
|
72
|
+
- test/fixtures/google_no_results.json
|
73
|
+
- test/fixtures/yahoo_garbage.json
|
74
|
+
- test/fixtures/yahoo_madison_square_garden.json
|
75
|
+
- test/fixtures/yahoo_no_results.json
|
76
|
+
- test/fixtures/yandex_invalid_key.json
|
77
|
+
- test/fixtures/yandex_kremlin.json
|
78
|
+
- test/fixtures/yandex_no_results.json
|
79
|
+
- test/geocoder_test.rb
|
80
|
+
- test/test_helper.rb
|
70
81
|
has_rdoc: true
|
71
82
|
homepage: http://www.rubygeocoder.com
|
72
83
|
licenses: []
|
@@ -75,23 +86,23 @@ post_install_message:
|
|
75
86
|
rdoc_options: []
|
76
87
|
|
77
88
|
require_paths:
|
78
|
-
- lib
|
89
|
+
- lib
|
79
90
|
required_ruby_version: !ruby/object:Gem::Requirement
|
80
91
|
none: false
|
81
92
|
requirements:
|
82
|
-
|
83
|
-
|
84
|
-
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
85
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
97
|
none: false
|
87
98
|
requirements:
|
88
|
-
|
89
|
-
|
90
|
-
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
91
102
|
requirements: []
|
92
103
|
|
93
104
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
105
|
+
rubygems_version: 1.5.1
|
95
106
|
signing_key:
|
96
107
|
specification_version: 3
|
97
108
|
summary: Complete geocoding solution for Ruby.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.9.13
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module Geocoder::Store::ActiveRecord
|
2
|
-
module Legacy
|
3
|
-
|
4
|
-
##
|
5
|
-
# Fetch coordinates and update (save) +latitude+ and +longitude+ data.
|
6
|
-
#
|
7
|
-
def fetch_coordinates!
|
8
|
-
warn "DEPRECATION WARNING: The 'fetch_coordinates!' method is deprecated and will be removed in geocoder v1.0. " +
|
9
|
-
"Please use 'geocode' instead and then save your objects manually."
|
10
|
-
do_lookup(false) do |o,rs|
|
11
|
-
r = rs.first
|
12
|
-
unless r.latitude.nil? or r.longitude.nil?
|
13
|
-
o.send :update_attribute, self.class.geocoder_options[:latitude], r.latitude
|
14
|
-
o.send :update_attribute, self.class.geocoder_options[:longitude], r.longitude
|
15
|
-
end
|
16
|
-
r.coordinates
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def fetch_coordinates(*args)
|
21
|
-
warn "DEPRECATION WARNING: The 'fetch_coordinates' method will cease taking " +
|
22
|
-
"an argument in geocoder v1.0. Please save your objects manually." if args.size > 0
|
23
|
-
do_lookup(false) do |o,rs|
|
24
|
-
r = rs.first
|
25
|
-
unless r.latitude.nil? or r.longitude.nil?
|
26
|
-
method = ((args.size > 0 && args.first) ? "update" : "write" ) + "_attribute"
|
27
|
-
o.send method, self.class.geocoder_options[:latitude], r.latitude
|
28
|
-
o.send method, self.class.geocoder_options[:longitude], r.longitude
|
29
|
-
end
|
30
|
-
r.coordinates
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
##
|
35
|
-
# Fetch address and update (save) +address+ data.
|
36
|
-
#
|
37
|
-
def fetch_address!
|
38
|
-
warn "DEPRECATION WARNING: The 'fetch_address!' method is deprecated and will be removed in geocoder v1.0. " +
|
39
|
-
"Please use 'reverse_geocode' instead and then save your objects manually."
|
40
|
-
do_lookup(true) do |o,rs|
|
41
|
-
r = rs.first
|
42
|
-
unless r.address.nil?
|
43
|
-
o.send :update_attribute, self.class.geocoder_options[:fetched_address], r.address
|
44
|
-
end
|
45
|
-
r.address
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def fetch_address(*args)
|
50
|
-
warn "DEPRECATION WARNING: The 'fetch_address' method will cease taking " +
|
51
|
-
"an argument in geocoder v1.0. Please save your objects manually." if args.size > 0
|
52
|
-
do_lookup(true) do |o,rs|
|
53
|
-
r = rs.first
|
54
|
-
unless r.latitude.nil? or r.longitude.nil?
|
55
|
-
method = ((args.size > 0 && args.first) ? "update" : "write" ) + "_attribute"
|
56
|
-
o.send method, self.class.geocoder_options[:fetched_address], r.address
|
57
|
-
end
|
58
|
-
r.address
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|