graticule 0.2.12 → 1.0.0.pre
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.
- data/.autotest +13 -0
- data/.gitignore +2 -1
- data/CHANGELOG.txt +2 -0
- data/README.txt +5 -1
- data/Rakefile +31 -51
- data/VERSION +1 -1
- data/graticule.gemspec +102 -53
- data/lib/graticule/geocoder/base.rb +1 -1
- data/lib/graticule/geocoder/bogus.rb +8 -6
- data/lib/graticule/geocoder/freethepostcode.rb +38 -0
- data/lib/graticule/geocoder/geocoder_ca.rb +45 -20
- data/lib/graticule/geocoder/geocoder_us.rb +26 -14
- data/lib/graticule/geocoder/geonames.rb +51 -0
- data/lib/graticule/geocoder/google.rb +71 -44
- data/lib/graticule/geocoder/local_search_maps.rb +8 -7
- data/lib/graticule/geocoder/mapquest.rb +47 -27
- data/lib/graticule/geocoder/multi.rb +68 -8
- data/lib/graticule/geocoder/multimap.rb +49 -24
- data/lib/graticule/geocoder/yahoo.rb +57 -28
- data/lib/graticule/geocoder.rb +1 -0
- data/lib/graticule/location.rb +4 -0
- data/lib/graticule.rb +2 -4
- data/test/config.yml +32 -0
- data/test/config.yml.default +9 -12
- data/test/fixtures/responses/freethepostcode/not_found.txt +3 -0
- data/test/fixtures/responses/freethepostcode/success.txt +2 -0
- data/test/fixtures/responses/geocoder_ca/success.xml +12 -0
- data/test/fixtures/responses/geocoder_us/success.xml +3 -13
- data/test/fixtures/responses/geonames/missing.xml +4 -0
- data/test/fixtures/responses/geonames/success.xml +14 -0
- data/test/fixtures/responses/geonames/unknown.xml +4 -0
- data/test/fixtures/responses/google/partial.xml +16 -1
- data/test/fixtures/responses/google/success.xml +16 -1
- data/test/fixtures/responses/google/unknown_address.xml +8 -1
- data/test/fixtures/responses/yahoo/success.xml +2 -2
- data/test/fixtures/responses/yahoo/unknown_address.xml +1 -1
- data/test/{unit/graticule → graticule}/distance_test.rb +1 -1
- data/test/graticule/geocoder/freethepostcode_test.rb +36 -0
- data/test/graticule/geocoder/geocoder_ca_test.rb +41 -0
- data/test/{unit/graticule → graticule}/geocoder/geocoder_us_test.rb +1 -1
- data/test/{unit/graticule → graticule}/geocoder/geocoders.rb +1 -2
- data/test/graticule/geocoder/geonames_test.rb +48 -0
- data/test/{unit/graticule → graticule}/geocoder/google_test.rb +21 -26
- data/test/{unit/graticule → graticule}/geocoder/host_ip_test.rb +1 -1
- data/test/{unit/graticule → graticule}/geocoder/local_search_maps_test.rb +1 -1
- data/test/{unit/graticule → graticule}/geocoder/mapquest_test.rb +4 -2
- data/test/{unit/graticule → graticule}/geocoder/multi_test.rb +10 -2
- data/test/{unit/graticule → graticule}/geocoder/multimap_test.rb +2 -2
- data/test/{unit/graticule → graticule}/geocoder/yahoo_test.rb +6 -5
- data/test/{unit/graticule → graticule}/geocoder_test.rb +1 -5
- data/test/{unit/graticule → graticule}/location_test.rb +9 -1
- data/test/test_helper.rb +1 -2
- metadata +88 -47
- data/Manifest.txt +0 -84
- data/lib/graticule/geocoder/meta_carta.rb +0 -33
- data/lib/graticule/geocoder/postcode_anywhere.rb +0 -63
- data/lib/graticule/geocoder/rest.rb +0 -18
- data/lib/graticule/version.rb +0 -9
- data/test/fixtures/responses/meta_carta/bad_address.xml +0 -17
- data/test/fixtures/responses/meta_carta/multiple.xml +0 -33
- data/test/fixtures/responses/meta_carta/success.xml +0 -31
- data/test/fixtures/responses/postcode_anywhere/badkey.xml +0 -9
- data/test/fixtures/responses/postcode_anywhere/canada.xml +0 -16
- data/test/fixtures/responses/postcode_anywhere/empty.xml +0 -16
- data/test/fixtures/responses/postcode_anywhere/success.xml +0 -16
- data/test/fixtures/responses/postcode_anywhere/uk.xml +0 -18
- data/test/unit/graticule/geocoder/meta_carta_test.rb +0 -44
- data/test/unit/graticule/geocoder/postcode_anywhere_test.rb +0 -50
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# account code: INDIV30777
|
|
2
|
-
# license key: KG39-HM17-PZ95-NR98
|
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
|
|
4
|
-
|
|
5
|
-
module Graticule
|
|
6
|
-
module Geocoder
|
|
7
|
-
class PostcodeAnywhereTest < Test::Unit::TestCase
|
|
8
|
-
|
|
9
|
-
def setup
|
|
10
|
-
URI::HTTP.responses = []
|
|
11
|
-
URI::HTTP.uris = []
|
|
12
|
-
@geocoder = PostcodeAnywhere.new 'account_code', 'license_key'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def test_locate
|
|
16
|
-
prepare_response(:success)
|
|
17
|
-
location = Location.new(
|
|
18
|
-
:street => "204 Campbell Ave",
|
|
19
|
-
:locality => "Revelstoke",
|
|
20
|
-
:region => "BC",
|
|
21
|
-
:postal_code => "V0E",
|
|
22
|
-
:country => "Canada",
|
|
23
|
-
:longitude => -118.196970002204,
|
|
24
|
-
:latitude => 50.9997350418267
|
|
25
|
-
)
|
|
26
|
-
assert_equal location, @geocoder.locate(:street => "204 Campbell Ave",
|
|
27
|
-
:locality => "Revelstoke", :country => "Canada")
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def test_locate_uk_address
|
|
31
|
-
prepare_response(:uk)
|
|
32
|
-
|
|
33
|
-
location = Location.new :latitude => 51.5728910186362, :longitude => -0.253788666693255
|
|
34
|
-
assert_equal location, @geocoder.locate(:street => '80 Wood Lane', :locality => 'London', :country => 'UK')
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def test_empty
|
|
38
|
-
prepare_response(:empty)
|
|
39
|
-
|
|
40
|
-
assert_raises(Graticule::AddressError) { @geocoder.locate :street => 'foobar'}
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
protected
|
|
44
|
-
def prepare_response(id)
|
|
45
|
-
URI::HTTP.responses << response('postcode_anywhere', id)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|