geocoder 1.1.3 → 1.1.4
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.
Potentially problematic release.
This version of geocoder might be problematic. Click here for more details.
- data/CHANGELOG.rdoc +12 -0
- data/README.md +580 -0
- data/examples/autoexpire_cache.rb +30 -0
- data/lib/geocoder.rb +9 -85
- data/lib/geocoder/calculations.rb +1 -1
- data/lib/geocoder/cli.rb +9 -10
- data/lib/geocoder/configuration.rb +3 -1
- data/lib/geocoder/lookup.rb +81 -0
- data/lib/geocoder/lookups/base.rb +20 -32
- data/lib/geocoder/lookups/bing.rb +12 -8
- data/lib/geocoder/lookups/freegeoip.rb +5 -5
- data/lib/geocoder/lookups/geocoder_ca.rb +13 -9
- data/lib/geocoder/lookups/google.rb +19 -7
- data/lib/geocoder/lookups/google_premier.rb +8 -7
- data/lib/geocoder/lookups/mapquest.rb +5 -23
- data/lib/geocoder/lookups/nominatim.rb +16 -13
- data/lib/geocoder/lookups/test.rb +8 -6
- data/lib/geocoder/lookups/yahoo.rb +49 -10
- data/lib/geocoder/lookups/yandex.rb +15 -8
- data/lib/geocoder/models/mongoid.rb +0 -1
- data/lib/geocoder/query.rb +88 -0
- data/lib/geocoder/results/mapquest.rb +2 -61
- data/lib/geocoder/results/nominatim.rb +24 -3
- data/lib/geocoder/sql.rb +104 -0
- data/lib/geocoder/stores/active_record.rb +68 -140
- data/lib/geocoder/stores/mongo_base.rb +2 -2
- data/lib/geocoder/version.rb +1 -1
- data/test/active_record_test.rb +15 -0
- data/test/calculations_test.rb +7 -0
- data/test/error_handling_test.rb +7 -7
- data/test/fixtures/yahoo_madison_square_garden.json +49 -43
- data/test/fixtures/yahoo_v1_madison_square_garden.json +46 -0
- data/test/fixtures/yahoo_v1_no_results.json +10 -0
- data/test/https_test.rb +2 -2
- data/test/integration/smoke_test.rb +6 -4
- data/test/lookup_test.rb +13 -6
- data/test/query_test.rb +34 -0
- data/test/result_test.rb +1 -1
- data/test/services_test.rb +48 -7
- data/test/test_helper.rb +64 -49
- data/test/test_mode_test.rb +0 -1
- metadata +13 -7
- data/README.rdoc +0 -552
- data/test/fixtures/yahoo_garbage.json +0 -50
- data/test/input_handling_test.rb +0 -43
@@ -1,50 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"ResultSet":{
|
3
|
-
"version":"1.0",
|
4
|
-
"Error":0,
|
5
|
-
"ErrorMessage":"No error",
|
6
|
-
"Locale":"us_US",
|
7
|
-
"Quality":87,
|
8
|
-
"Found":1,
|
9
|
-
"Results":[{
|
10
|
-
"quality":9,
|
11
|
-
"latitude":"55.008390",
|
12
|
-
"longitude":"-5.822485",
|
13
|
-
"offsetlat":"54.314072",
|
14
|
-
"offsetlon":"-2.230010",
|
15
|
-
"radius":1145100,
|
16
|
-
"boundingbox":{
|
17
|
-
"north":"60.854691",
|
18
|
-
"south":"49.162090",
|
19
|
-
"east":"1.768960",
|
20
|
-
"west":"-13.413930"
|
21
|
-
},
|
22
|
-
"name":"",
|
23
|
-
"line1":"",
|
24
|
-
"line2":"",
|
25
|
-
"line3":"",
|
26
|
-
"line4":"United Kingdom",
|
27
|
-
"cross":"",
|
28
|
-
"house":"",
|
29
|
-
"street":"",
|
30
|
-
"xstreet":"",
|
31
|
-
"unittype":"",
|
32
|
-
"unit":"",
|
33
|
-
"postal":"",
|
34
|
-
"neighborhood":"",
|
35
|
-
"city":"",
|
36
|
-
"county":"",
|
37
|
-
"state":"",
|
38
|
-
"country":"United Kingdom",
|
39
|
-
"countrycode":"GB",
|
40
|
-
"statecode":"",
|
41
|
-
"countycode":"",
|
42
|
-
"timezone":"Europe/London",
|
43
|
-
"areacode":"",
|
44
|
-
"uzip":"",
|
45
|
-
"hash":"",
|
46
|
-
"woeid":23424975,
|
47
|
-
"woetype":12
|
48
|
-
}]
|
49
|
-
}
|
50
|
-
}
|
data/test/input_handling_test.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class InputHandlingTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
def test_ip_address_detection
|
7
|
-
assert Geocoder.send(:ip_address?, "232.65.123.94")
|
8
|
-
assert Geocoder.send(:ip_address?, "666.65.123.94") # technically invalid
|
9
|
-
assert Geocoder.send(:ip_address?, "::ffff:12.34.56.78")
|
10
|
-
assert !Geocoder.send(:ip_address?, "232.65.123.94.43")
|
11
|
-
assert !Geocoder.send(:ip_address?, "232.65.123")
|
12
|
-
assert !Geocoder.send(:ip_address?, "::ffff:123.456.789")
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_blank_query_detection
|
16
|
-
assert Geocoder.send(:blank_query?, nil)
|
17
|
-
assert Geocoder.send(:blank_query?, "")
|
18
|
-
assert Geocoder.send(:blank_query?, "\t ")
|
19
|
-
assert !Geocoder.send(:blank_query?, "a")
|
20
|
-
assert !Geocoder.send(:blank_query?, "Москва") # no ASCII characters
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_coordinates_detection
|
24
|
-
lookup = Geocoder::Lookup::Google.new
|
25
|
-
assert lookup.send(:coordinates?, "51.178844,5")
|
26
|
-
assert lookup.send(:coordinates?, "51.178844, -1.826189")
|
27
|
-
assert !lookup.send(:coordinates?, "232.65.123")
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_does_not_choke_on_nil_address
|
31
|
-
all_lookups.each do |l|
|
32
|
-
Geocoder::Configuration.lookup = l
|
33
|
-
assert_nothing_raised { Venue.new("Venue", nil).geocode }
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_extract_coordinates
|
38
|
-
coords = [-23,47]
|
39
|
-
l = Landmark.new("Madagascar", coords[0], coords[1])
|
40
|
-
assert_equal coords, Geocoder::Calculations.extract_coordinates(l)
|
41
|
-
assert_equal coords, Geocoder::Calculations.extract_coordinates(coords)
|
42
|
-
end
|
43
|
-
end
|